Repository navigation
mutate: run each importer's tests once before any edit, and stop on a failure - #133
Merged
Merged
Conversation
Fails today: use's TestBroken refuses both of Double's edits, and the run reports 0 survived with no error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… failure mutate checked that the package under mutation passes with nothing broken, but not the importers whose tests it also asks. An importer's test that fails regardless refused every edit asked of it, and the run reported 0 survived with no warning. In spin-stack/machine#418 a test applied to an older commit failed on every run, and every mutate run over it showed 0 survived. Before the first edit, each importer of the packages being broken is built once and its tests run in a copy of the module, on the code as it is. A failure stops the run with exit 2, naming "<importer>: <test>". An importer that doesn't build is left alone, as it asks nothing either way. The cost is one build and one run per distinct importer. Closes #130 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Every repository's
mutategate should mean the same thing locally and in CI, and a0 survivedshould mean the tests held every edit. Today an importer's test that fails regardless makes it mean nothing. mutate checks that the mutated package's own tests pass with nothing broken (Cover). It doesn't check the importers whose tests it also asks. An importer test that always fails refuses every edit put to it, and the run reports0 survivedwith no warning. In spin-stack/machine#418, a test applied to an older commit failed on every run, and every mutate run over it said 0 survived.What changes
RunAllbuilds each distinct importer of the packages being broken and runs its tests once, on the code as it is, in a copy of the module (brokenImporters). It reusesrunPackage, the path an edit built alone already takes.<importer>: <test>(the top-level--- FAIL:lines) and printing the tail of the output to stderr.Tally.Brokencarries the names, as it does for the package's own broken tests.byPackageis extracted fromRunAllto keep it under the linter's complexity limit.Evidence
TestAnImporterTestThatAlwaysFailsStopsTheRunBeforeAnyEdit:lib's own test callsDoubleand checks nothing. Its importerusehasTestBroken, which always fails.Before the fix (commit 1c5a31f, the test alone):
After:
The existing importer tests (
TestAPackageWithNoTestsIsAskedThroughItsImporters,TestAnEditItsOwnTestsLetThroughIsAskedOfEachImporterInTurn) still pass, so an importer that passes doesn't stop a run.task lint test mutatepasses locally: 29 refused, 0 survived, 7 did not build.Cost
One build and one run per distinct importer, side by side within
-j, before the first edit. Measured on a laptop on spin-stack/machine at 6889fe4,-base HEAD~4 -max 20(10 files, 5 importers), runs interleaved:So about 5 s per run there, for 5 importers. It doesn't grow with the number of edits. Two runs a side is enough to size the cost, not to measure it precisely. Over machine's last commit alone (
-base HEAD~1, no importers), the check costs nothing.Closes #130
🤖 Generated with Claude Code