From 72b714974076d266a54cd0ff2e6900a5325c82c3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 29 Oct 2026 20:52:58 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20list=20loop?= =?UTF-8?q?s=20whose=20file=20order=20differs=20from=20their=20checkout=20?= =?UTF-8?q?order=20and=20one=20whose=20ID=20is=20true,=20clear=20the=20not?= =?UTF-8?q?e=20as=20a=20number=20is=20typed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/loop_inbox/inbox.py | 4 ++-- bin/loop_inbox/test_loop_inbox.py | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/loop_inbox/inbox.py b/bin/loop_inbox/inbox.py index afab2656..832bef2e 100644 --- a/bin/loop_inbox/inbox.py +++ b/bin/loop_inbox/inbox.py @@ -69,9 +69,9 @@ def pressed(screen: Screen, key: str) -> Screen | Send | Open | Quit: if key == ENTER: return picked(shown, typed) if key == BACKSPACE: - return dataclasses.replace(screen, typed=typed[:-1]) + return dataclasses.replace(screen, typed=typed[:-1], note="") # isdigit would also take "²", which int() rejects. - return dataclasses.replace(screen, typed=typed + key) if key.isdecimal() else screen + return dataclasses.replace(screen, typed=typed + key, note="") if key.isdecimal() else screen case Answering(ask, typed): if key == ESCAPE or (key == ENTER and not typed.strip()): return Listing() diff --git a/bin/loop_inbox/test_loop_inbox.py b/bin/loop_inbox/test_loop_inbox.py index 835dad0f..1275c6bd 100644 --- a/bin/loop_inbox/test_loop_inbox.py +++ b/bin/loop_inbox/test_loop_inbox.py @@ -292,9 +292,10 @@ class Keys(unittest.TestCase): with self.subTest(keys=keys): self.assertEqual(keyed(Listing((ask,)), *keys), after) - def test_a_number_typed_keeps_the_running_loops_shown(self): + def test_a_number_typed_keeps_the_running_loops_shown_and_clears_the_note(self): running = (RunningLoop("s1", "/code/log", ()),) - self.assertEqual(keyed(Listing(running=running), "1", "2", BACKSPACE), Listing((), "1", "", running)) + self.assertEqual(keyed(Listing(note="No loop has the number 7.", running=running), "1", "2", BACKSPACE), Listing((), "1", "", running)) + self.assertEqual(keyed(Listing(typed="1", note="No loop has the number 7.", running=running), BACKSPACE), Listing((), "", "", running)) def test_an_answer_is_sent_stripped_talk_opens_claude_and_enter_alone_or_esc_goes_back(self): ask = asked("s1", "/code/log") @@ -426,14 +427,15 @@ class RunningLoops(unittest.TestCase): self.assertEqual(running_loops.running_loops(self.folder), []) def test_lists_the_loops_by_checkout_and_leaves_out_one_that_was_killed_or_whose_file_cannot_be_read(self): - for session, root in (("s1", "/code/web"), ("s2", "/code/c")): + # Five, so the order the files are found in is unlikely to be the order by checkout. + for session, root in (("s1", "/code/web"), ("s2", "/code/c"), ("s7", "/code/a"), ("s8", "/code/z"), ("s9", "/code/m")): self.enterContext(running_loops.shown_running(self.folder, session, root, self.effects)) # A killed loop leaves its file behind, and its lock free. (self.folder / "s3.running").write_text(json.dumps({"root": "/code/old", "items": []})) - for session, content in (("s4", "{"), ("s5", json.dumps({"root": "/code/x", "items": [{"id": "1", "tagline": ""}]})), ("s6", json.dumps({"root": "/code/x"}))): + for session, content in (("s4", "{"), ("s5", json.dumps({"root": "/code/x", "items": [{"id": "1", "tagline": ""}]})), ("s6", json.dumps({"root": "/code/x"})), ("s10", json.dumps({"root": "/code/x", "items": [{"id": True, "tagline": ""}]}))): self.enterContext(session_lock.held(self.folder, session)) (self.folder / f"{session}.running").write_text(content) - self.assertEqual(running_loops.running_loops(self.folder), [RunningLoop("s2", "/code/c", ()), RunningLoop("s1", "/code/web", ())]) + self.assertEqual(running_loops.running_loops(self.folder), [RunningLoop("s7", "/code/a", ()), RunningLoop("s2", "/code/c", ()), RunningLoop("s9", "/code/m", ()), RunningLoop("s1", "/code/web", ()), RunningLoop("s8", "/code/z", ())]) def test_a_second_loop_on_the_session_warns_and_leaves_the_first_listed_with_its_question(self): ask = asked("s1", "/code/log")