Skip to content

Fixes 35886: Read dbt Cloud run_results.json from every run step [2.0] - #35947

Merged
ulixius9 merged 3 commits into
2.0from
ulixius9/dbt-artifacts-read-steps-2.0
Oct 22, 2026
Merged

ulixius9 merged 3 commits into
2.0from
ulixius9/dbt-artifacts-read-steps-2.0

Conversation

@ulixius9

@ulixius9 ulixius9 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Backport of #35887 to 2.0.

Fixes #35886

What

dbt Cloud's artifacts endpoint returns the last step's files when no step is given. A job whose dbt test is 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_steps on the existing latest-run request (limit=1) and fetches run_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

  • Cherry-picked with -x from the 3 commits of Fixes 35886: Read dbt Cloud run_results.json from every run step #35887.
  • Conflict in dbt_config.py: 2.0 keeps the Dict/List signature on get_blobs_grouped_by_dir; the new helper is added above it unchanged.
  • ingestion/.ruff-g004-baseline.json does 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 --check with 2.0's ingestion/pyproject.toml: clean.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking improvement needed to keep unexpected step failures visible.

Findings

  1. P2 Failed steps lose their warning ▶

Summary

Reads run_results.json from every reported dbt Cloud run step instead of only the final step.

  • dbt Cloud ingestion collects run results from every run 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]
Loading

Reviews (1) · Last reviewed commit: "style(dbt): use lazy %-style logging in ..." · Reviewed by Greptile

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)
Prunes the G004 baseline entry for the f-string the step fetch replaced.

(cherry picked from commit fed4882)
@ulixius9
ulixius9 requested a review from a team as a code owner October 22, 2026 09:59
@ulixius9
ulixius9 requested review from Khairajani and removed request for a team October 22, 2026 09:59
@ulixius9 ulixius9 added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 22, 2026
@github-actions

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 Oct 22, 2026 •

Copy link
Copy Markdown
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 run_results.json from every run step instead of only the last one, so test results from non-final dbt test commands are ingested. 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

Comment on lines +385 to +387
except Exception as exc:
logger.debug("No dbt run_results for run %s step %s: %s", run_id, step_index, exc)
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

@sonarqubecloud

Copy link
Copy Markdown

@ulixius9
ulixius9 merged commit 72daf83 into 2.0 Oct 22, 2026
95 of 110 checks passed
@ulixius9
ulixius9 deleted the ulixius9/dbt-artifacts-read-steps-2.0 branch October 22, 2026 11:30

This branch was previously deployed

1 inactive 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