Answer stability round 1: 0 🔴, 8 🟡 (0 misread); check a reference patch as a build is checked, test the rule at the head, split the bench's setup by kind
This commit is contained in:
@@ -103,7 +103,7 @@ class BenchTest(unittest.TestCase):
|
||||
(fakes / "gremlins.py").write_text(GREMLINS)
|
||||
self.log = self.root / "docker.log"
|
||||
self.env = {**isolated_env(), "HOME": str(self.home), "PATH": f"{fakes}{os.pathsep}{os.environ['PATH']}", "FAKE_LOG": str(self.log), "FAKE_CLAUDE": str(fakes / "claude.py"), "CLAUDE_CODE_OAUTH_TOKEN": "sk-secret-token", "RUN_HEAVY_MEMORY": "2048"}
|
||||
self.given = {"--image": "golang:1.27.4", "--test": "sh calc_test.go", "--prefix": f"{sys.executable} {fakes / 'gremlins.py'}", "--seed": "1", "--bugs": "2", "--runs": "2"}
|
||||
self.given = {"--image": "golang:1.27.4", "--test": "sh calc_test.go", "--prefix": f"{sys.executable} {fakes / 'gremlins.py'}", "--seed": "1", "--bugs": "2", "--runs": "2", "--tasks": "bugs"}
|
||||
self.git("init", "--quiet", "--initial-branch", "main")
|
||||
for name, text in (("calc.go", BASE_CODE), ("calc_test.go", TESTS), ("README.md", "# Calc\n")):
|
||||
(self.repo / name).write_text(text)
|
||||
@@ -127,7 +127,7 @@ class BenchTest(unittest.TestCase):
|
||||
|
||||
def bench(self, **given: str):
|
||||
with contextlib.redirect_stderr(io.StringIO()) as self.progress:
|
||||
return main.bench({**self.given, "--base": "main", **given}, self.env, PLACES, self.home)
|
||||
return main.bench({**self.given, "--base": "main", **given}, self.env, lambda home: PLACES, self.home)
|
||||
|
||||
def calls(self) -> list[list[str]]:
|
||||
return [json.loads(line) for line in self.log.read_text().splitlines()]
|
||||
@@ -301,7 +301,7 @@ class BenchTest(unittest.TestCase):
|
||||
|
||||
def test_fails_where_the_places_name_no_go_file_of_the_base(self):
|
||||
with contextlib.redirect_stderr(io.StringIO()):
|
||||
found = main.bench({**self.given, "--base": "main"}, self.env, "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
|
||||
found = main.bench({**self.given, "--base": "main"}, self.env, lambda home: "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
|
||||
self.assertEqual(found, Failure("The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug."))
|
||||
self.assertFalse(self.log.exists())
|
||||
|
||||
@@ -402,11 +402,11 @@ class ReportTest(unittest.TestCase):
|
||||
]
|
||||
|
||||
def test_names_the_commits_the_bugs_the_runs_and_what_ran_them_above_the_table(self):
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 2, 1, 1), self.RESULTS, [])
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 2), self.RESULTS, [])
|
||||
self.assertEqual(told, ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 2 times at each side by claude-haiku-5-5 in Claude Code 2.1.330.", "", *self.TABLE, ""])
|
||||
|
||||
def test_says_where_fewer_bugs_were_planted_than_asked_for_and_where_no_run_finished(self):
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 1, 1, 3), self.RESULTS[1:], ["Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one."])
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 1), self.RESULTS[1:], ["Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one."])
|
||||
self.assertEqual(told[:3], ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 1 time at each side by no run that finished.", "Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one.", ""])
|
||||
|
||||
def test_a_stopped_bench_tells_why_then_how_far_it_came_then_the_table(self):
|
||||
@@ -500,7 +500,7 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
return Containers(InTurn(*runs), "bench", "go test ./...", 512, "1000:1000")
|
||||
|
||||
def bench(self, *runs: Ran | Failure) -> main.Bench:
|
||||
return main.Bench("", {"base": "b", "head": "h"}, self.trees, main.Asked(main.BUG, 1, 1, 1), self.containers(*runs), self.folder, lambda *args, **given: "", lambda line: None)
|
||||
return main.Bench("", {"base": "b", "head": "h"}, self.trees, main.Asked(main.BUG, 1), self.containers(*runs), self.folder, lambda *args, **given: "", lambda line: None)
|
||||
|
||||
def test_a_fix_whose_tests_run_out_of_time_does_not_pass(self):
|
||||
late = TimedOut("docker run still ran after 30 min")
|
||||
@@ -512,7 +512,7 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
|
||||
def test_tests_docker_could_not_run_without_a_bug_fail_the_bench(self):
|
||||
broke = Failure("docker could not start: No such file or directory")
|
||||
self.assertEqual(main.benched(self.bench(broke), lambda bench: main.planted_tasks(bench, [])), broke)
|
||||
self.assertEqual(main.benched(self.bench(broke), lambda bench: main.planted_tasks(bench, [], 1, 1)), broke)
|
||||
|
||||
def test_a_mutant_whose_tests_run_out_of_time_is_passed_over(self):
|
||||
late = TimedOut("docker run still ran after 30 min")
|
||||
@@ -536,7 +536,7 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
|
||||
def test_results_that_cannot_be_written_fail_the_bench_naming_the_folder(self):
|
||||
bench = dataclasses.replace(self.bench(), folder=self.folder / "gone")
|
||||
self.assertFailsWith(main.kept(bench, [], {}, []), f"could not write the results under {self.folder / 'gone'}: ")
|
||||
self.assertFailsWith(main.kept(bench, main.Planned([], [], {}), {}, []), f"could not write the results under {self.folder / 'gone'}: ")
|
||||
|
||||
def test_a_bug_that_cannot_be_planted_fails_the_bench_naming_the_tree(self):
|
||||
(self.folder / "file").write_text("")
|
||||
@@ -561,7 +561,7 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
def test_a_digest_quoting_half_of_a_surrogate_pair_is_written_with_a_question_mark_in_its_place(self):
|
||||
# Claude Code may cut a string between the halves of an emoji's pair, and JSON parses the half it keeps into a lone surrogate.
|
||||
said = entry_from(json.loads('{"type": "assistant", "message": {"content": [{"type": "text", "text": "half \\ud83d pair"}]}}'))
|
||||
self.assertIsNone(main.kept(self.bench(), [self.task], {1: "calc.go:4:11 ARITHMETIC_BASE"}, [Result(1, "base", 1, False, None, [said])]))
|
||||
self.assertIsNone(main.kept(self.bench(), main.Planned([self.task], [], {"seed": 1}), {1: "calc.go:4:11 ARITHMETIC_BASE"}, [Result(1, "base", 1, False, None, [said])]))
|
||||
self.assertIn("half ? pair", (self.folder / "digest.md").read_text(encoding="utf-8"))
|
||||
|
||||
def test_a_mutant_in_a_file_the_head_lacks_is_passed_over(self):
|
||||
|
||||
Reference in New Issue
Block a user