Repository navigation
test(audit): stop requiring a positive scan duration - #356
Merged
Merged
Conversation
ParallelScan records time.Since, which a single tiny skill can complete inside one clock tick. Measured on a windows-latest host: 1 failure in 200 runs of TestParallelScan_SingleSkill, and the package alternates between green and red across upstream commits because of it. Keep the non-negative check, drop the timing promise.
runkids
approved these changes
Oct 3, 2026
runkids
left a comment
Owner
There was a problem hiding this comment.
Reviewed ca03b1b. No blocking findings. A strictly positive duration is not guaranteed for a tiny scan at the available clock resolution; retaining the non-negative assertion removes the flaky assumption while still rejecting invalid timing. Verified TestParallelScan_SingleSkill with 100 repetitions in an isolated devcontainer copy; all passed. The Windows CI check also passed.
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.
Type
Linked Issue
Part of #344
What
One assertion in
internal/audit/parallel_test.go:38:Why
ParallelScanrecordsElapsed: time.Since(start)around one skill scan(
internal/audit/parallel.go:81). A scan of a single tiny skill directory can complete inside oneclock tick, in which case the recorded duration is legitimately
0. The assertion demands it bestrictly positive, so it is asserting a property of the clock rather than of
ParallelScan.This is not theoretical. On a
windows-latesthost the assertion fails intermittently, and it is thereason
internal/auditalternates between green and red across upstream commits without any change tothat package:
internal/audite77e9128ok 1.999s6e176ddbFAIL 0.947s,TestParallelScan_SingleSkillthe only failureMeasured
Cross-compiled
windows/amd64test binary, run on a real Windows host at6e176ddb:TestParallelScan_SingleSkillrepeatedinternal/auditpackageSo the flake is specific to the Windows clock, not a general fragility: the same 1000 runs on Linux
never trip it, which is why the ubuntu and macOS jobs have stayed green.
gofmt -l,go vet ./internal/audit,go build ./...andgo test -race ./internal/audit ./internal/memoryare all clean.I kept a check rather than deleting the assertion: a negative duration would mean
Elapsedwascorrupted or read from the wrong field, and
< 0still catches that. The alternative — making thefixture slow enough to always register — would just reintroduce the same dependence on timing.
Why this matters for the Windows job
#351 merged a
windows-testjob restricted to packages that are green onwindows-latest. A flakypackage cannot go on that list without making the job something reviewers learn to ignore, so fixing
the assertion is the prerequisite for keeping
internal/auditunder Windows coverage.Checklist
Linux unchanged