Answer stability round 1: 0 🔴, 7 🟡; archive each step up as it happens, leave the bundled rule to the judge's schema, and test the routing edges mutants survived

This commit is contained in:
2026-10-14 23:23:42 +02:00
parent 1b5812076d
commit cb9a949cd5
6 changed files with 70 additions and 12 deletions
+6 -1
View File
@@ -7,7 +7,7 @@ FINISHED = "Verdict: finished"
FINISHED_AT = re.compile(rf"^({STAMPED}) {re.escape(FINISHED)}$", re.MULTILINE)
# An outcome opens with its UTC stamp; a verdict that closes a cycle, or a stop, ends with the worker line.
OUTCOME_AT = re.compile(rf"^({STAMPED}) ", re.MULTILINE)
CLOSES_A_CYCLE = ("Verdict: finished\n", "Verdict: unfinished\n", "Stopped: ")
CLOSES_A_CYCLE = ("Verdict: finished\n", "Verdict: unfinished\n", "Stopped: ", "Stepped up\n")
WORKER = "Worker: "
@@ -27,6 +27,11 @@ def answered(question: str, sources: str, answer: str, evidence: str) -> str:
return f"Verdict: quoted answer\n\n{question}\n\n{sources} says:\n{quoted(answer)}\n\nEvidence:\n{quoted(evidence)}"
def stepped_up(worker: str) -> str:
"""The rung the next cycle steps up to, archived as it steps, so a rerun after any exit resumes on it."""
return f"Stepped up\n\n{WORKER}{worker}"
def stopped(worker: str, why: str) -> str:
return f"Stopped: {why}\n\n{WORKER}{worker}"
@@ -56,6 +56,11 @@ class Outcomes(unittest.TestCase):
]))
self.assertEqual(outcomes.workers(kept), [(utc(NOW), "w1"), (utc(NOW + 2), "w2"), (utc(NOW + 3), "w3")])
def test_reads_no_worker_from_an_outcome_written_before_the_worker_line(self):
kept = f"Task: Do it.\n\n{utc(NOW)} Stopped: Ctrl-C\n\n{utc(NOW)} Verdict: unfinished\n\nEvidence:\n> Worker: no\n"
self.assertEqual(outcomes.workers(kept), [])
self.assertEqual(outcomes.workers(f"{utc(NOW)} {outcomes.stepped_up('w')}\n"), [(utc(NOW), "w")])
def test_takes_the_outcome_written_last_within_one_second(self):
with tempfile.TemporaryDirectory() as root:
kept = pathlib.Path(root, "archive")