Repository navigation
feat(mutation): balance the scoped shards by expected time - #71
Merged
Merged
Conversation
The scoped plan split the changed files by line count, so shards with similar counts could take very different times when some files are covered only by slow, wide tests. Stryker's report records no test times, so the full sweep now shares each shard's measured time out per mutant by the tests it ran, each weighed by how many mutants it covers, and saves seconds per mutated line alongside seconds per file. The scoped plan restores those timings and estimates each file or range from them: a measured file at what it took, a range at the larger of its lines' time and the file's average per line, and a file the sweep never saw at the sweep's average per line. It packs the units longest first onto the least loaded shard, still splitting an expensive file by its ranges, and logs each shard's estimated minutes. Without timings, or with unreadable ones, it balances by line count as before. No caller changes are needed.
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.
Draft until it is proven against a consumer.
The scoped plan split the changed files across shards by line count. Cost per mutant varies widely when some files are covered only by slow tests that drive the whole application, so shards of similar size can take very different times: in one run, two shards of about 390 mutants took 18 and 102 minutes, and the slowest shard set the gate's wall clock.
Stryker's report records no test times (
TestDefinitionis id, name and location;durationis never filled), so the only measured times are the sharded full sweep's per-shard timings. This makes those timings finer and lets the scoped plan use them.measureSweepshares each full shard's measured seconds out per mutant by the tests it ran, each test weighed by how many mutants it covers against the average test (a static mutant's tests count as average). With equal tests this is the old1 + testsCompletedweight. The history keepsfilesand addslines:[line, mutants, seconds]per mutated line. Same cache key, so older workflow versions still readfilesestimateScope: a measured whole file costs what it took; a range costs the larger of its recorded lines' seconds and the file's average per line, so code added since the sweep still counts; a file the sweep never saw costs the sweep's average per line. A history withoutlinescosts ranges by the file's averageplanScope: longest first onto the least loaded shard, ties to the shard with fewer units. A file heavier than a fair share is still split by its ranges, now judged by cost; a range is never cutMutation planchecks out.github/scriptsat the workflow's commit and restores the sweep timings, which the default branch writes and pull requests can read. The inline plan is now an ES module importing the libraryThe full sweep's planner already packed whole files by measured time; it now gets the finer per-mutant weighting through the same history. No input changes; callers need nothing new.
Offline:
node --test(27 tests, including uneven cost, new lines and new files, a v1 history, missing, malformed and overflowing histories, and range splitting by cost),qlty checkandqlty smellsagainstorigin/master, and the extracted plan script run against a scratch repository with no history, a v2 history, and malformed and truncated histories. On the line-count fallback, loads match the old plan; only which of two equally loaded shards gets a unit can differ.