fix source freshness upload for dbt fusion#1018
Conversation
|
👋 @michael-myaskovsky |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSource freshness result processing macros are refactored to normalize output, filter unidentifiable records where node metadata is missing, and use defensive iteration to prevent crashes when optional fields are absent. Conditionally appended results skip none values returned for dbt-fusion records lacking node context. ChangesSource freshness robustness
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
integration_tests/tests/test_dbt_artifacts/test_artifacts.py (1)
204-257: 💤 Low valueConsider asserting the errored source's result is also uploaded with error status.
The test validates that healthy sources aren't blocked by errored ones, which covers the main fix. For more complete coverage, consider also verifying that the errored source's result row exists with
status = 'runtime error'— this would confirm the error handling path end-to-end.That said, the current test adequately covers the critical regression scenario.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@integration_tests/tests/test_dbt_artifacts/test_artifacts.py` around lines 204 - 257, Add an assertion that the errored source's freshness result row is present and marked as an error: after the existing healthy-source read_table call, call dbt_project.read_table on "dbt_source_freshness_results" with where matching unique_id = f"source.elementary_tests.test_source.{errored_name}" (use the errored_name variable) and assert the returned row's status column equals "runtime error" (use raise_if_empty=True to ensure presence and then check the status field). This verifies the errored path is uploaded with status 'runtime error' in addition to the healthy source check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@integration_tests/tests/test_dbt_artifacts/test_artifacts.py`:
- Around line 204-257: Add an assertion that the errored source's freshness
result row is present and marked as an error: after the existing healthy-source
read_table call, call dbt_project.read_table on "dbt_source_freshness_results"
with where matching unique_id =
f"source.elementary_tests.test_source.{errored_name}" (use the errored_name
variable) and assert the returned row's status column equals "runtime error"
(use raise_if_empty=True to ensure presence and then check the status field).
This verifies the errored path is uploaded with status 'runtime error' in
addition to the healthy source check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a1d39111-1c3c-4185-9084-abda79ebd378
📒 Files selected for processing (2)
integration_tests/tests/test_dbt_artifacts/test_artifacts.pymacros/edr/dbt_artifacts/upload_source_freshness.sql
Fix process_freshness_result crash on dbt-fusion (#2245)
dbt source freshness on dbt-fusion crashes the on_run_end hook — fusion returns None for node on some results, and the macro accesses result_dict.node.unique_id unguarded. Fix: skip None-node results in process_freshness_result, filter them in upload_source_freshness, and guard timing in flatten_source_freshness. Stops the crash; such results are skipped, not uploaded.