From 96b6068c32adc0967cbcc8210b544aaee9cf735e Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 26 Oct 2026 18:48:09 +0100 Subject: [PATCH] Fix the follow-up of #4014 (a variable name already used in Chat.tsx) and two of my tests (#3254 iterator, #3656 raw paths) --- apps/host/src/screens/Chat.tsx | 6 +++--- tests/terminal/test_launch_own_log.py | 4 ++-- tests/terminal/test_procs.py | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/host/src/screens/Chat.tsx b/apps/host/src/screens/Chat.tsx index 3fbc90d3..46075fab 100644 --- a/apps/host/src/screens/Chat.tsx +++ b/apps/host/src/screens/Chat.tsx @@ -215,7 +215,7 @@ export function ChatScreen() { const pinned = useRef(true); /** When the reader last used the wheel, a finger, a key or the scrollbar on the transcript. */ const readerInput = useRef(0); - const messageCount = useRef(0); + const seenMessages = useRef(0); /** * Scrolls to the newest message and stays there. * @@ -273,8 +273,8 @@ export function ChatScreen() { // The reader's own scrolling decides (#4014): a wheel notch is about 100 px and used to land inside a 120 px band that pulled // the view back on every token. `pinned` is set by the scroller's wheel, touch, key and scroll handlers below. const count = session?.messages.length ?? 0; - const sent = count > messageCount.current && session?.messages.at(-1)?.role === 'user'; - messageCount.current = count; + const sent = count > seenMessages.current && session?.messages.at(-1)?.role === 'user'; + seenMessages.current = count; // Sending a message always brings the reader to it, as it did before; only the answer's growth waits for the reader. if (pinned.current || sent) scrollToLatest(); diff --git a/tests/terminal/test_launch_own_log.py b/tests/terminal/test_launch_own_log.py index 73210ec7..85eb1f99 100644 --- a/tests/terminal/test_launch_own_log.py +++ b/tests/terminal/test_launch_own_log.py @@ -17,12 +17,12 @@ def derive(base): class OwnLog(unittest.TestCase): def test_the_setup_log_name_is_replaced_by_the_launch_log(self): - for name in ("M:/Strata/strata-iq3_xxs.log", "/home/me/strata/strata-q2_0.log", "M:\Strata\strata-iq3_s.log"): + for name in ("M:/Strata/strata-iq3_xxs.log", "/home/me/strata/strata-q2_0.log", r"M:\Strata\strata-iq3_s.log"): self.assertEqual(derive({"exe": "e", "args": [], "log": name})["log"], "C:/launch/q2_0.engine.log", name) self.assertEqual(derive({"exe": "e", "args": []})["log"], "C:/launch/q2_0.engine.log") def test_a_log_path_the_person_chose_is_kept(self): - for name in ("M:/logs/history.log", "/var/log/strata/engine.log", "D:\notes\iq3.txt"): + for name in ("M:/logs/history.log", "/var/log/strata/engine.log", r"D:\notes\iq3.txt"): self.assertEqual(derive({"exe": "e", "args": [], "log": name})["log"], name, name) self.assertEqual(runner.own_log_path({"log": "M:/Strata/strata-iq3_xxs.log"}), None) self.assertEqual(runner.own_log_path({"log": ""}), None) diff --git a/tests/terminal/test_procs.py b/tests/terminal/test_procs.py index c71ce742..2891ee5c 100644 --- a/tests/terminal/test_procs.py +++ b/tests/terminal/test_procs.py @@ -180,9 +180,11 @@ class SubreaperOrphans(unittest.TestCase): def test_ending_waits_on_the_start_token_not_on_an_empty_command_line(self): record = {"pid": 4242, "token": "t1", "cmd": ["engine", "--serve"]} - tokens = iter(["t1", "t1", None]) # still exiting twice, then gone + answers = ["t1", "t1"] # still exiting twice, then gone + def token(pid): + return answers.pop(0) if answers else None with mock.patch.object(procs, "WINDOWS", False), mock.patch.object(procs, "is_same", side_effect=[True, False, False]) as same, \ - mock.patch.object(procs, "_signal_verified"), mock.patch.object(procs, "start_token", side_effect=lambda pid: next(tokens)), \ + mock.patch.object(procs, "_signal_verified"), mock.patch.object(procs, "start_token", side_effect=token), \ mock.patch.object(procs, "drop_record"), mock.patch.object(procs.time, "sleep"): self.assertEqual(procs.end_one(record, grace=5), "ended") self.assertGreaterEqual(same.call_count, 1)