Repository navigation
fix: only patch ref protection when a dbt-loom config is present - #174
Merged
adrienneyager merged 1 commit intoMay 7, 2026
Conversation
When dbt-loom is installed as a transitive dependency and no dbt_loom.config.yml exists, the plugin still patchedis_invalid_private_ref / is_invalid_protected_ref with shims that are more permissive than dbt's originals. This silently suppressed Z002 dbt-loom installed surfaced the error. Guard the patch on self.config is not None so dbt's built-in enforcement is preserved when loom isn't actually being used. Closes adrienneyager#173
adrienneyager
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #173.
When dbt-loom is installed as a transitive dependency but no
dbt_loom.config.ymlexists,_patch_ref_protection()was still being applied unconditionally. The shims inshims.pyare more permissive than dbt's originals foris_invalid_private_ref:{{ config(group=...) }}block hasnode.group = None, so the first condition in the shim is alwaysFalse.restrict_accesscondition is alsoFalse.False(no error) where dbt's original would returnTrue.The existing
if self.config is not Noneguard insidedependency_wrapperdoesn't help — the wrapped function still calls the weaker shim once the patch has been applied.Fix
Guard
_patch_ref_protection()onself.config is not None. When no config file exists, dbt-loom isn't being used for cross-project manifest injection, so there's no reason to weaken dbt's built-in access enforcement.Test plan
pytest tests/)mainin a project where dbt-loom is a transitive dep with no config file