From 7c01eb1f8b03d3ab273a3b858abbda0d75d998f6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 02:03:10 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20keep=20a=20?= =?UTF-8?q?Rust=20file=20whose=20modules=20cannot=20be=20told=20apart=20as?= =?UTF-8?q?=20Haiku=20left=20it=20where=20the=20planted=20file=20has=20no?= =?UTF-8?q?=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/task_bench/main.py | 6 +++--- bin/task_bench/rust_test_modules.py | 7 ++++--- bin/task_bench/test_rust_test_modules.py | 5 +++++ bin/task_bench/test_task_bench.py | 7 +++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 70eeb5fb..4d4f6ac8 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -30,9 +30,9 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream. reaches api.anthropic.com and nothing else. A fix ends after 30 minutes. - Check. The test command runs over the planted tree with each file that is no test as Haiku left it; a fix passes where it exits 0. A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. 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 Haiku's file lacks one of - those modules, or its modules cannot be told apart, the planted file stands whole; where the planted file's 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 + 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 test in a file of its own, as `#[cfg(test)] mod tests;` names, counts, since the bench tells no such file from code. diff --git a/bin/task_bench/rust_test_modules.py b/bin/task_bench/rust_test_modules.py index 71907e3a..cdb5381e 100644 --- a/bin/task_bench/rust_test_modules.py +++ b/bin/task_bench/rust_test_modules.py @@ -81,10 +81,11 @@ def with_tests_of(planted: bytes, copy: bytes) -> bytes: """copy with each of its test modules replaced by the one of that name in planted, and each that planted lacks left out. So a test a fix changed, removed or added doesn't count. - Where planted's modules cannot be told apart, copy is returned as it is. Where copy's cannot, or copy lacks one of planted's, - planted is returned: Haiku's file has no module to put them in.""" + Where planted's modules cannot be told apart, or planted has none and copy's cannot be told apart, copy is returned as it is. Where + planted has some and copy's cannot be told apart, or copy lacks one of planted's, planted is returned: Haiku's file has no module + to put them in.""" before, after = modules(planted), modules(copy) - if before is None: + if before is None or (after is None and not before): return copy if after is None or before.keys() - after.keys(): return planted diff --git a/bin/task_bench/test_rust_test_modules.py b/bin/task_bench/test_rust_test_modules.py index 1497ea5a..6db68697 100644 --- a/bin/task_bench/test_rust_test_modules.py +++ b/bin/task_bench/test_rust_test_modules.py @@ -143,6 +143,11 @@ class WithTestsOfTest(unittest.TestCase): def test_takes_the_planted_file_where_the_fixed_modules_cannot_be_told_apart(self): self.assertEqual(with_tests_of(LIB, "fn broken() {"), LIB) + def test_takes_the_file_as_fixed_where_planted_has_no_module_and_the_fixed_modules_cannot_be_told_apart(self): + for planted in ("", "fn a() {}\n"): + with self.subTest(planted=planted): + self.assertEqual(with_tests_of(planted, "fn broken() {"), "fn broken() {") + if __name__ == "__main__": unittest.main() diff --git a/bin/task_bench/test_task_bench.py b/bin/task_bench/test_task_bench.py index e85687cc..b8527059 100644 --- a/bin/task_bench/test_task_bench.py +++ b/bin/task_bench/test_task_bench.py @@ -735,6 +735,13 @@ class CheckedTreeTest(unittest.TestCase): checked_tree(planted, copy, str(self.root / "check")) self.assertEqual(self.held("check"), {"src/lib.rs": "fn a() { 1 }\n#[cfg(test)]\nmod tests { fn t() {} }\n"}) + def test_takes_a_rust_file_the_fix_added_as_it_is_where_its_modules_cannot_be_told_apart(self): + planted = self.tree("planted", {"src/lib.rs": "fn a() {}\n"}) + added = "#[cfg(test)]\nmod tests {}\nfn b() { #[cfg(test)] mod tests {} }\n" + copy = self.tree("copy", {"src/lib.rs": "fn a() {}\n", "src/new.rs": added}) + checked_tree(planted, copy, str(self.root / "check")) + self.assertEqual(self.held("check")["src/new.rs"], added) + def test_leaves_a_rust_link_as_a_link_whatever_it_points_at(self): planted = self.tree("planted", {"z.rs": "fn a() {}\n#[cfg(test)]\nmod tests {}\n", "a.txt": "text"}) copy = self.tree("copy", {"a.txt": "text"})