Unify layered provenance history

This commit is contained in:
2026-09-06 21:09:52 +00:00
parent ef0e6078f7
commit 26cece6d53
9 changed files with 347 additions and 48 deletions

View File

@@ -2,7 +2,7 @@
## Status and ownership
Status: implementation in progress; Stages 1–13 are complete and later stages are
Status: implementation in progress; Stages 1–14 are complete and later stages are
pending.
Audience: a `gpt-5.6-terra` coding agent implementing one stage per prompt, in
@@ -1038,7 +1038,31 @@ Acceptance:
## Stage 14 — Verify layered provenance and final snapshot agreement
Status: pending.
Status: complete.
Completion evidence (2026-09-06):
- Unified default, composed base, profile displacement, and resolution records in
the metadata history index. Container resolution now appends its operation to each
changed, added, or removed descendant while preserving the ancestor operation path
and path-specific previous origin; effective metadata still contains only the final
projected paths.
- Added a representative public `Load` workflow spanning a fresh default, selected
source, depth-first import, profile, derived default, mapping deletion, and
whole-sequence normalization. It verifies source order, equal-to-default
explicitness, null state, composite empty-mapping origins, chronological parent
replacement history, deduplicated reasons/dependencies, typed/final snapshot
agreement, and unchanged siblings.
- Verified nested metadata, source import locations, diagnostics, caller-owned
configuration, and private snapshots are detached. Repeated concurrent selected-
profile loads retain independent typed values, metadata, sources, and histories;
the race baseline passes.
- Promoted layered metadata semantics and concrete composite/synthetic origin cases
to the [current metadata contract](../config.md#layered-metadata), updated Go
reference comments, and recorded the adapted Narratio ownership/inspection cases.
Rendering, redaction, value snapshots, and explanation remain within later stages.
Verified `go test ./...`, `go test -race ./...`, `go vet ./...`, `go build ./...`,
`go mod tidy -diff`, and `git diff --check` with Go 1.26.7 on linux/amd64.
Read: feature [presence](initial.md#paths-and-presence),
[history](initial.md#provenance-diagnostics-and-redaction), metadata API.

View File

@@ -430,23 +430,12 @@ conversion through the current loading lifecycle.
## Paths and presence
Semantic path construction, JSON Pointer parsing, and base/default metadata
population are implemented. Their current contracts are owned by the Go
Semantic path construction, JSON Pointer parsing, and layered metadata population
are implemented. Their current contracts are owned by the Go
documentation in [`path.go`](../../path.go), [`metadata.go`](../../metadata.go),
and the [current configuration contract](../config.md#base-default-metadata).
Layered replacement and resolution behavior below remains target lifecycle work.
Distinguish absent, explicitly null, explicitly zero/false/empty, and other
explicit values. An explicit value equal to its default remains explicit.
Presence queries describe the surviving input contribution after overlays;
separate history queries describe earlier appearances. A parent mapping's
presence does not make all of its children explicit. Replacing a subtree removes
its descendants from effective presence and origin queries while retaining
historical replacement records.
Application normalization preserves the fact that a surviving input was
explicit. A derived value for an absent input remains non-explicit. Its final
origin is a resolution operation, with input origins retained separately.
and the [current metadata contract](../config.md#layered-metadata), including
presence, composite origins, parent replacements, removed-path history, and
synthetic resolution operations.
## Composition and overlay
@@ -481,8 +470,7 @@ The [current application schema contract](../config.md#application-schema-bindin
owns root/type support, field and tag binding, inlining, codec pairing, and
schema-aware path rules. The [current defaults and typed-decoding contract](../config.md#defaults-and-typed-decoding)
owns strict conversions, container application, presence, safe failures, and initial
origins. Public lifecycle integration, layered provenance, secret handling, and
rendering remain target work below.
origins. Secret handling and rendering remain target work below.
## Recorded resolution and validation
@@ -490,7 +478,8 @@ Application-owned recorded resolution is implemented. The
[current resolution contract](../config.md#recorded-application-resolution) owns
explicitness queries, helpers and manual records, structural mutation auditing,
coalescing, diagnostics, origins, history, and snapshot ownership. Layered input
history, redacted explanation, and secret dependency propagation remain target work.
history is owned by the [current metadata contract](../config.md#layered-metadata);
redacted explanation and secret dependency propagation remain target work.
Canonical typed projection, detached cloning, structural comparison, and publishing
independently captured resolved results are implemented. The
@@ -507,16 +496,10 @@ callback lifetime, and application/runtime responsibility boundaries.
Safe diagnostic/provenance value records, canonical diagnostic rendering, and
`LoadError` access are implemented. Their current contracts are owned by
[`records.go`](../../records.go) and [`diagnostic.go`](../../diagnostic.go).
Base/default and resolution records are attached to the current loading lifecycle.
Additional layers, safe historical values, redaction, and rendering remain target
work below.
Retain input sources, layer, line/column where available, import sites, effective
origins, overridden definition records, and resolution operations. Container
origins may be composite; never invent one file location for a mapping assembled
from several sources. Defaults and resolution have synthetic origins rather
than fabricated file coordinates. Preserve definition history without exposing
mutable parser nodes or unrestricted raw value references through the API.
Default, base, profile, and resolution records are attached to the loading lifecycle;
their source ordering, composite/synthetic origins, replacement history, and detached
queries are owned by the [current metadata contract](../config.md#layered-metadata).
Safe historical values, redaction, and rendering remain target work below.
Diagnostics have stable codes, severity, semantic path when available, a safe
message, primary location, and related locations. Sort deterministically by
@@ -697,11 +680,11 @@ func ReadWorkerDefaults() (*configkit.Result[Config], error) {
### Paths and metadata
The path API, detached metadata records, empty/unknown query behavior, and
base/default population are now implemented; [`path.go`](../../path.go),
The path API, detached metadata records, empty/unknown query behavior, and layered
population are implemented; [`path.go`](../../path.go),
[`records.go`](../../records.go), [`metadata.go`](../../metadata.go), and the
[metadata configuration contract](../config.md#base-default-metadata) own current
behavior. Layered callback history and safe historical values remain target behavior.
[metadata configuration contract](../config.md#layered-metadata) own current
behavior. Safe historical values remain target behavior for explanation.
### Resolution and validation callbacks