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
Query/time budgets count excluded candidates as skipped and degrade the verdict #238
When -max-queries or -max-duration stops admission, every remaining candidate is counted as skipped, including candidates -exclude would never have queried. The scan then reports a degraded verdict even though every in-scope name was tested.
Where
internal/scan/dispatcher.go:123-131 (next): the deadline and MaxQueries checks run before the exclude and visited filtering
internal/scan/verdict.go:44-47: any skipped count gives degraded
Details
ifd.cfg.MaxQueries>0&&d.admitted>=d.cfg.MaxQueries {
d.stopAdmitting() // all remaining candidates -> skippedreturnjob{}, false
}
entry:=d.cfg.Entries[e.next] // exclude/visited filtering happens after this
Impact
A false degraded verdict.
Wrong Skipped and Excluded counts in -stats, JSONL, SARIF and MCP reports.
-diff does not report removals because the verdict is not complete (main_diff.go:195).
Steps to reproduce
With 100 entries where the last 10 match -exclude, and MaxQueries: 90, the result is admitted=90 skipped=10 excluded=0 verdict=degraded. Expected: complete, with excluded=10.
Suggested fix
When a budget stops admission, keep walking the remaining candidates. Count excluded ones as excluded and drop duplicates. Only candidates that would actually be queried should count as skipped. Do this cheaply: a single pass without admitting anything.
Acceptance criteria
The case above reports complete with excluded=10.
A mix of excluded and in-scope candidates past the cap counts only the in-scope ones as skipped.
Getting started
Relevant files: internal/scan/dispatcher.go
How to run tests: go test ./internal/scan/
Related docs: docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 3f671b2. Severity: low. Effort: S. audit-key: bug|internal/scan/dispatcher.go|stopAdmitting
Fixed in 65e5f8a: stopAdmitting counts the unadmitted candidates that -exclude (or the recursive visited set) would have kept out as excluded/ignored instead of skipped; with no exclusions it keeps the O(1) path. Verified with TestCapLeavesExcludedOutOfSkipped (100 entries, last 10 excluded, cap 90 -> skipped 0 excluded 10; cap 80 -> 10 and 10), go test ./... and golangci-lint.
Activity
TMHSDigital commentedon Nov 14, 2026
Fixed in 65e5f8a: stopAdmitting counts the unadmitted candidates that -exclude (or the recursive visited set) would have kept out as excluded/ignored instead of skipped; with no exclusions it keeps the O(1) path. Verified with TestCapLeavesExcludedOutOfSkipped (100 entries, last 10 excluded, cap 90 -> skipped 0 excluded 10; cap 80 -> 10 and 10), go test ./... and golangci-lint.