Record with each archived verdict the setup that ran it, what each model spent by kind, and the human's reversals
CI / tests (pull_request) Failing after 2m12s
CI / tests (pull_request) Failing after 2m12s
This commit is contained in:
@@ -105,6 +105,34 @@ class Outcomes(unittest.TestCase):
|
||||
self.assertEqual(read.latest_worker(kept, str(transcript)), "w2")
|
||||
self.assertIsInstance(read.latest_worker(kept, str(pathlib.Path(root, "gone.jsonl"))), Failure)
|
||||
|
||||
def test_a_record_quotes_the_reversal_then_the_spend_then_the_config_before_the_judge(self):
|
||||
record = outcomes.Record("v0.8.0 (abc)", "Spent since the chunk began, in tokens of x:\n- worker, m: 1", "No, keep it.\nUse X.")
|
||||
self.assertEqual(outcomes.finished("w", "e", "j", record=record), "Verdict: finished\n\nEvidence:\n> e\n\nReversed:\n> No, keep it.\n> Use X.\n\nSpent since the chunk began, in tokens of x:\n- worker, m: 1\n\nConfig: v0.8.0 (abc)\nJudge: j\nWorker: w")
|
||||
self.assertEqual(outcomes.finished("w", "e", "j", record=outcomes.Record("v0.8.0 (abc)")), "Verdict: finished\n\nEvidence:\n> e\n\nConfig: v0.8.0 (abc)\nJudge: j\nWorker: w")
|
||||
|
||||
def test_reads_back_each_reversal_and_the_stamps_of_the_outcomes_that_record_a_spend(self):
|
||||
spent = outcomes.Record("c", "Spent since the chunk began, in tokens of x:\n- worker, m: 1", "No, keep it.\nUse X.")
|
||||
kept = "Task: Do it.\n\n" + "\n".join(f"{utc(NOW + offset)} {outcome}\n" for offset, outcome in enumerate([
|
||||
outcomes.unfinished("w", "e", "j", "", record=spent),
|
||||
outcomes.stopped("w", "Ctrl-C"),
|
||||
outcomes.finished("w", "e", "j", record=outcomes.Record("c", "Spent since x, in tokens of x:\n- judge, m: 1")),
|
||||
]))
|
||||
self.assertEqual(outcomes.reversals(kept), ["No, keep it.\nUse X."])
|
||||
self.assertEqual(outcomes.spent_stamps(kept), [utc(NOW), utc(NOW + 2)])
|
||||
self.assertEqual(outcomes.workers(kept), [(utc(NOW), "w"), (utc(NOW + 1), "w"), (utc(NOW + 2), "w")])
|
||||
|
||||
def test_the_last_spend_is_the_latest_outcome_of_the_chunk_that_records_one(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
kept = pathlib.Path(root, "archive")
|
||||
transcript = pathlib.Path(root, "t.jsonl")
|
||||
transcript.write_text('{"timestamp": "2026-10-03T00:00:00Z"}\n')
|
||||
self.assertEqual(read.last_spent(kept, str(transcript)), "")
|
||||
with contextlib.redirect_stderr(io.StringIO()):
|
||||
self.assertIsNone(write.archive(kept, str(transcript), "Do it.", outcomes.unfinished("w", "e", "j", "", record=outcomes.Record("c", "Spent since the chunk began, in tokens of x:\n- worker, m: 1")), NOW))
|
||||
self.assertIsNone(write.archive(kept, str(transcript), "Do it.", outcomes.stopped("w", "Ctrl-C"), NOW + 1))
|
||||
self.assertEqual(read.last_spent(kept, str(transcript)), utc(NOW))
|
||||
self.assertIsInstance(read.last_spent(kept, str(pathlib.Path(root, "gone.jsonl"))), Failure)
|
||||
|
||||
|
||||
class Location(unittest.TestCase):
|
||||
def test_keys_a_project_by_its_path_under_code_or_else_under_the_root(self):
|
||||
|
||||
Reference in New Issue
Block a user