Skip to content

fix(config): resolve components in config dump output - #337

Open
Nan Liu (liunan-ms) wants to merge 1 commit into
mainfrom
fix/config-dump-resolved
Open

Nan Liu (liunan-ms) wants to merge 1 commit into
mainfrom
fix/config-dump-resolved

Conversation

@liunan-ms

@liunan-ms Nan Liu (liunan-ms) commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

azldev config dump previously serialized the file-level merged config, so per-file overlays (overlay-files) and inherited default-component-config were invisible even though builds honor them (issue #264).

This change resolves each component through the resolver before serialization:

  • Component entries now include inherited defaults (project / distro / group) and overlays expanded from overlay-files.
  • Components discovered via group spec globs are included.
  • The loaded config is not mutated.

The dump retains the default-component-config blocks 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

  • Updated config-system.md, config-file.md, and repos.md to describe the resolved snapshot and drop the round-trippability claim.
  • Corrected -O json → -f json in examples (config dump uses its own -f/--format flag; -O never controlled its output).
  • Regenerated azldev_config_dump.md via mage docs.

Testing

  • mage all (unit + scenario + checks) passes.
  • New unit tests cover inherited defaults across all layers, overlay-file expansion, runtime-field exclusion, source-config immutability, and spec-discovered components.

Fixes #264

Copilot AI lite review requested due to automatic review settings September 3, 2026 00:22

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.

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

@liunan-ms
Nan Liu (liunan-ms) marked this pull request as ready for review September 3, 2026 18:57
@liunan-ms Nan Liu (liunan-ms) added the state: needs review PRs that need review label Sep 3, 2026
Comment thread internal/app/azldev/cmds/config/dump.go Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you know why we don't want to include these fields in the config dump?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My guess is both locked and RenderedSpecDir are generated state or data instead of human-authored configuration so config dump excludes them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copilot AI lite review requested due to automatic review settings November 12, 2026 23:35

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.

🟡 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

Comment thread internal/app/azldev/cmds/config/dump.go Resolved
Comment thread internal/app/azldev/cmds/config/dump.go Resolved
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.

config dump omits per-file overlays and inherited default-component-config

3 participants