-
Notifications
You must be signed in to change notification settings - Fork 121
Improve materialize_test macro for the disabled situation
#909
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Yu Ishikawa <[email protected]>
📝 WalkthroughWalkthroughA new configuration macro is introduced to consolidate test result collection conditions, replacing the test materialization's direct dependency on Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👋 @yu-iskw |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
macros/edr/system/configuration/should_collect_test_results.sql (1)
11-11: Consider the readability of the double negative.The expression
not elementary.get_config_var('disable_tests_results')creates a double negative that could be harder to reason about. While logically correct, this pattern is slightly less intuitive than a positive configuration like'enable_tests_results'.This is optional since changing the config variable name would be a broader refactoring beyond this PR's scope.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
macros/edr/materializations/test/test.sqlmacros/edr/system/configuration/should_collect_test_results.sql
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-04T09:14:40.621Z
Learnt from: haritamar
Repo: elementary-data/dbt-data-reliability PR: 825
File: macros/edr/tests/test_dimension_anomalies.sql:73-75
Timestamp: 2025-09-04T09:14:40.621Z
Learning: In the dbt-data-reliability codebase, `flatten_model` is a valid macro defined in `macros/edr/dbt_artifacts/upload_dbt_models.sql` and can be used as a parameter to `elementary.get_anomaly_query()` even though other test files use the `flattened_test` variable instead.
Applied to files:
macros/edr/materializations/test/test.sql
🔇 Additional comments (3)
macros/edr/system/configuration/should_collect_test_results.sql (2)
1-16: Well-structured consolidation of collection conditions.The macro correctly consolidates four conditions with clear documentation. The logic properly combines execution phase, enablement state, configuration, and CLI context checks.
10-14: No action needed. Bothdisable_tests_resultsandedr_cli_runhave safe defaults (false) defined in the configuration, andget_config_var()is designed to fall back to these defaults if variables are undefined. The macro behavior is already predictable and graceful.Likely an incorrect or invalid review comment.
macros/edr/materializations/test/test.sql (1)
17-17: Verify the behavioral impact of the stricter collection criteria.The change correctly replaces the simple enablement check with a more comprehensive condition. The new
should_collect_test_results()macro adds three additional conditions beyond the originalis_elementary_enabled()check:
- Requires execution phase (
execute)- Checks
tests_results_enabledconfig- Excludes EDR CLI runs
This means test results will be skipped in more scenarios than before. While this aligns with the PR objective to handle "disabled situations," confirm that existing workflows (particularly in compilation/parsing phases or EDR CLI contexts) are not negatively impacted.
Solves #906 (comment)
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.