Skip to content

scripts: red_green.py --mutate checks that the tests catch the change itself (TEST-RED-GREEN-MUTATION) - #2817

Open
TheGeogeo wants to merge 17 commits into
ProjectLeonida:mainfrom
TheGeogeo:test-red-green-mutation
Open

TheGeogeo wants to merge 17 commits into
ProjectLeonida:mainfrom
TheGeogeo:test-red-green-mutation

Conversation

@TheGeogeo

@TheGeogeo TheGeogeo commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-RED-GREEN-MUTATION (#2570 (comment))

What and why

A red side that fails shows that the new test needs the pull request. It does not show that the test catches the change itself. Verifiers check that by hand, on nearly every test pull request: they remove a line of the fix and see whether the new test fails. scripts/red_green.py --mutate does it for every hunk of the fix:

  • After the green side, --mutate takes each hunk of the pull request's code: Rust and Python files it modifies, outside its tests and its #[cfg(test)] code. One rule tells a hunk of test code only, for the red side and for the mutations, so deleting an obsolete test is not mutated.
    • Hunks are taken without context, so a test changed next to the code stays out.
  • The green merge is committed once. Each mutation starts from it, reset and cleaned, then undoes that hunk alone and runs the tests again. A test that writes into the tree cannot change the next hunk's result. Each hunk is reported as one of:
    • caught: a test that went red then green now fails;
    • caught by timeout: a test hung on the undone code past --mutate-timeout (600 s);
    • not caught: they all still pass, so no new test looks at that code;
    • does not build, compiler crashed, or timed out building (a cargo run stopped before any test ran: no answer, raise the option);
    • does not apply: main moved those lines since.
  • A mutated run writes its output to a file and runs in a Windows job object (a process group elsewhere). Whatever it leaves behind is stopped when it ends, so an orphan holding its output can neither hold the run nor turn a catch into a timeout.
  • The report and --json always say what happened:
    • mutations_not_run: "nothing to undo" for a pull request that changes only tests, or "not run" when no test went red then green;
    • mutations_skipped: the hunks past --mutate-max (10);
    • added_not_mutated: the files the pull request adds, which are not mutated.
  • The verdict and the exit code do not change. --mutate-max must be 1 or more, and --mutate-timeout a finite number above 0. Both are refused without --mutate.
  • Before each Python run, the work tree's own __pycache__ folders are removed. They are never reached through a link or junction, and a folder that cannot be listed is skipped. -B only stops writing bytecode, so a stale ignored .pyc made red pass and an undone hunk read as not caught. -X pycache_prefix was tried and does not reach the processes a test starts. A __pycache__ that cannot be removed stops the run (exit 2) with the tree put back on the base.
  • docs/testing.md describes the option, its results and limits, and how to remove the worktree the tool leaves registered.

Tested

On Windows 11 Pro 10.0, Python 3.12.4, rebased on main 8422def:

  • tests/test_red_green.py: 37 tests OK. They include:

    • a Rust fix with a tested and an untested hunk (caught, not caught);
    • a Python fix undone (caught);
    • a hang (caught by timeout, within its bound);
    • an orphan that holds the output (stopped, the run not held);
    • a cargo run that hangs in its build or in a test binary;
    • stale bytecode in and out of a child process;
    • junctions out of the tree and a junction named __pycache__;
    • a folder it cannot list, and a __pycache__ held open;
    • a test that dirties the tree;
    • a deleted test (not mutated);
    • hunks past --mutate-max;
    • code only in added files;
    • a test-only pull request;
    • option ranges;
    • a job object that cannot be joined (one warning).

    Each change asked for in the reviews has a test that fails without it.

  • Real runs on synthetic repositories (--no-fetch --no-cargo --mutate) show the report lines above and leave no process behind. An earlier head ran on gate: summary.json gets the run's memory peaks (D3D12-GATE-MEMORY-PEAKS) #2810: 6 hunks, 5 caught, 1 not caught (the list of runtime strings in tools/game_gate.py's SOURCES, which only the contract test reads).

  • The docs tests, test_text_write_line_endings.py, test_ci_registration.py, compileall and scripts/check_no_game_data.py on the changed files are clean.

  • Not run here: the POSIX paths (killpg, the chmod cases of the tests) and a real cargo crate.

GPUs tested: n/a

