Elide null macros key for unit test overrides - #16011
Open
CallumFriend-MP wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA. In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR. CLA has not been signed by users: @CallumFriend-MP |
2 tasks
skip_serializing_none only rewrites fields whose declared outer type is Option, so it cannot elide macros through the Verbatim wrapper and None serializes as an explicit null. dbt-core then fails to deserialize the fusion-produced manifest, because UnitTestOverrides.macros is a non-Optional Dict on the Python side. Fixes dbt-labs#16009
CallumFriend-MP
force-pushed
the
fix/unit-test-overrides-macros-null
branch
from
August 20, 2026 10:05
9b63303 to
58495cc
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.
Fixes #16009.
dbt parse --use-v2-parserfails withFusionParserSchemaErroron any project with a unit test that setsoverrides:withoutmacros:, because the parser emits"macros": nulland Python'sUnitTestOverrides.macrosis a non-OptionalDict.UnitTestOverrides.macrosisVerbatim<Option<T>>, not a bareOption<T>.#[skip_serializing_none]matches on the declared outer type, so it does not apply through the wrapper, andVerbatim'sSerializeforwards to the inner value. Its siblingsenv_varsandvarsare bareOption<T>and elide correctly. Introduced by 7c17262, which wrapped the field and landed between the a5 and b1 parser releases; 1.12.1 and 1.12.2 raise the parser floor to>=2.0.0b1, so the current release pulls the failing pair by default.This adds an explicit
skip_serializing_ifto that one field.Verbatimderefs toT, so the predicate is a one-liner and the wrapper 7c17262 needs is untouched.Verification
I could not build the monorepo here, so I compiled the exact patched struct in isolation against
dbt-yaml0.9.6 with this repo's dependency versions, including theDbtSchemaderive and#[skip_serializing_none]:Line 1 is the fix. Line 2 confirms a populated
macrosmap still serialises, so the datetime behaviour 7c17262 was added for is preserved. Line 3 confirms the elided form deserialises back toNone. Before the change the same struct emits{"macros":null,"vars":{"some_var":"'x'"}}, reproducing the reported failure byte for byte. #16009 has a repro needing no warehouse connection.I have not run dbt-core's own suite. Understood that fork CI needs
ci:approve-public-fork-ciand that it clears on each push.Not included
A Python-side coercion of
Noneto{}inUnitTestOverrideswould also fix it, covervarsandenv_vars, and unlike this change would help projects already pinned to a released b-series parser. It belongs on1.latestrather than here, so I have left it out and noted it on the issue.