fix: re-run macro argument validation after partial parse reuse (#12574)#12617
Open
kalluripradeep wants to merge 2 commits intodbt-labs:mainfrom
Open
fix: re-run macro argument validation after partial parse reuse (#12574)#12617kalluripradeep wants to merge 2 commits intodbt-labs:mainfrom
kalluripradeep wants to merge 2 commits intodbt-labs:mainfrom
Conversation
Contributor
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
2 tasks
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.
Problem
Fixes #12574
When
dbt parseis run a second time without any file changes, partial parsing determines nothing has changed (skip_parsing=True) and reuses the saved manifest as-is. In this path,MacroPatchParser.parse_patchis never called, so_check_patch_argumentsis never triggered — causing macro argument mismatch warnings to silently disappear on all subsequent runs.Root Cause
_check_patch_argumentswas only reachable throughparse_patch, which is skipped entirely duringskip_parsingpartial parse reuse. There was no mechanism to re-run validation against the cached manifest.Fix
Extracted validation logic from
MacroPatchParser._check_patch_argumentsinto a standalone module-level functionvalidate_macro_arguments()inschemas.py, so it can be called from multiple call sites.Added
ManifestLoader._revalidate_macro_arguments()inmanifest.py, which runs afterself.manifest = self.saved_manifestwhenvalidate_macro_argsis enabled. It re-extracts Jinja arguments directly frommacro_sqland compares them against the YAML arguments stored in the schema file'sdict_from_yaml, mirroring whatMacroParserandMacroPatchParserdo during a full parse.Test
Added
TestMacroArgValidationAfterPartialParsetotests/functional/macros/test_macro_annotations.pywhich:dbt parseonce (full parse) and asserts the warning firesdbt parseagain with no changes (partial parse,skip_parsing=True) and asserts the warning still firesThis is the exact repro case from the issue.