Format declaration paths only for issues

This commit is contained in:
2026-11-07 15:56:25 +00:00
parent 83386217db
commit 0a81be84f6
3 changed files with 15 additions and 4 deletions

View File

@@ -453,8 +453,11 @@ func collectDeclarationIssues(command Command, parents []string, root bool, issu
return return
} }
record := command.record record := command.record
path := append(append([]string(nil), parents...), record.name) path := append(parents, record.name)
label := commandpath.FromTokens(path).String() var label string
if len(record.issues) > 0 || (record.rootOnly && !root) {
label = commandpath.Path(path).String()
}
for _, issue := range record.issues { for _, issue := range record.issues {
if label != "" { if label != "" {
*issues = append(*issues, fmt.Errorf("command %q: %w", label, issue)) *issues = append(*issues, fmt.Errorf("command %q: %w", label, issue))

View File

@@ -1,6 +1,6 @@
# Consolidated audit catalog # 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: numbered entries in seven audit documents. Reviewed audit state:
`db732e3a1de55c844f77870e1c6db683c2685d5d`. `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 ## 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 `collectDeclarationIssues` copies and formats each ancestral path before knowing
whether a diagnostic is needed. A valid depth-N declaration chain incurs Θ(N²) whether a diagnostic is needed. A valid depth-N declaration chain incurs Θ(N²)
cumulative path work and allocation while producing no errors. cumulative path work and allocation while producing no errors.

View File

@@ -1,6 +1,6 @@
# Audit remediation implementation plan # Audit remediation implementation plan
Status: in progress; Stages 1–16 complete. Status: in progress; Stages 1–17 complete.
Baseline: `d492c7747175c01a53261206c2b4356e53453621`. Before this sprint, Baseline: `d492c7747175c01a53261206c2b4356e53453621`. Before this sprint,
intervening changes recorded decisions and retired the completed older 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 ## 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. Findings: F22. Source: `command.go` collectDeclarationIssues.
1. Traverse with one scratch append/truncate path. Construct an owned formatted 1. Traverse with one scratch append/truncate path. Construct an owned formatted