Repository navigation
Count a capped expand's children as stopAdmitting counts its remainder - #394
Merged
TMHSDigital merged 1 commit intoNov 17, 2026
Merged
Conversation
TMHSDigital#393) A recursive scan that has reached -max-queries counted every child of a parent found after the cap as skipped: expand's capped branch added all n children to skipped without checking -exclude or the visited set, so excluded children were misreported as skipped and, with multi-label entries, children already reached from another parent were counted twice. TMHSDigital#361 made stopAdmitting count the queued remainder exactly; a late parent now goes through the same split by queueing a temporary expansion and stopping admission again, so excluded children are excluded and visited ones are not counted twice.
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A recursive scan that has already reached its
-max-queriesbudget counted every child of a parent found after the cap as skipped. Children that-excluderules out were reported as skipped instead of excluded, and, with multi-label entries, children already reached from another parent were counted again. The-statsand run-quality report then overstateskippedand understateexcluded, and a resumed run inherits the wrong split.Root cause
expand'scase d.capped:branch added allnchildren of the late parent toskippedunconditionally. The other counting path,stopAdmitting, has counted its remainder exactly since #361:countUnbuiltplaces children an exact pattern or an excluded subtree rules out underexcluded, and the multi-label paths drop names the visited set says were already reached. A parent that resolves after the cap bypassed all of that, so the two paths disagreed on the same kind of name.Fix
Queue the late parent as a temporary expansion (with
remainingraised byn, as the uncapped branch does) and callstopAdmittingagain. It counts the one new expansion with the machinery #361 introduced: the O(1) fast path when there is no visited set and no-exclude,countUnbuiltfor single-label entries,countUnbuiltRepeatsfor multi-label entries without exclusions, and the exact walk otherwise. Excluded children go toexcluded, visited ones are not counted twice, and tested plus skipped plus excluded still adds up to every candidate. Tested plus skipped plus excluded still equals every candidate, and the existing capped-expand behaviors (d.skipped += d.nwith no exclusions, the whole-subtree-excluded case) are unchanged.Testing
TestCappedExpandCountsExcludedChildren: a capped recursive scan with an exact-excludepattern expands a late parent; its excluded child lands inexcludedand the rest inskipped(failed before the fix: all ten children went toskipped).TestCappedExpandCountsRecursiveRepeatsOnce: two parents resolve after the cap and reachx.a.b.example.comfrom both sides, with and without an exact pattern; admitted plus skipped plus excluded equals the candidates the uncapped scan generates, and the excluded name is excluded whichever parent reaches it (failed before the fix: counted twice, and as skipped).go test -shuffle=on ./...passes,go vetandgofmtare clean.