Repository navigation
Fixes 35886: Read dbt Cloud run_results.json from every run step [2.0] - #35947
Conversation
The artifacts endpoint serves only the last step's files when no step is given, so a job whose dbt test is not its final command (e.g. docs generate runs after it) lost every test result. Request run_steps with the run and fetch run_results.json per step. (cherry picked from commit 48ab405)
…nt does (cherry picked from commit 512aae1)
Prunes the G004 baseline entry for the f-string the step fetch replaced. (cherry picked from commit fed4882)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
Code Review ✅ Approved🟡 Medium risk · Fetching run_results.json for every dbt Cloud step changes ingestion behavior and may increase API load or omit results when step requests fail. Reads dbt Cloud VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| except Exception as exc: | ||
| logger.debug("No dbt run_results for run %s step %s: %s", run_id, step_index, exc) | ||
| continue |
There was a problem hiding this comment.
Failed steps lose their warning
If one step returns an unexpected error, such as an HTTP 500 with an HTML body, this handler logs it only at debug level and continues. When another step returns any results, the warning below is also skipped. Users can lose a step's test results without seeing which step failed or why.
Keep expected missing-artifact responses quiet, but warn for other failures and include the run and step.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|



Backport of #35887 to
2.0.Fixes #35886
What
dbt Cloud's artifacts endpoint returns the last step's files when no
stepis given. A job whosedbt testis not its final command (e.g.snapshot, seed, run, test, run --select x) therefore ingests every test case with no result ("DBT Test Case Results not found").The dbt Cloud source now expands
run_stepson the existing latest-run request (limit=1) and fetchesrun_results.json?step=<index>for every step. Steps without dbt artifacts (clone, profile, deps) 404 and are skipped; a run with no step details falls back to the old last-step fetch. Duplicate test results across steps are already resolved by_get_latest_result.Backport notes
-xfrom the 3 commits of Fixes 35886: Read dbt Cloud run_results.json from every run step #35887.dbt_config.py: 2.0 keeps theDict/Listsignature onget_blobs_grouped_by_dir; the new helper is added above it unchanged.ingestion/.ruff-g004-baseline.jsondoes not exist on 2.0, so the baseline prune from the style commit is dropped.Tests
tests/unit/test_dbt_config_errors.py+test_dbt_http_config.py: 31 passed against 2.0 source with 2.0's regenerated models.ruff check/ruff format --checkwith 2.0'singestion/pyproject.toml: clean.🤖 Generated with Claude Code
The PR appears safe to merge, with a non-blocking improvement needed to keep unexpected step failures visible.
Findings
Summary
Reads
run_results.jsonfrom every reported dbt Cloud run step instead of only the final step.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Fetch latest completed run with run_steps] --> B{Usable step indexes?} B -->|Yes| C[Fetch run_results.json for each step] B -->|No| D[Fetch default run_results.json] C --> E[Collect returned dictionaries] D --> E E --> F[Pass artifact list to existing dbt readers] F --> G[Choose latest executed result for each test]Reviews (1) · Last reviewed commit: "style(dbt): use lazy %-style logging in ..." · Reviewed by Greptile