Remove unused overlay value snapshots

This commit is contained in:
2026-09-07 01:02:27 +00:00
parent 874adaaa18
commit 49e04442da
4 changed files with 11 additions and 12 deletions

View File

@@ -14,7 +14,8 @@ module and package documentation boundary. Its implemented public primitives are
definitions, retains ordered claims and composite mapping origins, reports every definitions, retains ordered claims and composite mapping origins, reports every
conflicting location, and never aliases an input tree; conflicting location, and never aliases an input tree;
- fixed selected-profile loading in `profile.go` and recursive, non-aliasing overlay - fixed selected-profile loading in `profile.go` and recursive, non-aliasing overlay
with displacement records in `overlay.go`; with displacement records in `overlay.go`; overlay records retain origins,
while value explanation uses separate history applications;
- detached parser-neutral CLI override validation and synthetic-source application - detached parser-neutral CLI override validation and synthetic-source application
in `override.go`, sharing overlay, source, byte, node, and depth policies; in `override.go`, sharing overlay, source, byte, node, and depth policies;
- a per-operation private reflection descriptor graph in `schema.go` for supported - a per-operation private reflection descriptor graph in `schema.go` for supported

View File

@@ -2,7 +2,7 @@
## Status and scope ## Status and scope
Status: planned; no stages have been implemented under this roadmap. Status: in progress; completed stages and their validation are recorded below.
Audit baseline: `9b147bfd96aec25e0125dcae66e136e56dc7a670`. Audit baseline: `9b147bfd96aec25e0125dcae66e136e56dc7a670`.
This roadmap owns the agreed maintainability cleanup before v0.1.0. It replaces This roadmap owns the agreed maintainability cleanup before v0.1.0. It replaces
@@ -61,7 +61,13 @@ consumer contracts.
## Stage 1 — Remove unused overlay value snapshots ## Stage 1 — Remove unused overlay value snapshots
Status: pending. Status: complete.
Completion: removed unread overlay before/after trees and their construction and
cloning, including the now-unused CLI position lookup. Field-read review confirmed
that resolution snapshots and history applications have separate live consumers;
those and displaced origins remain intact. The full offline test suite, vet,
build, and whitespace checks passed with Go 1.26.7 on Linux/amd64.
Evidence: `overlayRecord` in [overlay.go](../../overlay.go) retains `before` and Evidence: `overlayRecord` in [overlay.go](../../overlay.go) retains `before` and
`after` trees; profile and CLI processing construct them and `after` trees; profile and CLI processing construct them and

View File

@@ -10,8 +10,6 @@ import (
type overlayRecord struct { type overlayRecord struct {
change Change change Change
displaced []displacedDefinition displaced []displacedDefinition
before *document.Node
after *document.Node
} }
type displacedDefinition struct { type displacedDefinition struct {
@@ -73,7 +71,6 @@ func mergeOverlayMappings(result *composedDocument, target, overlay *document.No
Previous: previousOrigins(previous), Previous: previousOrigins(previous),
}, },
displaced: displaced, displaced: displaced,
before: document.Clone(existing), after: document.Clone(incoming.Value),
}) })
} }
} }
@@ -161,8 +158,6 @@ func cloneOverlayRecords(records []overlayRecord) []overlayRecord {
cloned := make([]overlayRecord, len(records)) cloned := make([]overlayRecord, len(records))
for index, record := range records { for index, record := range records {
cloned[index].change = cloneChange(record.change) cloned[index].change = cloneChange(record.change)
cloned[index].before = document.Clone(record.before)
cloned[index].after = document.Clone(record.after)
cloned[index].displaced = make([]displacedDefinition, len(record.displaced)) cloned[index].displaced = make([]displacedDefinition, len(record.displaced))
for displacedIndex, displaced := range record.displaced { for displacedIndex, displaced := range record.displaced {
cloned[index].displaced[displacedIndex] = displacedDefinition{ cloned[index].displaced[displacedIndex] = displacedDefinition{

View File

@@ -407,14 +407,12 @@ func applyPreparedOverride(result *composedDocument, override preparedOverride)
previous := cloneOrigin(result.origins[path.String()]) previous := cloneOrigin(result.origins[path.String()])
var displaced []displacedDefinition var displaced []displacedDefinition
var before *document.Node
if position < 0 { if position < 0 {
incoming := document.Clone(override.value) incoming := document.Clone(override.value)
current.Mapping = append(current.Mapping, document.Entry{Key: segment.key, KeyLocation: location, ValueLocation: location, Value: incoming}) current.Mapping = append(current.Mapping, document.Entry{Key: segment.key, KeyLocation: location, ValueLocation: location, Value: incoming})
collectOverlayOrigins(result.origins, incoming, path, LayerCLI) collectOverlayOrigins(result.origins, incoming, path, LayerCLI)
} else { } else {
existing := current.Mapping[position].Value existing := current.Mapping[position].Value
before = document.Clone(existing)
displaced = affectedOverrideOrigins(existing, override.value, result.origins, path) displaced = affectedOverrideOrigins(existing, override.value, result.origins, path)
if existing.Kind == document.Mapping && override.value.Kind == document.Mapping { if existing.Kind == document.Mapping && override.value.Kind == document.Mapping {
mergeOverlayOrigin(result.origins, path, location, LayerCLI) mergeOverlayOrigin(result.origins, path, location, LayerCLI)
@@ -425,10 +423,9 @@ func applyPreparedOverride(result *composedDocument, override preparedOverride)
collectOverlayOrigins(result.origins, current.Mapping[position].Value, path, LayerCLI) collectOverlayOrigins(result.origins, current.Mapping[position].Value, path, LayerCLI)
} }
} }
position = documentEntryIndex(current.Mapping, segment.key)
result.overlays = append(result.overlays, overlayRecord{change: Change{ result.overlays = append(result.overlays, overlayRecord{change: Change{
Path: path.clone(), Origin: overlayOrigin(LayerCLI, location), Previous: previousOrigins(previous), Path: path.clone(), Origin: overlayOrigin(LayerCLI, location), Previous: previousOrigins(previous),
}, displaced: displaced, before: before, after: document.Clone(current.Mapping[position].Value)}) }, displaced: displaced})
result.applications = append(result.applications, historyApplication{ result.applications = append(result.applications, historyApplication{
layer: LayerCLI, path: path.clone(), value: override.value, layer: LayerCLI, path: path.clone(), value: override.value,
origin: overlayOrigin(LayerCLI, location), origin: overlayOrigin(LayerCLI, location),