fix(config): resolve components in config dump output - #337
Nan Liu (liunan-ms) wants to merge 1 commit into
Conversation
`azldev config dump` now resolves each component before serializing, so the output includes inherited defaults and overlays expanded from `overlay-files`. Runtime-only lock and rendered-spec-dir state are excluded. The dump retains the default configuration blocks alongside resolved component entries, so it is an inspection snapshot and is not intended to be reloaded as project configuration. Fixes #264
There was a problem hiding this comment.
🟢 Approval recommended
The resolver-based dump behavior matches the documented intent, avoids mutating loaded config, and is covered by targeted unit tests for the new resolution semantics.
Pull request overview
This PR updates azldev config dump to emit a resolved (post-component-resolver) configuration snapshot rather than the pre-resolver, file-merge view. This makes the command accurately reflect inherited default-component-config values and per-file overlay expansion (overlay-files), aligning the dump output with what build/render workflows actually use.
Changes:
- Resolve all components via the component resolver before dumping, including spec-discovered components, and serialize the resolved view.
- Strip resolver/runtime-only fields (
Locked,RenderedSpecDir) from dumped component entries to avoid leaking runtime state. - Update command help and docs to clarify the output is an inspection snapshot (not intended to be reloaded), and fix examples to use
-f json.
File summaries
| File | Description |
|---|---|
| internal/app/azldev/cmds/config/dump.go | Switches dump output to a resolver-based “effective config” snapshot and strips runtime-only fields before serialization. |
| internal/app/azldev/cmds/config/dump_test.go | Adds unit tests for resolved defaults/overlays, runtime-field exclusion, immutability, and spec-discovered components. |
| docs/user/reference/config/config-file.md | Updates guidance and corrects the config dump JSON flag usage (-f json) while clarifying snapshot semantics. |
| docs/user/reference/cli/azldev_config_dump.md | Regenerates CLI docs to match updated help text describing resolved snapshot output. |
| docs/user/explanation/repos.md | Removes the round-trippability claim and fixes config dump example flag usage. |
| docs/user/explanation/config-system.md | Clarifies that config dump includes component inheritance + overlay-file expansion and is not reloadable configuration. |
Review details
- Files reviewed: 6/6 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.
| for _, component := range resolved.Components() { | ||
| componentConfig := *component.GetConfig() | ||
| // Drop resolver-populated runtime state so it doesn't leak into the JSON dump. | ||
| componentConfig.Locked = nil |
There was a problem hiding this comment.
Do you know why we don't want to include these fields in the config dump?
There was a problem hiding this comment.
My guess is both locked and RenderedSpecDir are generated state or data instead of human-authored configuration so config dump excludes them.
There was a problem hiding this comment.
That seems quite arbitrary to me. I think we should dump the full config, then let the users of the command filter the output themselves.
Summary
azldev config dumppreviously serialized the file-level merged config, so per-file overlays (overlay-files) and inheriteddefault-component-configwere invisible even though builds honor them (issue #264).This change resolves each component through the resolver before serialization:
overlay-files.Locked,RenderedSpecDir) is stripped so it doesn't leak into the JSON dump.The dump retains the
default-component-configblocks alongside the resolved component entries, so it is an inspection snapshot and is not intended to be reloaded as project configuration (this is called out in the updated help and docs).Docs
config-system.md,config-file.md, andrepos.mdto describe the resolved snapshot and drop the round-trippability claim.-O json→-f jsonin examples (config dumpuses its own-f/--formatflag;-Onever controlled its output).azldev_config_dump.mdviamage docs.Testing
mage all(unit + scenario + checks) passes.Fixes #264