Skip to content

Scoped config merging: parent overrides child#8

Merged
typeless merged 1 commit intomainfrom
scoped-config-merge
Feb 10, 2026
Merged

Scoped config merging: parent overrides child#8
typeless merged 1 commit intomainfrom
scoped-config-merge

Conversation

@typeless
Copy link
Owner

Summary

  • Rewrite find_config_for_dir to collect all tup.config files root-to-leaf and merge with parent-overrides-child semantics (same authority model as Tuprules.tup ?= defaults)
  • Add per-file parse cache (parsed_configs) so each tup.config is read exactly once
  • Clarify BuildContext::config_vars() returns root-only config via doc comment

Test plan

  • Updated 2 existing [scoped-config] tests for new merge behavior
  • Added 4 new tests: parent overrides child, multi-level merge, explicit clear, -D wins
  • All 331 tests pass (zero regressions)
  • make format clean
  • clang-tidy clean on changed files

🤖 Generated with Claude Code

Components can now ship default config values in their own tup.config
while integrators override them from a parent directory — the same
authority model as Tuprules.tup ?= defaults.

find_config_for_dir collects all tup.config files from output_root
down to the target directory and merges them leaf-first, root-last
(parent wins on collision).  -D overrides still take highest precedence.

A per-file parse cache (parsed_configs) ensures each tup.config is
read exactly once regardless of how many directories reference it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@typeless typeless merged commit f0343ec into main Feb 10, 2026
8 checks passed
@typeless typeless deleted the scoped-config-merge branch February 10, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant