test: prove pLimit limits page concurrency - #289
Merged
Conversation
Mutation testing showed `active < concurrency` could be replaced by `true` with every test still passing. Nothing anywhere proved that page processing is actually limited; the existing concurrency tests only check that a run finishes and that invalid values throw. The new test counts callbacks in flight and asserts the peak equals the configured concurrency. With the mutant applied all nine pages start at once and the peak is 9, so the test fails. Every mutant in the pLimit block is now killed, timed out or errors out. None survive. The score goes from 61.13 to 63.77, and core.ts from 60.85 to 64.55. `thresholds.break` moves from null to 60 so the score cannot regress below the baseline that main now has. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 29, 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.
First mutant-killing PR from the report at l2ysho.github.io/afpp.
The gap
src/core.ts:20readsif (active < concurrency && queue.length > 0). Stryker replaced the condition withtrueand every test still passed. Nothing in the suite proved that page processing is actually limited.The existing concurrency tests only check that a run with
concurrency: 'auto'finishes, and thatconcurrency: 0throws. Neither observes how many pages run at once.The test
Counts callbacks in flight and asserts the peak equals the configured concurrency:
example.pdfhas 9 pages. Withconcurrency: 2the limit lets exactly two through. With the mutant applied all nine start at once, the peak is 9, and the test fails — verified by applying the mutant by hand.The peak is deterministic, not timing-dependent:
pLimitstarts tasks as they are pushed, so the third push onward is queued. The 50 ms hold only keeps the two in-flight callbacks overlapping long enough to be observed. Ran the file five times, stable.Result
Every mutant in the
pLimitblock is now killed, timed out, or errors out. None survive — previously thetruereplacement,active--, andactive <= concurrencyall got through.Also
thresholds.breakmoves fromnullto60.mainnow has a trustworthy full run, so the score cannot silently regress below it. Raise it as more mutants die.Next
src/getPdfMetadata.tsis still at 38.64 % with 27 survived, 11 of them string mutants around the empty-string guard intoOptionalString. One fixture with empty metadata fields should kill most of that file.🤖 Generated with Claude Code