AI-assisted: yes. Claude Code (Claude Fable 5.2 and Claude Opus 5.5); a separate Claude Opus 5.5 agent reviewed the diff before this push.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

@fiestorra

Copy link
Copy Markdown
Contributor

Verified with its own tests in both directions, and then used it on a real pull request, where it did exactly what it should - and showed me one thing it cannot do.

The tests, at each head on main d920d850d, with the PR's scripts/red_green.py:

#2814:  16 passed        |  with main's script:  3 failed
#2817:  19 passed        |  with main's script:  6 failed

Then the tool, on a pull request that is not mine:

python -I scripts/red_green.py --mutate 2803
  base origin/main d920d850d, head 2803 8aada4fc2, merge base 66b5d0433
  red:   the base plus the tests of tests/semantic/test_wave64_emulate_opt.py
  green: the base with the pull request merged
  ran:   tests/semantic/test_wave64_emulate_opt.py
  pass on both: 36
  verdict: no red

That verdict is correct and the pull request is fine: #2803 only adds a test, so there is nothing in its diff to mutate. I then found the mutation by hand - removing ds_append/ds_consume from _ALWAYS_BARRIER_OPS makes the new test fail and leaves the other 35 passing - which is what its comment claims.

Where that leaves --mutate: it checks that a pull request's own change is caught by its own tests. For a test-only pull request it can only answer "no red", and it is right to. That is a limitation of the question, not of the tool, but it is one a maintainer will meet often, because test-only pull requests are how a mutation gap gets closed in the first place. Two ways to help them:

  1. Say it in --help or in the verdict: no red (nothing in this diff can be mutated) rather than no red, so the answer is not read as "the test is worthless".
  2. --mutate-target <path>, so a test-only pull request can name what its test guards and the tool mutates that instead. Today I did it by hand in a worktree; the tool already has the machinery.

Neither is a complaint about what is here - the red/green split is exactly the right frame and the JSON output is going to be usable from a script. I am writing this because I did the same job by hand for eleven hours tonight, and I would have used --mutate-target about thirty times.

AI-assisted: yes - DeepSeek v4.1 (flash), which also ran it.

Written with an AI assistant.

@OreoFR

OreoFR commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head 5193b2503, main d920d850d. CPU only. This branch contains #2814 f442c3dfb, so red is #2814 + this PR's tests.

MEASURED

  • Red (scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH) #2814 + only this PR's tests/test_red_green.py): 3 failed, 16 passed. The failures are the three new Mutation tests (test_a_python_fix_undone_is_caught, test_each_code_hunk_undone_alone_is_caught_or_not, test_no_mutation_without_the_option).

  • Green (main + this PR, merge-tree): 19 passed. No conflict.

  • A real run, as a user would, on an unrelated open PR: from a checkout of main + this PR, python -I scripts/red_green.py pr-2798 --base origin/main --no-fetch --no-cargo --mutate --work-dir <dir>. Result:

    • red then green (1): test_old_follower_leaves_the_new_job_state_intact. That matches my manual red/green on Keep web launcher job status tied to its process #2798.
    • pass on both: 11.
    • mutations (8 hunks undone one at a time): 4 caught, 4 not caught. Caught: launcher/serve.py:322, :324, :367, :371. Not caught: :346, :350, :355, :374.
    • Verdict red then green.

    That's useful information about Keep web launcher job status tied to its process #2798 itself: its spawn-ordering hunks and the in-lock exit-state hunk aren't pinned by a test. It is exactly what I was doing by hand on test PRs tonight, and it works.

Small note: --work-dir leaves a registered git worktree (<dir>/tree) behind between runs. That is by design ("keeps both between runs"), but someone who only runs it once will see it in git worktree list. A line in docs/testing.md on removing it with git worktree remove would help.

AI-assisted: Claude Code

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced on Windows / Python 3.12, and the mechanism is sound — this is not "any nonzero exit counts as caught":

python -I tests/test_red_green.py                                    19 tests, OK, 26 s
python -I scripts/red_green.py 2810 --no-cargo --mutate --work-dir …  red then green (2), 21 pass both arms,
                                                                      6 hunks: 5 caught, 1 not caught (game_gate.py:72), 21 s
git status --porcelain --ignored afterwards                          empty (no __pycache__, no stray files)

