Implement canonical projection and detached copies

This commit is contained in:
2026-09-06 19:44:36 +00:00
parent 2b65876a7d
commit 15172294b5
8 changed files with 1059 additions and 23 deletions

View File

@@ -645,6 +645,11 @@ subsequently mutate, not language-enforced immutability of exported Go values.
Callers should treat returned configuration as read-only; later caller mutations
are outside the captured metadata snapshot.
Canonical typed projection, detached cloning, and structural comparison are now
implemented as private foundations. The [current ownership contract](../config.md#typed-projection-and-ownership)
owns those mechanics; publishing independently captured results remains lifecycle
work.
Application semantic validation runs after successful resolution and collects
independent errors in a standard diagnostic form. Validators are read-only and
own domain requirements; checking live S3 buckets or starting runtime clients
@@ -1304,20 +1309,12 @@ sequence length. Ignored and unexported fields stay outside configuration projec
hooks must not use them to carry runtime resources or configuration needing
inspection. Non-configuration runtime state belongs in separate application types.
One field-binding model supplies defaults, decoding, path lookup, change auditing,
and rendering. `omitempty` never removes projected zero values. Preserve nil
versus empty maps/slices where represented by the type. Shared pointer identity
inside application values is not a configuration semantic; cyclic values are
unsupported and independent load/snapshot ownership must still hold.
`time.Duration` projects to a canonical duration string. A custom scalar's text
marshal method supplies its deterministic canonical string; unmarshalling must
accept that representation and preserve its configuration meaning. These methods
must be side-effect-free with respect to shared state. Custom scalars are atomic
for comparison/history; their internal fields are not traversed. Reject types
with only a text decoder and no supported inspection representation. Conversion
or projection failures produce safe diagnostics. This is a bounded scalar seam,
not a custom structural decoder or arbitrary reflection extension framework.
Canonical projection, detached copying, cycle and finite-value enforcement, custom
scalar reconstruction, and structural comparison are implemented and owned by the
[current ownership contract](../config.md#typed-projection-and-ownership). The same
field-binding model must still supply defaults, decoding, change auditing, and
rendering. Application text methods must remain side-effect-free with respect to
shared state; this is a bounded scalar seam, not a custom structural decoder.
## Internal organization