Unify layered provenance history
This commit is contained in:
@@ -79,7 +79,7 @@ error without reporting one, ConfigKit emits a generic `version.hook_failed`
|
||||
diagnostic and suppresses the returned error text. Warnings alone are retained on a
|
||||
successful result. Callback panics remain programming failures.
|
||||
|
||||
### Layered input/default metadata
|
||||
### Layered metadata
|
||||
|
||||
`Result.Metadata` describes every final canonical path. Exact surviving input paths
|
||||
are explicit and have a base or profile origin; omitted paths have a default origin.
|
||||
@@ -91,6 +91,23 @@ metadata while retaining their base definition and the parent replacement operat
|
||||
in history.
|
||||
All metadata queries and returned nested records are detached.
|
||||
|
||||
History is chronological: a path can have a synthetic default record, its exact base
|
||||
definition, a profile replacement, and a recorded resolution operation. A descendant
|
||||
query uses the ancestor's path for a whole-container or whole-sequence replacement;
|
||||
the descendant can therefore retain history after `Lookup` stops reporting it as
|
||||
effective. Equal-valued input is still an explicit base definition, while a derived
|
||||
value for absent input remains non-explicit.
|
||||
|
||||
A mapping assembled from the selected file and imports has one composite base origin
|
||||
whose locations retain source traversal order. A mapping also visited by a profile
|
||||
has a profile-layer composite origin with the lower contributing locations followed
|
||||
by the profile location; an empty mapping is still an explicit container even though
|
||||
it contributes no children. Resolution origins are synthetic: they have layer
|
||||
`resolution`, no fabricated file location, and a `derived_default` or `normalization`
|
||||
operation. Reasons and dependency paths retain first occurrence order with duplicates
|
||||
removed. Source records remain ordered as selected source, depth-first imports, then
|
||||
the selected profile.
|
||||
|
||||
### Recorded application resolution
|
||||
|
||||
An optional `Definition.Resolve` callback runs after successful typed decoding. It
|
||||
|
||||
@@ -188,6 +188,18 @@ Assigned to layered metadata, redaction, rendering, and explanation:
|
||||
records, and redaction. Narratio commands, diff/digest APIs, generated artifact
|
||||
attribution, campaign logic, and party expansion remain application-owned.
|
||||
|
||||
Layered-provenance implementation record (2026-09-06): ConfigKit integrated its
|
||||
previously extracted source claims, overlay displacement records, typed baseline,
|
||||
and audited resolution snapshots in `load_metadata.go`. The representative
|
||||
`TestLayeredProvenanceAgreesWithResolvedSnapshot` adapts Narratio's stable ownership,
|
||||
profile ownership, deterministic effective projection, and side-effect-free
|
||||
inspection cases across one default/import/profile/resolution workflow. ConfigKit
|
||||
adds chronological descendant history for parent and whole-sequence operations,
|
||||
composite empty-mapping origins, canonical resolution reasons/dependencies, private
|
||||
snapshot agreement, defensive nested copies, and concurrent load isolation. Value
|
||||
rendering, redaction, explanation, commands, generated attribution, diffs, and
|
||||
digests remain assigned to their later owning work.
|
||||
|
||||
### Defaults, presence, and domain resolution
|
||||
|
||||
Assigned across schema, decoding, resolution, validation, and consumer examples:
|
||||
|
||||
@@ -24,8 +24,8 @@ module and package documentation boundary. Its implemented public primitives are
|
||||
baseline/final trees, and initial default/input origins; and
|
||||
- public lifecycle coordination in `load.go`, bounded canonical import DFS in
|
||||
`imports.go`, pattern-directed glob expansion in `glob.go`, version-report contexts
|
||||
in `validation.go`, and detached
|
||||
base/default metadata assembly in `load_metadata.go`; and
|
||||
in `validation.go`, and detached layered metadata/history assembly in
|
||||
`load_metadata.go`; and
|
||||
- recorded application defaulting and normalization in `resolution.go`, including
|
||||
explicitness queries, helper verification, structural mutation audit, coalesced
|
||||
intent, private before/after snapshots, and resolution metadata integration; and
|
||||
@@ -33,8 +33,8 @@ module and package documentation boundary. Its implemented public primitives are
|
||||
`validation.go`, completing the public callback lifecycle after composed input.
|
||||
|
||||
The [configuration contract](../config.md) owns implemented input, schema, decoding,
|
||||
loading lifecycle, path imports, composition, profile overlay, version checking, recorded resolution,
|
||||
semantic validation, metadata, and ownership behavior.
|
||||
loading lifecycle, path imports, composition, profile overlay, version checking,
|
||||
recorded resolution, semantic validation, metadata, and ownership behavior.
|
||||
|
||||
The source-extraction inventory records the application foundations assigned to
|
||||
future implementation work:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user