Repository navigation
fix(config): resolve components in config dump output - #337
Nan Liu (liunan-ms) wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
Thanks Thien Trung Vuong (@trungams)! I updated to preserve locked and renderedSpecDir in JSON dumps and leave filtering to callers. Also updated the doc to reflect this behavior. Please take a look.
Resolve components before serializing so config dump includes inherited distro, project, and group defaults, expanded overlay-files, and components discovered through group spec globs. Preserve resolved lock data and derived rendered-spec directories in JSON output when available. TOML continues to omit these runtime fields through the existing serialization tags. Keep the loaded configuration unchanged and let consumers filter the JSON fields they need. Retain default configuration blocks alongside resolved component entries. The dump is an inspection snapshot for debugging and scripting, not project configuration intended to be loaded again. Update tests and documentation for the resolved output and JSON/TOML runtime-field behavior. Fixes #264
8843859 to
2799b13
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The change still has active issues: runtime-only component fields are serialized contrary to the stated dump requirement, and multi-group spec resolution can omit defaults nondeterministically.
2 open issues
Review effort: Lite


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.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