From 49e04442dad3d8defd4f500bff8f92476d4f2e70 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Mon, 7 Sep 2026 01:02:27 +0000 Subject: [PATCH] Remove unused overlay value snapshots --- docs/internal/overview.md | 3 ++- docs/roadmap/remediation.md | 10 ++++++++-- overlay.go | 5 ----- override.go | 5 +---- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/internal/overview.md b/docs/internal/overview.md index dc6d4a0..30277a7 100644 --- a/docs/internal/overview.md +++ b/docs/internal/overview.md @@ -14,7 +14,8 @@ module and package documentation boundary. Its implemented public primitives are definitions, retains ordered claims and composite mapping origins, reports every conflicting location, and never aliases an input tree; - 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 in `override.go`, sharing overlay, source, byte, node, and depth policies; - a per-operation private reflection descriptor graph in `schema.go` for supported diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index 4e3188e..74679a3 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -2,7 +2,7 @@ ## 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`. 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 -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 `after` trees; profile and CLI processing construct them and diff --git a/overlay.go b/overlay.go index 72541d0..17bada5 100644 --- a/overlay.go +++ b/overlay.go @@ -10,8 +10,6 @@ import ( type overlayRecord struct { change Change displaced []displacedDefinition - before *document.Node - after *document.Node } type displacedDefinition struct { @@ -73,7 +71,6 @@ func mergeOverlayMappings(result *composedDocument, target, overlay *document.No Previous: previousOrigins(previous), }, 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)) for index, record := range records { 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)) for displacedIndex, displaced := range record.displaced { cloned[index].displaced[displacedIndex] = displacedDefinition{ diff --git a/override.go b/override.go index ac3386d..43da63f 100644 --- a/override.go +++ b/override.go @@ -407,14 +407,12 @@ func applyPreparedOverride(result *composedDocument, override preparedOverride) previous := cloneOrigin(result.origins[path.String()]) var displaced []displacedDefinition - var before *document.Node if position < 0 { incoming := document.Clone(override.value) current.Mapping = append(current.Mapping, document.Entry{Key: segment.key, KeyLocation: location, ValueLocation: location, Value: incoming}) collectOverlayOrigins(result.origins, incoming, path, LayerCLI) } else { existing := current.Mapping[position].Value - before = document.Clone(existing) displaced = affectedOverrideOrigins(existing, override.value, result.origins, path) if existing.Kind == document.Mapping && override.value.Kind == document.Mapping { 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) } } - position = documentEntryIndex(current.Mapping, segment.key) result.overlays = append(result.overlays, overlayRecord{change: Change{ 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{ layer: LayerCLI, path: path.clone(), value: override.value, origin: overlayOrigin(LayerCLI, location),