Answer architecture round 1: 0 🔴, 2 🟡; rename Step to StepUp and let escalation.py own the judge's step-line sentence

This commit is contained in:
2026-10-23 04:54:45 +02:00
parent f0e14f3fdf
commit bf8b642ead
6 changed files with 62 additions and 59 deletions
+9 -9
View File
@@ -196,15 +196,15 @@ class Transitions(unittest.TestCase):
def test_a_rulings_step_up_reaches_the_worker_it_resumes_through_the_answer_the_human_types_and_no_further(self):
step = escalation.Step(Route(Rung("claude-opus-5-5", "medium")), Route(Rung("claude-opus-5-5", "high"), escalated_at=3))
step_up = escalation.StepUp(Route(Rung("claude-opus-5-5", "medium")), Route(Rung("claude-opus-5-5", "high"), escalated_at=3))
interrupt, quoted = Interrupt("e", "q", "round 2: 🔴"), QuotedAnswer("e", "q", "A.", "round 2: 🔴")
for state, event, after in (
(states.Judging("/t"), states.Ruled(quoted, step), states.Working(quoted, 1, step)),
(states.Judging("/t", 3), states.Ruled(quoted, step), states.Interrupting("/t", quoted, 3, step)),
(states.Judging("/t"), states.Ruled(interrupt, step), states.Interrupting("/t", interrupt, 0, step)),
(states.Interrupting("/t", interrupt, 0, step), states.HumanTyped(TYPED), states.Working(TYPED, 0, step)),
(states.Interrupting("/t", interrupt, 0, step), states.TalkChosen(), states.Talking("/t")),
(states.Working(TYPED, 0, step), states.WorkerRan("/t"), states.Judging("/t")),
(states.Judging("/t"), states.Ruled(quoted, step_up), states.Working(quoted, 1, step_up)),
(states.Judging("/t", 3), states.Ruled(quoted, step_up), states.Interrupting("/t", quoted, 3, step_up)),
(states.Judging("/t"), states.Ruled(interrupt, step_up), states.Interrupting("/t", interrupt, 0, step_up)),
(states.Interrupting("/t", interrupt, 0, step_up), states.HumanTyped(TYPED), states.Working(TYPED, 0, step_up)),
(states.Interrupting("/t", interrupt, 0, step_up), states.TalkChosen(), states.Talking("/t")),
(states.Working(TYPED, 0, step_up), states.WorkerRan("/t"), states.Judging("/t")),
):
with self.subTest(state=state, event=event):
self.assertEqual(states.transition(state, event), after)
@@ -407,8 +407,8 @@ class Cycles(unittest.TestCase):
cycle = dataclasses.replace(self.cycle(FakeEffects()), project=Routing.OPUS, route=Route(Routing.OPUS, 3, 3, 4))
for ruling in (Interrupt("e", "q", entries_read=3), QuotedAnswer("e", "q", "A.", entries_read=3)):
with self.subTest(ruling=ruling):
self.assertIsNone(run.stepped(cycle, ruling))
self.assertEqual(run.stepped(cycle, Interrupt("e", "q", "round 2: 🔴", 4, entries_read=3)), escalation.Step(cycle.route, Route(Routing.XHIGH, 3, 3, 4, escalated_at=3)))
self.assertIsNone(run.ruling_step_up(cycle, ruling))
self.assertEqual(run.ruling_step_up(cycle, Interrupt("e", "q", "round 2: 🔴", 4, entries_read=3)), escalation.StepUp(cycle.route, Route(Routing.XHIGH, 3, 3, 4, escalated_at=3)))
def test_an_escalation_after_an_interrupt_stepped_the_worker_steps_it_again_in_the_same_cycle(self):
streams = [Worker(self.paths.claude_code_transcripts.parent, text="round 2: 🔴"), Worker(self.paths.claude_code_transcripts.parent), Worker(self.paths.claude_code_transcripts.parent)]