Fail deployment on hardcoded references to the current namespace#2253
Merged
shangyian merged 3 commits intoJun 13, 2026
Conversation
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
…re raised with an error
f020992 to
c0ef641
Compare
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
When working in a branch namespace (
<namespace>.<branch>.<...>), it's possible to write a node query that hardcodes a reference to the current branch namespace instead of using${prefix}. For example, a metric deployed tomyteam.feature_branchthat referencesmyteam.feature_branch.transforms.revenue_factdirectly.The change will validate and deploy cleanly while the branch exists, but breaks after merge. Once the branch is merged to main and the temporary branch namespace is cleaned up, the hardcoded reference becomes a dangling pointer to a namespace that no longer exists. The failure only surfaces later, at SQL-request time, with a confusing "cannot find join path" or missing-node error far removed from the actual cause.
Thus, during deployment validation, we should flag any node whose query references a dependency starting with the deployment namespace prefix. Such a reference should always go through
${prefix}so it survives branch merges.To do this, we added
_check_hardcoded_namespace_reftoNodeSpecBulkValidator, where for each dependency in the node's already-computed dependency list, we check whether it starts withdeployment_namespace. If so, we mark the nodeINVALIDwith anINVALID_NAMESPACEerror directing the user to use${prefix}. Other nodes in the push are unaffected.This change makes no additional DB queries, so there should be perf degradation for deploying.
Test Plan
Added four unit tests covering: hardcoded self-reference produces the error, cross-namespace references are allowed, the check is skipped when no deployment namespace is set (REST API path), and clean queries produce no error.
make checkpassesmake testshows 100% unit test coverageDeployment Plan