You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scanOneTarget is a 188-line pass sequencer with per-target state on session #473
scanOneTarget (188 lines, the top-churn CLI function) sequences every pass of a target and keeps per-target state on the long-lived session struct, reset by hand at the top of the function. The "reset refound, run a pass, subtract refound" step is written three times.
Where
internal/cli/session.go:741-929 (scanOneTarget)
internal/cli/session.go:56-62 (per-target fields on session: target, targetResults, cands, foundBy, restored, refound), reset at :778-788
internal/cli/session.go:969, :896, internal/cli/ptr.go:223 (three copies of the refound step)
internal/cli/session.go:891, :914-915 (hand-built gate conjunctions for later passes)
Impact
Each new pass (-permute-only#376, -ptr#436) adds a branch here and a field to session. A field not reset per target leaks between -dL targets; the #408 fix for restored was exactly that. The function can only be tested through a whole session end to end.
Suggested fix
Pin behavior: add a -dL test checking that foundBy and refound are per target (two targets, the second resumed). The existing resume_branches_test.go, permute_only_test.go and ptr_test.go cover the rest.
Introduce type targetRun struct { target; log; cands; foundBy; restored; refound }, created at the top of scanOneTarget, and move the six fields off session.
Extract runPass(ctx, tr, pass, emit) (targetResult, refoundCount), owning the refound reset and subtraction, and use it from the main, permutation and PTR passes.
Extract prepareTarget and restoredTarget, so scanOneTarget reads: prepare, restore or main, permute if allowed, PTR if allowed, record.
Replace the gate conjunctions with one method on targetResult.
Filed by repo-audit/full-audit at a45b999. Severity: medium. Effort: M. audit-key: tech-debt|internal/cli/session.go|scanOneTarget
Activity