-
Notifications
You must be signed in to change notification settings - Fork 1
fix: [AI-7435] accept dbt 2.0 reused run status in run_results v6 parser
#106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
fe1ea6b
fix: [AI-7435] accept dbt 2.0 `reused` run status in run_results v6 p…
Sourabhchrs93 da9e0ea
fix: [AI-7435] coordinate version bump to `0.3.2` across all bumpvers…
Sourabhchrs93 cd9d9f1
chore: [AI-7435] split test imports to satisfy ruff `I001`
Sourabhchrs93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| [bumpversion] | ||
| current_version = 0.3.1 | ||
| current_version = 0.3.2 | ||
| commit = True | ||
| tag = True | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.3.1" | ||
| __version__ = "0.3.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| """Tests for run_results v6 parser, specifically the resilient run `Status` enum. | ||
|
|
||
| Regression coverage for dbt 2.0 emitting ``status="reused"`` (and future unknown | ||
| statuses), which previously raised a ``ValidationError`` and caused the entire | ||
| run_results.json to be silently dropped during ingestion. | ||
| """ | ||
| from vendor.dbt_artifacts_parser.parser import parse_run_results | ||
| from vendor.dbt_artifacts_parser.parsers.run_results.run_results_v6 import Result | ||
| from vendor.dbt_artifacts_parser.parsers.run_results.run_results_v6 import Status | ||
|
|
||
| V6_SCHEMA = "https://schemas.getdbt.com/dbt/run-results/v6.json" | ||
|
|
||
|
|
||
| def _result(status: str, unique_id: str) -> dict: | ||
| return { | ||
| "status": status, | ||
| "timing": [], | ||
| "thread_id": "Thread-1", | ||
| "execution_time": 0.1, | ||
| "adapter_response": {}, | ||
| "unique_id": unique_id, | ||
| } | ||
|
|
||
|
|
||
| def _run_results(*statuses: str) -> dict: | ||
| return { | ||
| "metadata": { | ||
| "dbt_schema_version": V6_SCHEMA, | ||
| "dbt_version": "2.0.0", | ||
| "invocation_id": "test-invocation-123", | ||
| }, | ||
| "elapsed_time": 1.5, | ||
| "args": {}, | ||
| "results": [_result(s, f"model.proj.m{i}") for i, s in enumerate(statuses)], | ||
| } | ||
|
|
||
|
|
||
| class TestRunResultStatus: | ||
| """The run `Status` enum must accept new/unknown dbt statuses without failing.""" | ||
|
|
||
| def test_reused_status_parses(self): | ||
| """dbt 2.0 emits `reused` for unchanged models; it must not fail validation.""" | ||
| result = Result(**_result("reused", "model.proj.a")) | ||
| assert result.status.value == "reused" | ||
| assert result.status is Status.reused | ||
|
|
||
| def test_known_statuses_preserve_value(self): | ||
| """Known run statuses still resolve with the correct `.value`.""" | ||
| for status in ("success", "error", "skipped", "partial success"): | ||
| assert Result(**_result(status, "model.proj.a")).status.value == status | ||
|
|
||
| def test_unknown_future_status_parses(self): | ||
| """Forward-compat: a status dbt has not shipped yet still parses via `_missing_`.""" | ||
| result = Result(**_result("some_future_status", "model.proj.a")) | ||
| assert result.status.value == "some_future_status" | ||
|
|
||
| def test_test_and_freshness_statuses_keep_their_value(self): | ||
| """Test/freshness statuses must keep their `.value` (resolved via Status1/Status2).""" | ||
| for status in ("pass", "fail", "warn", "runtime error"): | ||
| assert Result(**_result(status, "test.proj.t")).status.value == status | ||
|
|
||
|
|
||
| class TestParseRunResultsEntryPoint: | ||
| """The public `parse_run_results` must parse a full file containing `reused`.""" | ||
|
|
||
| def test_file_with_reused_result_parses_fully(self): | ||
| run_results = parse_run_results(_run_results("success", "reused", "skipped", "pass", "error", "no-op")) | ||
| # Previously this whole file was dropped because of the single `reused` row. | ||
| assert len(run_results.results) == 6 | ||
| assert {r.status.value for r in run_results.results} == { | ||
| "success", | ||
| "reused", | ||
| "skipped", | ||
| "pass", | ||
| "error", | ||
| "no-op", | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Version bump is incomplete —
docs/conf.pyand.bumpversion.cfgstill report0.3.1..bumpversion.cfgcoordinates the version across three files (setup.py,docs/conf.py,src/datapilot/__init__.py). This PR updatedsetup.pyand__init__.pyto0.3.2but leftdocs/conf.pyatversion = release = "0.3.1"and.bumpversion.cfgatcurrent_version = 0.3.1.Consequences:
0.3.1while the package ships0.3.2.bumpversionrun will fail: itssearch = version="{current_version}"pattern (0.3.1) no longer matchessetup.py(now0.3.2), raisingVersionNotFoundError.Use
bumpversion patch(which updates all three files pluscurrent_versionand commits/tags), or bump all three files together so the version stays coordinated.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — fixed in da9e0ea. Bumped
.bumpversion.cfg(current_version) anddocs/conf.pyto0.3.2; all four bumpversion-tracked files now agree.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suryaiyer95 addressed — all four bumpversion-tracked files (
setup.py,docs/conf.py,src/datapilot/__init__.py,.bumpversion.cfgcurrent_version) now agree at0.3.2(commit da9e0ea). Also fixed a ruffI001lint that CI flagged (cd9d9f1).checkand the full test matrix are green now.