Skip to content

fix: null dbt_project.yml keys cause state:modified to over-select siblings - #16292

Open
wilu222 wants to merge 1 commit into
dbt-labs:1.latestfrom
wilu222:fix/16290-null-project-config-key
Open

wilu222 wants to merge 1 commit into
dbt-labs:1.latestfrom
wilu222:fix/16290-null-project-config-key

Conversation

@wilu222

@wilu222 wilu222 commented Sep 12, 2026

Copy link
Copy Markdown

Resolves #16290

Problem

If a key in the dbt_project.yml model tree has a null value (e.g. beta: with no children or configs), any change to that key caused state:modified to select every model beneath the parent block, including unrelated siblings.

Root cause: _project_configs treated any non-dict value as a legacy bare config. YAML null parses as None, which is not a dict, so the placeholder key was copied into every sibling's unrendered_config and then compared by same_contents.

Solution

Skip None values in the legacy bare-config branch so null hierarchy placeholders are not treated as config, while still supporting bare scalars (materialized: view) and +-prefixed explicit nulls (+enabled: null).

Adds unit regression coverage in tests/unit/context/test_context_config.py.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

Null folder placeholders were treated as legacy bare config values, so
changing them made every sibling under the parent look state:modified.
@wilu222
wilu222 requested a review from a team as a code owner September 12, 2026 01:43
Copilot AI lite review requested due to automatic review settings September 12, 2026 01:43
@cla-bot

cla-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown

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: @wilu222

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Wrap the test signature exceeding the configured 99-character line length.

Pull request overview

Fixes false state:modified selections caused by null-valued keys in dbt_project.yml.

Changes:

  • Ignores unprefixed null hierarchy placeholders.
  • Preserves scalar and explicit +-prefixed null configs.
  • Adds regression tests and a changelog entry.
File summaries
File Summary
tests/unit/context/test_context_config.py Adds regression coverage.
core/dbt/context/context_config.py Skips null hierarchy placeholders during config extraction.
.changes/unreleased/Fixes-20260911-214018.yaml Documents the fix.
Review details

Suppressed comments (1)

tests/unit/context/test_context_config.py:8

  • This new signature is 108 characters, exceeding dbt-core's configured Black line length of 99, so the code-quality formatter will reject or rewrite this file. Please wrap the signature across lines.
def _project_config_levels(model_configs: Dict[str, Any], fqn: List[str]) -> List[Dict[str, Any]]:
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@wilu222

wilu222 commented Sep 12, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla:yes label Sep 12, 2026
@cla-bot

cla-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@wilu222

wilu222 commented Sep 12, 2026

Copy link
Copy Markdown
Author

This line is 98 characters; black’s limit in this repo is 99. Black already passed locally and left it as one line. Copilot's 108 count looks off. No wrap needed unless a maintainer prefers it.

@wilu222 wilu222 changed the title fix: ignore null dbt_project.yml keys in project config extraction fix: null dbt_project.yml keys cause state:modified to over-select siblings Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants