Answer stability round 1: 0 🔴, 1 🟡 (0 misread); record a bench's figures inside the bench with --record-figures, so one that stopped or an older digest is never recorded
This commit is contained in:
@@ -332,6 +332,36 @@ class BenchTest(unittest.TestCase):
|
||||
self.assertEqual(lines[-3:-1], ["| All | base | 0/1 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | 1 |", "| All | head | 1/1 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | 1 |"])
|
||||
self.assertEqual([(run["side"], run["run"]) for run in json.loads((folder / "results.json").read_text())["runs"]], [("base", 1), ("head", 1)])
|
||||
|
||||
def project_config(self) -> pathlib.Path:
|
||||
"""Writes the config that puts the project's records in the checkout, and returns its comprehension history's path."""
|
||||
config = self.home / ".claude-projects/calc/config.toml"
|
||||
config.parent.mkdir(parents=True)
|
||||
records = {"plan": "todo.md", "working-rules": "AGENTS.md", "decisions": "docs/decisions.md", "score-anchors": "docs/score-anchors.md", "comprehension-history": "docs/comprehension-history.md", "reading-cost": "docs/reading-cost.md", "changelog": "CHANGELOG.md", "goals-and-audience": "README.md"}
|
||||
config.write_text(f'checkout = "{self.repo}"\n' + "".join(f'{name} = "checkout:{path}"\n' for name, path in records.items()) + 'principles = "~/principles"\nstandards = "~/standards"\n')
|
||||
return self.repo / "docs/comprehension-history.md"
|
||||
|
||||
def test_record_figures_appends_a_finished_benchs_rows_over_every_bug_to_the_comprehension_history(self):
|
||||
history = self.project_config()
|
||||
report = self.bench(**{"--record-figures": ""})
|
||||
self.assertNotIsInstance(report, Failure, report)
|
||||
self.assertEqual(report[-1], f"Appended to {history}.")
|
||||
lines = history.read_text().splitlines()
|
||||
self.assertRegex(lines[2], rf"^## \d{{4}}-\d\d-\d\dT\d\d:\d\d:\d\dZ, task-bench of item-1: head {self.head[:8]} against base {self.base[:8]}$")
|
||||
self.assertEqual([line.split(" | ")[:2] for line in lines[6:]], [["| All", "base"], ["| All", "head"], ["| All", "change"]])
|
||||
|
||||
def test_a_bench_records_no_figures_unless_asked_nor_where_it_stops(self):
|
||||
history = self.project_config()
|
||||
self.assertNotIsInstance(self.bench(), Failure)
|
||||
self.env["FAKE_REFUSED_FROM"] = "3"
|
||||
self.assertIsInstance(self.bench(**{"--record-figures": ""}), Failure)
|
||||
self.assertFalse(history.exists())
|
||||
|
||||
def test_record_figures_refuses_before_any_container_starts_where_no_config_names_the_checkout(self):
|
||||
found = self.bench(**{"--record-figures": ""})
|
||||
self.assertIsInstance(found, Failure)
|
||||
self.assertTrue(found.reason.startswith(f"no config names the checkout {self.repo}"), found.reason)
|
||||
self.assertFalse(self.log.exists())
|
||||
|
||||
def test_a_change_to_another_file_neither_moves_nor_drops_the_bug(self):
|
||||
(self.repo / "notes.txt").write_text("one\ntwo\nthree\nfour\nfive\nsix\n")
|
||||
self.commit("Notes")
|
||||
@@ -390,7 +420,7 @@ class MainTest(unittest.TestCase):
|
||||
return main.main(list(argv), {"CLAUDE_CODE_OAUTH_TOKEN": token, "HOME": "/nonexistent"}), errors.getvalue()
|
||||
|
||||
def test_refuses_an_unknown_repeated_or_valueless_argument(self):
|
||||
for argv, said in ((["--imgae", "x"], "unknown argument --imgae"), (["--image", "x", "--image=y"], "--image is given twice"), (["--image"], "--image needs a value")):
|
||||
for argv, said in ((["--imgae", "x"], "unknown argument --imgae"), (["--image", "x", "--image=y"], "--image is given twice"), (["--image"], "--image needs a value"), (["--record-figures=yes"], "--record-figures takes no value"), (["--record-figures", "--record-figures"], "--record-figures is given twice"), (["--record-figures"], "--image is missing")):
|
||||
code, errors = self.run_main(*argv)
|
||||
self.assertEqual((code, errors.startswith(f"{said}; usage: task-bench --image")), (1, True), errors)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user