Answer product-owner round 1: 1 🔴, 2 🟡 (0 misread); the help and the no-bug message say which tree makes a Rust mutant pass over

This commit is contained in:
2026-11-27 17:05:37 +01:00
parent 71842a6a85
commit cd916e58e3
+11 -11
View File
@@ -38,14 +38,14 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. The bench
tells a test by its path: a folder named `test`, `tests` or `__tests__`, or a file named `test_*.py`, `*_test.py`,
`*_test.go`, `*.test.*` or `*.spec.*`. A test of any other name counts as code, such as `src/PickTest.php` or
`src/pick-test.js`, so Haiku's change to it stands. In a Rust file, each
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. Where the planted file has such
modules and Haiku's file lacks one of them, or its modules cannot be told apart, the planted file stands whole; where the planted
file has none, or its modules cannot be told apart, Haiku's stands. A Rust mutant whose file's modules cannot be told apart, as where two share a name or a brace, string or comment
is never closed, is passed over. A Rust file that a `#[cfg(test)] mod name;` in another file of the planted tree names, as
`src/name.rs` or `src/name/mod.rs` beside a `lib.rs`, `main.rs` or `mod.rs`, or in the folder of any other file's name, is a
test: it stands as the planted tree has it, and no mutant is planted in it. A Rust mutant in a tree where such a declaration
names no file there, as one that `#[path]` moves does, is passed over.
`src/pick-test.js`, so Haiku's change to it stands. In a Rust file, each inline `#[cfg(test)]` module stands as the planted
file has it, and the rest is as Haiku left it. So does each `#[cfg(test)] mod name;` the planted file declares, and the file it
names: `name.rs` or `name/mod.rs`, in the declaring file's folder or in a folder named for that file without `.rs`. Where the
planted file has such modules or declarations and Haiku's file lacks one of them, or its modules cannot be told apart, the
planted file stands whole; where the planted file has none, or its modules cannot be told apart, Haiku's stands. A Rust mutant
whose file's modules cannot be told apart, as where two share a name or a brace, string or comment is never closed, is passed
over. So is each Rust mutant of a tree where a `#[cfg(test)] mod name;` names no file the bench finds, or where a Rust file has a
string or comment that is never closed. No bug is planted in a file that such a declaration names.
--image is the project's development image, such as golang:1.27.4. The bench adds Claude Code to it, as its installer installs it,
so the image needs curl and bash; the result names the version. Haiku works in that image. So does --test: sh runs that text at
@@ -529,7 +529,7 @@ def planted_tasks(bench: Bench, mutants: list[Mutant], seed: int, bugs: int) ->
return task
tasks += [task] if task else []
if not tasks:
return Failure(f"None of the {len(mutants)} mutants the tests kill becomes a bug: each is on a line the head changed, or the test it fails doesn't print a message.")
return Failure(f"None of the {len(mutants)} mutants the tests kill becomes a bug: each is on a line the head changed, the test it fails doesn't print a message, or, in a Rust file, a `#[cfg(test)] mod name;` of the tree names a file the bench can't find.")
return Planned(tasks, [] if len(tasks) == bugs else [f"Planted {len(tasks)} of the {bugs} bugs asked for: no other mutant the tests kill becomes one."], {"seed": seed})
@@ -590,9 +590,9 @@ def planted(bench: Bench, number: int, mutant: Mutant) -> Task | Failure | None:
# The check keeps a Rust file's test modules as planted, which it can only do where it tells them apart.
if bugs is None or not all(tells_apart(mutant.path, source) for source in bugs.values()):
return None
# ... and a Rust test in a file of its own, which it can only keep where it finds each such file.
# ... and the Rust test files of each side's tree, which it keeps only where it finds every one. A mutant in one of them is no bug.
if mutant.path.endswith(".rs"):
standing = on_disk(f"find the Rust test files beside {mutant.path}", lambda: [rust_test_files(tree) for tree in bench.trees.values()])
standing = on_disk(f"read the Rust files for the mutant in {mutant.path}", lambda: [rust_test_files(tree) for tree in bench.trees.values()])
if isinstance(standing, Failure):
return standing
if any(tests is None or mutant.path in tests for tests in standing):