Skip to content

fix: dbt prevent all cycles from tests#5345

Merged
eakmanrq merged 1 commit intomainfrom
eakmanrq/dbt_fix_cycle_including_indirect
Sep 11, 2025
Merged

fix: dbt prevent all cycles from tests#5345
eakmanrq merged 1 commit intomainfrom
eakmanrq/dbt_fix_cycle_including_indirect

Conversation

@eakmanrq
Copy link
Collaborator

Updated this implementation: #5253

Previous implementation only worked for direct dependencies. Now at load time we convert all tests with references to standalone audits and therefore cycles are avoided in all cases.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes DBT test cycles by converting tests with cross-model references to standalone audits at load time, preventing dependency cycles between models. The previous implementation only handled direct dependencies but now handles all cases.

Key changes:

  • Modified test standalone detection logic to identify tests with cross-model references
  • Updated manifest loading to filter out standalone tests from model test lists
  • Replaced circular reference fix method with standalone audit conversion approach

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/dbt/test_model.py Replaced circular reference tests with standalone test detection and manifest filtering tests
sqlmesh/dbt/test.py Enhanced is_standalone property to detect tests with cross-model references
sqlmesh/dbt/manifest.py Added filtering to exclude standalone tests from model test assignments
sqlmesh/dbt/basemodel.py Removed fix_circular_test_refs method and its call

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@eakmanrq eakmanrq force-pushed the eakmanrq/dbt_fix_cycle_including_indirect branch 2 times, most recently from 7d8c7b1 to 292bc48 Compare September 10, 2025 20:44
@eakmanrq eakmanrq force-pushed the eakmanrq/dbt_fix_cycle_including_indirect branch from 292bc48 to 8eb9bff Compare September 10, 2025 20:45
@eakmanrq eakmanrq merged commit 5f223bd into main Sep 11, 2025
36 checks passed
@eakmanrq eakmanrq deleted the eakmanrq/dbt_fix_cycle_including_indirect branch September 11, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants