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
Capped recursive scan counts excluded children of late parents as skipped #393
A recursive scan that has already reached its -max-queries budget still counts every child of a newly found parent as skipped, including children -exclude rules out and, with multi-label entries, children already reached from another parent. The report then shows too many skipped names and too few excluded ones.
Where
internal/scan/dispatcher.go:467 (expand, the case d.capped: branch: d.skipped += d.n)
Details
#361 made stopAdmitting count the untested remainder exactly: excluded names go to excluded, and names reachable twice are counted once. A parent that resolves after the cap goes through expand instead, which adds all d.n children to skipped without checking -exclude or the visited set. The two paths therefore disagree on the same kind of name.
Impact
-stats and the run-quality report misstate skipped and excluded for a capped recursive scan whose parents keep resolving after the cap. Totals still add up, but the split between skipped and excluded is wrong. A resumed run inherits the wrong split.
Steps to reproduce
Run a -recursive scan with -max-queries low enough to cap during the first level, an -exclude pattern that matches some children (for example -exclude 'dev.*'), and a wordlist containing dev.
Let a first-level name resolve after the cap.
Compare skipped and excluded in -stats with the number of children the exclusion matches: excluded children are counted as skipped.
Suggested fix
In the d.capped branch, count the parent's children the way stopAdmitting counts its remainder: reuse its walk (or countUnbuilt when every entry is a single label and there is no -exclude), so excluded children go to excluded and visited ones are not counted twice.
Acceptance criteria
A capped recursive scan whose parent resolves after the cap reports excluded children as excluded, not skipped
Tested plus skipped plus excluded still equals every candidate
A test in internal/scan/dispatcher_test.go covers it
Fixed by #394 (bdaf171): a parent found after the cap now has its children counted through stopAdmitting, so -exclude'd children land in excluded and recursive repeats are counted once.
Activity
Count a capped expand's children as stopAdmitting counts its remainder (
TMHSDigital commentedon Nov 17, 2026
Fixed by #394 (bdaf171): a parent found after the cap now has its children counted through stopAdmitting, so -exclude'd children land in excluded and recursive repeats are counted once.
Build the cap counters' tables once per scan (#398)