Avoid metadata copies during scoped path enumeration

This commit is contained in:
2026-11-21 12:01:47 +00:00
parent d6fcfc62d9
commit 1305f2b9e9
2 changed files with 9 additions and 2 deletions

View File

@@ -115,7 +115,14 @@ finding 1's corrected implementation, without redefining the intended contract.
## 3. Scoped path enumeration unnecessarily copies all effective metadata ## 3. Scoped path enumeration unnecessarily copies all effective metadata
**Priority:** P3. **Status:** Open. **Plan stage:** 3 (also exercised in stage 6). **Priority:** P3. **Status:** Complete. **Plan stage:** 3 (also exercised in stage 6).
**Completion:** scoped HistoricalPaths now enumerates through the retained
private metadata directly, avoiding copies of unrelated effective fields and
origins. The existing enumeration still returns detached Paths, and public
Metadata() behavior is unchanged. Focused inspection/historical-path/metadata
tests and `./scripts/check.sh` passed with Go 1.27.4. No cache, inventory,
performance threshold test, or publication gate was added.
**Relevant code:** `InspectionView.HistoricalPaths` in **Relevant code:** `InspectionView.HistoricalPaths` in
[inspection_view.go](../../internal/engine/inspection_view.go), line 62; [inspection_view.go](../../internal/engine/inspection_view.go), line 62;

View File

@@ -59,7 +59,7 @@ func (v InspectionView) HistoricalPaths() []Path {
return nil return nil
} }
var paths []Path var paths []Path
for _, path := range v.inspection.Metadata().HistoricalPaths() { for _, path := range v.inspection.metadata.HistoricalPaths() {
if pathContains(v.scope, path) { if pathContains(v.scope, path) {
paths = append(paths, path) paths = append(paths, path)
} }