From 0a81be84f631d8e997f241d397cb9965eb1a8c1b Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 7 Nov 2026 15:56:25 +0000 Subject: [PATCH] Format declaration paths only for issues --- command.go | 7 +++++-- docs/roadmap/audit/catalog.md | 5 ++++- docs/roadmap/implementation.md | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/command.go b/command.go index cf39ff6..d48f009 100644 --- a/command.go +++ b/command.go @@ -453,8 +453,11 @@ func collectDeclarationIssues(command Command, parents []string, root bool, issu return } record := command.record - path := append(append([]string(nil), parents...), record.name) - label := commandpath.FromTokens(path).String() + path := append(parents, record.name) + var label string + if len(record.issues) > 0 || (record.rootOnly && !root) { + label = commandpath.Path(path).String() + } for _, issue := range record.issues { if label != "" { *issues = append(*issues, fmt.Errorf("command %q: %w", label, issue)) diff --git a/docs/roadmap/audit/catalog.md b/docs/roadmap/audit/catalog.md index d3c35de..0bbb73d 100644 --- a/docs/roadmap/audit/catalog.md +++ b/docs/roadmap/audit/catalog.md @@ -1,6 +1,6 @@ # Consolidated audit catalog -Status: **9 distinct open findings: 9 P3**, consolidated from 30 +Status: **8 distinct open findings: 8 P3**, consolidated from 30 numbered entries in seven audit documents. Reviewed audit state: `db732e3a1de55c844f77870e1c6db683c2685d5d`. @@ -479,6 +479,9 @@ Also discussed in the [responsibility assessment](A1-responsibility.md#machinery ## F22 — P3: Successful declaration validation eagerly formats every full path +**Complete.** The walk reuses a scratch path and formats it only for retained +issues or root-only placement errors. Focused declaration and registry tests pass. + `collectDeclarationIssues` copies and formats each ancestral path before knowing whether a diagnostic is needed. A valid depth-N declaration chain incurs Θ(N²) cumulative path work and allocation while producing no errors. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index a2d6ba6..52dc1aa 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -1,6 +1,6 @@ # Audit remediation implementation plan -Status: in progress; Stages 1–16 complete. +Status: in progress; Stages 1–17 complete. Baseline: `d492c7747175c01a53261206c2b4356e53453621`. Before this sprint, intervening changes recorded decisions and retired the completed older @@ -563,6 +563,11 @@ Neither finding closes merely because the new tree methods exist. ## Stage 17 — Format declaration paths only for diagnostics +**Complete.** Declaration traversal uses the recursive scratch path and formats +labels only for emitted issues. Focused declaration, registry and retained-error +tests pass offline with Go 1.27.0 and `-mod=readonly`; source review confirms +valid paths are not eagerly copied and formatted during this walk. + Findings: F22. Source: `command.go` collectDeclarationIssues. 1. Traverse with one scratch append/truncate path. Construct an owned formatted