Your numbers and the clean-tree claim reproduce exactly. I also checked the three outcomes by hand in throwaway repos with a stub cargo: undoing a hunk so the module raises at import reports does not build, an untested new function reports not caught, a tested change reports caught.

Two things need fixing:

  1. Added files are silently never mutated. scripts/red_green.py:541 uses --diff-filter=M, so a fix whose logic lives in a new module never has its hunks mutated, while the summary still reads as full coverage. Reproduced: a fix that adds tools/helper.py (holding the change) and edits an existing module to call it reports "2 hunks … 2 caught" and never touches helper.py. Either include A (and define what undoing an addition means) or state the limitation in docs/testing.md and in the report itself.
  2. The -B comment at scripts/red_green.py:329 is wrong. -B stops writing bytecode, not reading it. With a stale __pycache__/*.pyc from an earlier run (checkout() uses git clean -fdq at :249, which does not touch ignored paths, and __pycache__/ is ignored), a reverted module still reports ok; I got not caught that way. Use -X pycache_prefix=<fresh temp dir> per run, or remove __pycache__ (or git clean -fdxq).

Minor: when a hunk cannot be restored, mutate returns None and report() drops the whole mutations section, so --mutate silently shows nothing (and in --json it is indistinguishable from "not requested"). There is also no per-run timeout, so --mutate multiplies any hang by up to --mutate-max.

@TheGeogeo

Copy link
Copy Markdown
Contributor Author

Thanks @KelboLive. Confirmed: when a hunk cannot be restored, mutate returns None (scripts/red_green.py:595) and report() then prints no mutations section, and --json cannot tell it from a run without --mutate. There is also no per-run timeout.

To keep this verified head unchanged, I will fix both in a follow-up pull request after the merge: the report will say the mutations stopped and why, and each mutated run will have a timeout that counts as caught when it expires. Each change will come with a test.

@imShangLi

Copy link
Copy Markdown
Contributor

VERIFY-2817 — Linux, Python 3.15, no GPU device, no game files

Verdict: PASS — the change does what it says, and the part that is new (the mutation check) reports a known answer correctly.

Head 5193b250, base d920d850 (the merge-base with the current main), 3 files, +246/−9. The branch holds #2814's commit (f442c3df, "tells a crashed compiler from a build error") and says it will be rebased onto main once #2814 lands; both are in this head, and both were measured.

1. Its own suite, and the three rows

row tree tests/test_red_green.py
A main 0259473b + this PR 19 tests, OK
B clean main + only this PR's test change (patched) 19 tests, FAILED (failures=2, errors=4)

Row B's failures are assertions, not load errors — the test file runs on main and the new tests fail because the behaviour is missing:

FAIL: test_a_compiler_that_crashes_twice_is_not_a_build_error
  self.assertEqual((code, r["verdict"]), (1, "compiler crashed"), r)
  AssertionError: Tuples differ: (1, 'green fails') != (1, 'compiler crashed')

The other failure and the four errors are the same cause: main's scripts/red_green.py has no COMPILER_CRASH, so a compiler that dies with 0xC0000005 is reported as green fails instead of compiler crashed.

2. Discrimination: does the new test look at the changed code?

A test that passes with the fix and without it proves nothing, so I undid the pull request's production change alone on the green tree and ran the new tests:

tree result
PR head, scripts/red_green.py reverted to main's AssertionError (the new tests go red)

3. --mutate on a repository whose answer is known in advance

This is the part that is new, so running its own tests is not enough. I built a repository with a Python tool and its test, in the shape a real pull request has (a test-only commit, then a fix commit), and checked the answer I put in by hand:

sample expected reported
one code hunk (return 1 → return 2), the test asserts the new value caught tools/bar.py line 2 caught
two hunks: the fix, plus a change to a second function no test looks at caught + not caught tools/bar.py line 2 caught, line 16 not caught
the verdict unchanged by a not caught hunk red then green, exit 0

The not caught row is the point of the option: it names code that no new test looks at, which is exactly what a verifier does by hand. It does not change the verdict, so a pull request with an untested hunk is still red then green.

One note on reading the output, in case it catches someone else: --mutate counts hunks, and git diff -U0 merges two edits that are close together into one hunk. My first sample put the two edits two lines apart and got one hunk, which is git's behaviour and not the tool's; with the edits far enough apart it reports two. The tool's own test puts ten padding lines between the two changes for the same reason.

4. What I did not check

  • The #[cfg(test)] exclusion and the "a hunk that only adds test code" rule are read in the code, not measured against a real pull request with a Rust #[cfg(test)] hunk next to the fix.
  • The Windows crash statuses (0xC0000005 and the rest) are matched by the tool's own tests with the text cargo prints; I did not see a real Windows rustc crash.
  • The cargo path (cargo_once, cargo_tests) is exercised only through the stub cargo the tests use; I did not run a real cargo test on a D3D12 crate.

5. Neighbours

tests/test_red_green.py is the only test file this touches. On the PR head the file's 19 tests pass, and the rest of the standalone Python suite is unaffected by this change (it adds a flag to a script; it does not change what the script does without the flag).

AI-assisted: MiniMax M3.1 Flash.

@imShangLi

Copy link
Copy Markdown
Contributor

6. The whole standalone suite, against the same runner on a clean tree

To check that the change costs nothing elsewhere, I ran the repository's standalone test runner over the pull request's head and over a clean main tree and compared the lists:

tree run passed failed skipped
this PR head 5193b250 638 636 2 33
clean main 86c30fce 638 636 2 33
$ diff <(sort passed-main) <(sort passed-with-2817)
(no difference)
$ diff <(sort skipped-main) <(sort skipped-with-2817)
(no difference)

The two failures are the same two files on both trees, and neither is this change's:

So the pull request adds its 19 tests and changes nothing else in the suite.

AI-assisted: MiniMax M3.1 Flash.

@imShangLi

Copy link
Copy Markdown
Contributor

7. Two cases I did not reach, so the report does not read as covering them

@TheGeogeo noted two things about this head, and I did not exercise either, so they are untested by me:

  • when a hunk cannot be restored, mutate returns None and report() prints no mutations section, and --json cannot tell that run from one without --mutate;
  • there is no per-run timeout, so a mutated run that hangs is not bounded.

My samples always restored their hunks, so I saw neither. The author says both are fixed in a follow-up pull request after the merge.

AI-assisted: MiniMax M3.1 Flash.

@imShangLi

Copy link
Copy Markdown
Contributor

A note on this machine's graphics, so "no GPU device" is not misread

I said above that this host has no GPU device. That is true of the Vulkan device, and I should be precise about which path I mean, because the two paths differ here and a reader could otherwise take my wording the wrong way.

What this machine is. A VMware Workstation guest (Fedora 45) on a host with a Radeon 780M. There is no PCI passthrough: the only display device inside the guest is the virtual VMware SVGA II (15ad:0405) driven by vmwgfx, and there is no AMD PCI ID anywhere in the guest.

There is no Vulkan hardware device here. mesa's svga driver has no Vulkan backend, so the loader enumerates nothing by default; with VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json it enumerates exactly one device, llvmpipe (LLVM 23.1.5, 256 bits) — a CPU software implementation. So no real GPU, no CUDA, no ROCm.

The OpenGL path is hardware-accelerated, though. The guest's SVGA3D calls are forwarded by the host-side VMware renderer to the host's Radeon 780M. The evidence I measured, comparing the default path with LIBGL_ALWAYS_SOFTWARE=1:

default:   OpenGL vendor string: VMware, Inc.   renderer: SVGA3D; build: RELEASE; LLVM;
software:  OpenGL vendor string: Mesa           renderer: llvmpipe (LLVM 23.1.5, 256 bits)

GL_VENDOR = "VMware, Inc." appears only when the commands leave the guest for the host's renderer; llvmpipe runs entirely on the guest's CPU. glxinfo -B also reports Video memory: 2048MB, direct rendering: Yes, OpenGL core profile 4.3 (Mesa 26.2.7), and vmwgfx's kernel capabilities include 3D; GNOME logs Created gbm renderer for '/dev/dri/card0' and the session is Wayland.

What follows for the verification above. Anything that needs a real GPU device or driver is invalid on this host, and none of my conclusions rest on one: the tests I ran are CPU-only, and the tool they measure is a Python script. Where a measured number came from this machine's GPU stack, it says so.

Two things I checked that a reader might otherwise assume. glxinfo's Accelerated: no is not evidence that 3D acceleration is off — that field comes from mesa's GLX_MESA_query_renderer, which cannot see an acceleration that happens on the host side. And OpenGL throughput on this host does not stand for real hardware: in my own measurements the software path was faster than SVGA3D for small, tightly-synchronised batches (713 vs 1061 draws/s in an off-screen rasterisation loop; 88 vs 308-692 FPS in glxgears), because SVGA3D pays a synchronisation round trip across the virtualisation boundary while llvmpipe rasterises locally. That says nothing about which path a real application would take — the vendor string settles that — and it is a reminder that a frame-rate number from here is not a hardware result.

AI-assisted: MiniMax M3.1 Flash.

@imShangLi

Copy link
Copy Markdown
Contributor

Correction to my note above: the frame-rate comparison was not controlled

My note above said that on this host the software path measured faster than SVGA3D (713 vs 1061 draws/s in an off-screen rasterisation loop; 88 vs 308-692 FPS in glxgears), and put that down to SVGA3D paying a synchronisation round trip across the virtualisation boundary. That comparison was uncontrolled and the conclusion from it was wrong. I used the default window size and the default swap interval, and the ranking flips with those.

With the window size and the swap interval fixed, glxgears on this host gives:

window swap interval SVGA3D llvmpipe the faster one
300x300 0 (vsync off) 1349 FPS 342 FPS SVGA3D, 3.9x
1024x768 0 (vsync off) 638 FPS 152 FPS SVGA3D, 4.2x
300x300 1 (vsync on) 55 FPS 546 FPS llvmpipe

The two figures I quoted before were the default window with the default swap interval, which is the one combination that happens to favour the software path. So:

  • A frame rate from this host is not a hardware result — that part of my note stands, and this table is the better illustration of why. The same two binaries swap places depending on two settings.
  • Which path is in use is settled by GL_VENDOR / GL_RENDERER (VMware, Inc. / SVGA3D versus Mesa / llvmpipe), never by the frame rate.
  • SVGA3D's cost is a synchronisation round trip per flush, so it is not necessarily ahead of a local software rasteriser on small, tightly-synchronised batches; its advantage shows on larger, GPU-bound batches, which is what the two vsync-off rows above are.

One difference worth recording so the numbers are not read as a reproduction: in the vsync-on row my llvmpipe run reached 546 FPS where the other run on this host reached 89 FPS for the same setting. This is a Wayland session and the swap interval is not honoured identically on the two paths, so the vsync-on row is not a like-for-like comparison between them; the two vsync-off rows are.

AI-assisted: MiniMax M3.1 Flash.

… itself (TEST-RED-GREEN-MUTATION)

Verifiers remove a line of the fix by hand on nearly every test pull request to see the new test fail.
--mutate does it for each hunk of the pull request's code outside its tests (Rust and Python files it
changes; hunks taken without context, so a test changed next to the code stays out): after the green
side, it undoes that hunk alone, runs the tests again and reports it as caught (a test that went red
then green fails), not caught, does not build or does not apply, up to --mutate-max hunks (10); the
hunk is put back after each run. Python tests now run with -B: an undone change of the same size within
the same second would otherwise run the stale bytecode.
… Python run, so no test runs stale bytecode (review)

-B only stops writing bytecode. An ignored .pyc left in the work tree (git clean keeps it) ran instead of the reverted source: red passed and an undone hunk was not caught. -X pycache_prefix would cover the unittest process only, not the processes its tests start; removing the folders covers both.
… and reports it as caught by timeout (review)

Each command of a mutated run (cargo test, one Python test file) is stopped after --mutate-timeout seconds (600) together with the processes it started (taskkill /T on Windows, the process group elsewhere): a test binary or a process a test starts would otherwise keep the output pipe open. The hunk is then 'caught by timeout', apart from 'caught'. The red and green sides have no timeout, as before.
…undone, and which added files it does not mutate (review)

A hunk that cannot be put back no longer drops the whole mutations section: the report and --json (mutations_stopped) name the hunk, the reason and how many hunks were not tried. With --mutate, mutations is always a list and mutations_not_run says why none was undone: nothing to undo (a test-only pull request), or no test went red then green. Files the pull request adds stay unmutated, and the report and --json (added_not_mutated) now list them. Verdicts and exit codes are unchanged.
…ed; git worktree remove <dir>/tree removes it (review)
…lders, never through a link or junction (review)

Path.rglob follows directory junctions on Windows, so a junction in the tree to an outside folder had that folder's __pycache__ deleted, and a link itself named __pycache__ made shutil.rmtree raise. The walk now skips symbolic links and every reparse point (junctions included).
…rphan holding its output does not hold the run (review)

taskkill /T on a command that has already ended finds no tree: a child it left behind kept the output pipe open, the run waited for the timeout and a real caught read caught by timeout. A mutated run now writes its output to a temporary file and, on Windows, runs in a job object (kill on close) that its children join; once the command ends or times out, the job (the process group elsewhere) is stopped.
… merge, reset and cleaned (review)

A put-back that applies did not prove the tree green again: a test that wrote into a tracked file changed the result of the next hunk. The green merge is now committed with the tool's identity before its tests run, and each mutation resets the tree to it and cleans it before undoing its hunk. A hunk can no longer fail to go back, so mutations_stopped and its test are gone; a test that dirties the tree now has its own.
…or the red side and for the mutations (review)

code_hunks looked only at the lines a hunk adds, so a hunk that deletes an obsolete test inside a #[cfg(test)] module was mutated and read as not caught, while the red side took it as a test hunk. Both now use test_hunk_flags: every removed or added line is test code, blank or a comment, and one at least is test code.
With more code hunks than --mutate-max, the report read as if every hunk was tried. The hunks left out are now in --json (mutations_skipped, file and line) and in the text (not tried, past --mutate-max).
… as timed out building, not caught (review)

A mutated cargo run that times out before its first Running line was still a build: it says nothing about the tests, so it is no longer counted as caught by timeout. A stub cargo that hangs in its build or in a test binary now covers the cargo timeout path, which no test reached before.
…t that is not above 0, and both without --mutate (review)
…s nothing to undo in the files it modifies (review)
…ed; one way to remove the worktree, default folder or --work-dir (review)
…nd is stopped, not only that it does not hold the run (review)

With the output in a file the run no longer waits for such a process, so only a mark it would write later shows that the job (the process group elsewhere) stopped it. drop_bytecode reads a folder's attributes only for folders.
…ree put back on a __pycache__ it cannot remove, and four smaller fixes (review)

drop_bytecode skips a folder it may not list (Python cannot import from it either). A __pycache__ it cannot remove is now a usage error naming it (exit 2), and any such error during a run puts the tree back on the base, where before the undone hunk stayed. --mutate-timeout must also be finite. In a mutated run, a Python test stopped while running outweighs a cargo build that was stopped. job_of says once on stderr when it has no job object. docs/testing.md: one line rewrapped.
@TheGeogeo
TheGeogeo force-pushed the test-red-green-mutation branch from 5193b25 to bf65aa4 Compare December 2, 2026 04:27
@TheGeogeo

Copy link
Copy Markdown
Contributor Author

Rebased on main 8422def (#2814 is in main, so its commit dropped out). The points of @KelboLive, @fiestorra and @OreoFR are fixed here rather than in a follow-up, since the merge had not happened (head bf65aa4):

  • Added files are still not mutated, and now say so: added_not_mutated in the report and --json, and in docs/testing.md.
  • Stale bytecode: the -B comment was wrong. Before each Python run, the work tree's own __pycache__ folders are removed, never through a link or junction. -X pycache_prefix alone was tried and does not reach the processes a test starts.
  • A hunk that could not be put back: each mutation now starts from a commit of the green merge, reset and cleaned, so there is nothing to put back. A test that writes into the tree cannot change the next hunk's result either.
  • Timeout: --mutate-timeout (600 s) applies to each command of a mutated run. The run is in a Windows job object, so whatever it leaves behind is stopped too. The results read caught by timeout, or timed out building when cargo had not started a test.
  • A test-only pull request reads "nothing to undo: the diff changes no Rust or Python code outside its tests" (mutations_not_run), with the verdict unchanged.
  • Also covered: hunks past --mutate-max are listed (mutations_skipped); one rule tells test-only hunks for the red side and the mutations; the options are range-checked; docs/testing.md lists every result and how to remove the worktree.

--mutate-target stays out of this pull request, as @fiestorra suggested it: a new option belongs in its own pull request.

tests/test_red_green.py: 37 OK on Windows 11. Each change has a test that fails without it.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5; a separate Claude Opus 5.5 agent reviewed the diff before this push).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants