Fully test the isolated mutation runner - #1951
Conversation
Its supervisor tests were sitting in a file the gate could not match to it, so more than half of what they check was invisible: moving them into the mirror folder alone took the score from 68.6% to 95.5%. The rest are new checks — that the child is told it is running in a snapshot, that its pid is printed, that the run record is written before the wait for the lock, that a finished run is never signalled however alive its pid looks, and that a stopping child gets its moment to end before being forced. Drops a second write of the same record that the write above it had already done. The isolation-state tests move to their own mirror folder as well, which is where they belonged; that file can now be mutation-checked too.
Two tests started a real mutation child inside a temporary folder that was then deleted, so the coverage report pointed at files that no longer existed and failed with "No coverage data found". Both now use a stand-in command, which also lets them check exactly how the child was started. Also folds the two record waiters onto one shared loop and drops the unused branches the coverage run flagged in the test helpers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJqdnQoBuuQkQCFVcQHcVn
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughChangesMutation isolation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7502371dc8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Puts back the run record write inside the lock. It is not a duplicate of the one before it: a clean sweeping the folder in the gap between them sees a run whose lock is not yet held, treats it as abandoned, and removes it. Writing again once the lock is held puts the record back, so the snapshot about to be made still belongs to a run that can be listed and stopped. Two tests cover this — one for the record landing before the run queues, one for it being written again after a clean takes it away. Also replaces the exported Deno alias with a helper that does the stubbing, gives every exported test helper a return type, uses Promise.withResolvers instead of an uninitialised resolver, and drops helpers nothing calls. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJqdnQoBuuQkQCFVcQHcVn
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3997c2bde2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/scripts/mutation/isolation/helpers.ts`:
- Around line 36-64: Consolidate failTextFileWrites and failRunningStatusWrite
into a single writeTextFile failure-injector helper that accepts a write
predicate, reusing one shared stub implementation. Make failRunningStatusWrite
delegate to that helper with its existing running-status data predicate,
preserving both current failure behaviors and error messages.
In `@test/scripts/mutation/isolation/snapshot-runs.test.ts`:
- Around line 44-52: Update the pid assertion in the mutation run test to check
for the exact interpolated string directly, replacing the RegExp construction
inside run.logs.some. Preserve the existing full-line match behavior using
record.pid.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0d14f244-bca9-41dc-8443-4427d7157fbd
📒 Files selected for processing (9)
scripts/mutation/equivalent-mutants.txtscripts/mutation/isolation.tstest/scripts/mutation/isolation-state/paths.test.tstest/scripts/mutation/isolation-state/records.test.tstest/scripts/mutation/isolation-supervisor.test.tstest/scripts/mutation/isolation/commands.test.tstest/scripts/mutation/isolation/helpers.tstest/scripts/mutation/isolation/list-and-kill.test.tstest/scripts/mutation/isolation/snapshot-runs.test.ts
💤 Files with no reviewable changes (2)
- test/scripts/mutation/isolation-supervisor.test.ts
- test/scripts/mutation/isolation/commands.test.ts
A real clean removes the run's entire folder, not just its record, so the stand-in now does the same and lets the lock's own mkdir put the folder back. That is the ordering the run has to survive. Also folds the two write-failure stand-ins into one, and asserts the pid line directly instead of building a regular expression for it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJqdnQoBuuQkQCFVcQHcVn
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d65ab351c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The tests for parsing a command, picking runs by target, and formatting the run list all check isolation-state.ts, but they sat in the folder mirroring isolation.ts. The mutation gate only runs a source's own mirrored folder, so those assertions never ran against isolation-state mutants. Moving them takes that file from 65.5% to 78.3% without a single new test. The clean-command tests stay where they are, since they go through isolation.ts. Also records the remaining clean race in TODO.md: a clean that decides a run is abandoned and only then removes it can still delete a run that took the lock in between. No record write can close that window — the clean has to hold the lock across both steps. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJqdnQoBuuQkQCFVcQHcVn
…-isolation # Conflicts: # TODO.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1d629f610
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Neither is used outside the helpers file, so exporting them offered a shared API nothing shares. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJqdnQoBuuQkQCFVcQHcVn
This is the next chunk of the work started in #1944: taking one
scripts/file at a time up to a full mutation score, so its tests really would catch a change to it.What changed
scripts/mutation/isolation.tsnow scores 100% — 155 of 155 mutants caught, up from 68.6%.The biggest reason it scored badly was not missing tests but misplaced ones. The mutation gate only looks at tests kept in a folder that mirrors the source file's path, and one whole test file sat outside that folder, so it was never run. Moving it into place lifted the score to 95.5% before a single new test was written.
The same problem turned out to be hiding a second one, which a reviewer spotted: a file of tests for
isolation-state.tssat in the folder mirroringisolation.ts, so those assertions never ran againstisolation-statemutants either. Moving them takes that file from 65.5% to 78.3%, again without writing anything new.Along the way:
isolation-state.ts, which had none at all, so the gate can now see its tests too.Left for later
There is a narrower version of the cleanup problem this does not fix: a cleanup that decides a run is abandoned and only then removes it can still delete a run that took the lock in between. No amount of rewriting the record can fix that one — the cleanup has to hold the run's lock across both steps, which is a behaviour change with its own design to think through. It is written up in
TODO.md.scripts/mutation/isolation-state.tsis the next chunk, now at 78.3%.