Skip to content

Backport PR #37198 (dbt ingestion: map dbt test 'warning' results to Fail) - #37199

Merged
TeddyCr merged 1 commit into
open-metadata:2.0from
TeddyCr:taskr/backport-pr-37198-dbt-ingestion-map-0177
Nov 5, 2026
Merged

TeddyCr merged 1 commit into
open-metadata:2.0from
TeddyCr:taskr/backport-pr-37198-dbt-ingestion-map-0177

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

This backports PR #37198 onto the 2.0 branch so that dbt test results with status warn are ingested as Failed, making 2.0 behave like main. The only functional change is adding WARN = "warn" to DbtTestFailureEnum in constants.py, which routes warn results through the existing failure branch of _map_dbt_test_status with no new code path; the metadata.py change is docstring-only. The remaining changes update three tests in test_dbt.py to assert TestCaseStatus.Failed with a result value of "0" for warn cases and add the decision record docs/decisions/2026-11-05-dbt-warnings-map-to-failed.md. A reviewer should first look at the one-line constants.py addition, the sole behavior change, and compare the diff against upstream commit 3872389; the cherry-pick applied with no conflicts, matches the upstream diff line for line, and test_dbt.py passes 237/237 with the import and ruff checks passing.

Implementer's note: PR #37198 is staged on the 2.0 worktree, uncommitted: it applied cleanly, matches the upstream diff line for line, and the planned tests, import check and ruff checks all pass (237/237 in test_dbt.py).

Plan

  1. Confirm the port is not already present on the base. HEAD is the 2.0 tip fd7a694020b; the source commit 3872389cb9a (on fix/dbt-warn-as-failed) is NOT an ancestor of HEAD. Base constants.py has no WARN member in DbtTestFailureEnum (lines 137-144), so the backport is not applied.
  2. Make the worktree runnable before any test (no changes to tracked files):
    • The worktree has no env/ and no ingestion/src/metadata/generated/. Use a per-worktree venv or symlink the main checkout's venv (ln -s <main>/.venv env; confirm which directory exists in main first, since CLAUDE.md says env/ but memory says .venv/). Always invoke with PYTHONPATH=ingestion/src so the stale site-packages install is not imported.
    • Generate the pydantic models with env/bin/python scripts/datamodel_generation.py and make py_antlr. Do NOT run make generate, because its trailing $(MAKE) install repoints the shared venv.
  3. Cherry-pick the source commit with git cherry-pick -x 3872389cb9a3f639554e6e2123e298065afbbc86 (not a merge, so no -m). Expected hunks, each verified by reading the base file, so context should match:
    • constants.py: blob 56c1feabef1 is identical on the parent and on base; adds WARN = "warn" after ERROR = "error".
    • metadata.py: docstring-only hunk at base lines ~2177-2179 (_map_dbt_test_status); base text matches the PR's "before" text. No code change is in this commit.
    • test_dbt.py: three hunks at base lines ~3954 (test_real_warn_result_is_ingested, class TestAddDbtTestResultSkipsCompiledOnly), ~4060-4063 (test_warning_test_with_null_message_is_ingested, class TestAddDbtTestResultNullMessage), and ~4540-4544 (test_freshness_warn_is_ingested_with_staleness_detail, class TestAddDbtSourceFreshnessResults). Base uses self.assertEqual at 3954 and TestCaseStatus is already imported at line 32.
    • docs/decisions/2026-11-05-dbt-warnings-map-to-failed.md: new file, no conflict possible.
  4. If the cherry-pick conflicts (most likely in test_dbt.py or metadata.py), resolve by hand to the same end state: DbtTestFailureEnum gains WARN; _map_dbt_test_status returns Failed/0 for warn through the existing failure-enum branch with no new branch; the three tests assert TestCaseStatus.Failed and testResultValue[0].value == "0". Keep the base's assertEqual style only where the PR's text was not applicable. Do not touch DbtTestSuccessEnum, dbt_utils.py, or is_compiled_only_result.
  5. Verify the backport is exactly the PR's diff. Compare sorted +/- content lines of git show 3872389cb9a -- <4 files> against git show HEAD -- <4 files> (the backport commit after step 6 or the cherry-pick result). Expected: no extra lines beyond the PR's. Any extra line means a conflict resolution leaked in.
  6. RED check (announce it first; restore with trap): before keeping the constants.py change, revert only that file to the parent (git checkout HEAD~1 -- constants.py), run the

Verification

status: green (every planned check passed or was already seen green) · 4 checks: 2 passed, 2 skipped on evidence
- [skipped] PYTHONPATH=ingestion/src python -m pytest -c ingestion/pyproject.toml -n 0 -p no:cacheprovider -q ingestion/tests/unit/test_dbt.py -k 'TestAddDbtTestResultSkipsCompiledOnly or TestAddDbtTestResultNullMessage or TestAddDbtTestResultFailureReporting or TestAddDbtSourceFreshnessResults'  (seen green after the last change)
- [skipped] PYTHONPATH=ingestion/src python -c 'import metadata.ingestion.source.database.dbt.metadata'  (seen green after the last change)
- [pass] ruff check ingestion/src/metadata/ingestion/source/database/dbt/constants.py ingestion/src/metadata/ingestion/source/database/dbt/metadata.py ingestion/tests/unit/test_dbt.py
- [pass] ruff format --check ingestion/src/metadata/ingestion/source/database/dbt/constants.py ingestion/src/metadata/ingestion/source/database/dbt/metadata.py ingestion/tests/unit/test_dbt.py

Review (sol): approve

Files

.../2026-11-05-dbt-warnings-map-to-failed.md       | 27 ++++++++++++++++++++++
 .../ingestion/source/database/dbt/constants.py     |  1 +
 .../ingestion/source/database/dbt/metadata.py      |  4 ++--
 ingestion/tests/unit/test_dbt.py                   | 12 ++++++----
 4 files changed, 37 insertions(+), 7 deletions(-)

Opened by taskr run 0177.

…' results to Fai

taskr run 0177.
PR open-metadata#37198 is staged on the 2.0 worktree, uncommitted: it applied cleanly, matches the upstream diff line for line, and the planned tests, import check and ruff checks all pass (237/237 in test_dbt.py).
@TeddyCr
TeddyCr marked this pull request as ready for review November 5, 2026 18:51
@TeddyCr
TeddyCr requested a review from a team as a code owner November 5, 2026 18:51
@TeddyCr
TeddyCr requested review from Khairajani and removed request for a team November 5, 2026 18:51
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Mapping dbt warning results to Failed could misclassify threshold warnings and trigger failed-test reporting or alerts for affected checks.

Backports PR #37198 to the 2.0 branch so dbt test results with status warn are ingested as Failed, matching main. The change adds WARN = "warn" to DbtTestFailureEnum, updates three tests in test_dbt.py, and adds a decision record. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@TeddyCr TeddyCr changed the title Backport PR #37198 (dbt ingestion: map dbt test 'warning' results to F Backport PR #37198 (dbt ingestion: map dbt test 'warning' results to Fail) Nov 5, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants