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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user