Repository navigation
fix(test): reject mocks reached through reference calls that read referencing helpers - #1035
Merged
Merged
Conversation
…erencing helpers
A mock a check reaches through a reference call such as __source("orders"),
directly or from a helper the check reads, is now checked like a mock read by
CTE name, so one that reads a helper calling a reference fails compile with a
located P013 instead of failing at run time. The mock-only P013 now points at
the mocked model's __ref() call, and its help says to call __ref() when the
check reads the mock by CTE name.
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.
Why
Compile reports
P013when a mock the test uses reads a helper that calls a reference, because mocks are defined before the models a test runs and such a helper cannot resolve. That check only counted mocks a check reads by CTE name. A mock reached through a reference call, such as__source("item_returns")resolving to__source__item_returns, was missed, so the test compiled and then failed at run time with a missing table. The mock-onlyP013also pointed at a source call when the message was about the model, and told users to "keep" a__ref()they had not written.Changes
P013.P013points at the mocked model's__ref(call when a check reads both a mocked source and a mocked model.FROM __ref__items, its help says to call__ref("items")instead of keep it.Python-only change; no native code touched.
Verification
make compiler-differential-shipped,tests/e2e/scripts/compiler_differential,make check-ci, hygiene scan