Explain defaults restored during final decoding

This commit is contained in:
2026-09-06 19:07:03 -05:00
parent f7ca150a7f
commit 831c83a0b5
6 changed files with 78 additions and 4 deletions

View File

@@ -162,11 +162,17 @@ parser values. `Present=false` with empty YAML means absence or deletion; explic
null is present and renders as `null`. The history starts with the canonical typed
application-default or Go-zero baseline, then includes only relevant base sources in
traversal order, the selected profile, supplied CLI records, and audited net
resolution operations. Explicit equal writes remain visible.
resolution operations. Explicit equal writes remain visible. When input replay
differs from the final typed input, a `ChangeDecoding` event records the transition
before domain resolution. Its origin retains the decoded path's source/default
attribution; its reason identifies static-default retention and canonical decoding.
This built-in inspection operation is not accepted by `Resolution.Record`.
Base, profile, and CLI history preserves the policy-validated input representation,
including a superseded value that could not have decoded into the final Go field.
Baseline, effective, and resolution values use canonical typed projection. Mapping
Baseline, effective, and resolution values use canonical typed projection. A
decoding event bridges replayed input and canonical typed values, so intermediate
null/scalar replacements cannot incorrectly imply permanent default removal. Mapping
queries reconstruct each source or override contribution, while sequences remain
atomic: a descendant history identifies its presence before and after the containing
sequence replacement without implying element-wise merging. Removed paths remain

View File

@@ -104,6 +104,12 @@ Keep final projection, secret lookup, and validation ordering consistent.
## 4. P2 — Reconcile history replay with final-only default application
Status: complete. Explanation now records an explicit canonical decoding transition
when replay differs from final typed input, preserving decoded origins and showing
default restoration. Null/scalar-to-map profile and CLI regressions pass at parent
and descendant paths. Full tests pass with the issue-8 TMPDIR workaround; vet,
build and whitespace checks pass.
Evidence: [explain.go](../../explain.go), `Explain` initializes replay from defaults
and merges each input into it. Actual decoding applies defaults to the final
composed/overlaid input, so intermediate replacements are not lasting default resets.