Answer the architect: fail a judge that answers without interrupting, read every checkout file through one function

This commit is contained in:
2026-10-03 00:39:20 +02:00
parent 6340e5a993
commit 160b1dae5f
6 changed files with 32 additions and 26 deletions
+4 -5
View File
@@ -496,7 +496,7 @@ class Verdict(unittest.TestCase):
self.assertEqual(judge.verdict_from({"answer": "", "interrupt": False, "evidence": "e", "finished": False, "question": "ignored"}), Unfinished("e"))
self.assertEqual(judge.verdict_from({"answer": "", "interrupt": True, "evidence": "e", "finished": True, "question": "Which one?"}), Interrupt("e", "Which one?"))
self.assertEqual(judge.verdict_from({"answer": "A.", "interrupt": True, "evidence": "e", "finished": False, "question": "Which one?"}), Recorded("e", "Which one?", "A."))
self.assertEqual(judge.verdict_from({"answer": "ignored", "interrupt": False, "evidence": "e", "finished": False, "question": ""}), Unfinished("e"))
self.assertEqual(judge.verdict_from({"answer": "A.", "interrupt": False, "evidence": "e", "finished": False, "question": ""}), Failure("the judge answered without interrupting"))
self.assertEqual(judge.verdict_from({"answer": "", "interrupt": "no", "evidence": "", "finished": True, "question": ""}), Failure("the judge's reply has no interrupt of type boolean"))
self.assertEqual(judge.verdict_from({"answer": "", "interrupt": False, "evidence": None, "finished": True, "question": ""}), Failure("the judge's reply has no evidence of type string"))
self.assertEqual(judge.verdict_from({"answer": "", "interrupt": True, "evidence": "x", "finished": False, "question": " "}), Failure("the judge interrupted without a question"))
@@ -529,6 +529,7 @@ class ExitContract(unittest.TestCase):
def test_every_exit_1_stop_has_its_clause_in_help(self):
read, git, premises_ = "a transcript cannot be read or archived", "git cannot start or finds no checkout", "README.md holds no premises"
models_ = "the models file cannot be read or written"
unreadable = "README.md, or AGENTS.md or docs/decisions.md where they exist, cannot be read or is not UTF-8"
# Every Stop whose code is not a literal 0, 2 or 130, in source order: path, function, code, start of reason, its --help clause.
clauses = [
("cycle/interrupt.py", "interrupt", "1", "entries.reason", read),
@@ -546,16 +547,14 @@ class ExitContract(unittest.TestCase):
("loop/reload.py", "exec_if_edited", "1", "f'could not reload loop-claude:", "python cannot start for a reload"),
("project/checkout.py", "checkout_root", "1", "f'could not start git:", git),
("project/checkout.py", "checkout_root", "1", "found.stderr.strip()", git),
("project/checkout.py", "read_checkout_file", "1", "f'{name} in {root}:", unreadable),
("project/checkout.py", "read_checkout_file", "1", "f'{name} is not UTF-8", unreadable),
("project/model_choice.py", "get_or_ask_model", "1", "f'could not save the model in", models_),
("project/model_choice.py", "read_models_file", "1", 'f"could not read {saved}: {getattr(', models_),
("project/model_choice.py", "read_models_file", "1", "f'could not read {saved}: not an object", models_),
("project/premises.py", "read_premises", "1", "f'README.md in {root}:", premises_),
("project/premises.py", "read_premises", "1", "f'README.md is not UTF-8", premises_),
("project/premises.py", "read_premises", "1", "f'README.md has no ##", premises_),
("project/premises.py", "read_premises", "1", "f'README.md has ## {name} more than once", premises_),
("project/premises.py", "read_premises", "1", "f'README.md has nothing under", premises_),
("project/records.py", "read_records", "1", 'f"{name} in {root}:', "AGENTS.md or docs/decisions.md cannot be read, or is not UTF-8"),
("project/records.py", "read_records", "1", 'f"{name} is not UTF-8', "AGENTS.md or docs/decisions.md cannot be read, or is not UTF-8"),
]
root = pathlib.Path(main.__file__).parents[1]
found = []