Answer stability round 1: 0 🔴, 3 🟡 (0 misread); test that loop-inbox removes a killed loop's ask as it looks and that a loop leaves the ask of another that holds the session's lock

This commit is contained in:
2026-10-29 18:37:23 +01:00
parent bf78fedc54
commit 2f27e66f50
2 changed files with 18 additions and 0 deletions
+9
View File
@@ -744,6 +744,15 @@ class Interrupts(unittest.TestCase):
stop, _ = self.put(FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""])) stop, _ = self.put(FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""]))
self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed")) self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed"))
def test_leaves_the_question_another_loop_lists_for_the_session_where_that_loop_holds_its_lock(self):
theirs = self.ask(question="Theirs?")
self.enterContext(session_lock.locked(self.paths.waiting, theirs.session))
waiting.publish(self.paths.waiting, theirs)
answer, said = self.put(FakeEffects(inputs=["Use B."]))
self.assertEqual(answer, "Use B.")
self.assertIn(f"loop-inbox cannot show this question: another process holds {session_lock.lock_file(self.paths.waiting, theirs.session)}", said)
self.assertEqual(self.asked(), [theirs])
def test_makes_way_for_the_claude_loop_inbox_opens_and_goes_on_once_the_human_typed_there(self): def test_makes_way_for_the_claude_loop_inbox_opens_and_goes_on_once_the_human_typed_there(self):
def claude_ran(_): def claude_ran(_):
# loop-inbox opens claude only once the loop lists it as open there. # loop-inbox opens claude only once the loop lists it as open there.
+9
View File
@@ -336,6 +336,15 @@ class Waiting(unittest.TestCase):
waiting.drop_ended(folder) waiting.drop_ended(folder)
self.assertEqual(asks_and_answers(folder), []) self.assertEqual(asks_and_answers(folder), [])
def test_loop_inbox_removes_a_killed_loops_ask_and_answer_as_it_looks(self):
with tempfile.TemporaryDirectory() as home:
paths = paths_from(pathlib.Path(home))
ask = asked("s1", "/a")
waiting.publish(paths.waiting, ask)
waiting.send(paths.waiting, ask, Typed("Use A."))
main.run(Window("q"), contextlib.nullcontext, paths, system_effects())
self.assertEqual(asks_and_answers(paths.waiting), [])
def test_removes_only_the_asks_and_answers_whose_loop_has_ended(self): def test_removes_only_the_asks_and_answers_whose_loop_has_ended(self):
with tempfile.TemporaryDirectory() as temp: with tempfile.TemporaryDirectory() as temp:
folder = pathlib.Path(temp) folder = pathlib.Path(temp)