From da00a5ae8cecf8ee95a38ebd77f56fd6db1ca09a Mon Sep 17 00:00:00 2001 From: Nathan Esquenazi Date: Fri, 10 Jul 2026 21:05:47 -0700 Subject: [PATCH] fix(review): unblock CI on the stale-unread-dot salvage (#4946) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two CI-red issues, both fixed: 1. Lint (F401): the new tests/test_session_unread_dot_on_visit.py imported `re` but never used it. Dropped the import. 2. Test hang/timeout: loadSession() now routes its viewed-count/unread clear through the new _acknowledgeSessionVisit() helper, but the PRE-EXISTING tests/test_cross_session_message_load_isolation.py harness (which extracts loadSession and stubs its deps) didn't define it — so the extracted loadSession broke and the node driver hung to the 60s pytest-timeout. Stubbed _acknowledgeSessionVisit + _sessionVisitHasUnreadState to no-ops there, mirroring the pre-existing _setSessionViewedCount / _clearSessionCompletionUnread stubs they replaced. That harness covers cross-session load ordering + stale-reject, not unread-dot state, so a no-op stub preserves its intent; the real helper is exercised by the PR's own test_session_unread_dot_on_visit.py. Verified: ruff forward gate clean; the timeout test passes in ~1s; the PR's unread-dot suite 7/7. --- tests/test_cross_session_message_load_isolation.py | 7 +++++++ tests/test_session_unread_dot_on_visit.py | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_cross_session_message_load_isolation.py b/tests/test_cross_session_message_load_isolation.py index 00a3329c3..9f8999c4e 100644 --- a/tests/test_cross_session_message_load_isolation.py +++ b/tests/test_cross_session_message_load_isolation.py @@ -225,6 +225,13 @@ function createEnvironment() { globalThis._clearSameSessionForceReloadHint = () => { clearHintCalls += 1; }; globalThis._clearStuckSessionOnBoot = () => {}; globalThis._setSessionViewedCount = () => {}; + // #4946: loadSession() now routes its viewed-count/unread clear through + // _acknowledgeSessionVisit(). This harness exercises cross-session load + // ordering + stale-reject, not unread-dot state, so stub it (and its + // same-session-guard predicate) to no-ops — mirroring the pre-existing + // _setSessionViewedCount / _clearSessionCompletionUnread stubs it replaced. + globalThis._acknowledgeSessionVisit = () => {}; + globalThis._sessionVisitHasUnreadState = () => false; globalThis.scheduleTodosRefresh = () => {}; globalThis.startSessionStream = () => {}; globalThis.syncTopbar = () => {}; diff --git a/tests/test_session_unread_dot_on_visit.py b/tests/test_session_unread_dot_on_visit.py index 09af3cbd8..e6ec724ca 100644 --- a/tests/test_session_unread_dot_on_visit.py +++ b/tests/test_session_unread_dot_on_visit.py @@ -28,7 +28,6 @@ Two invariants flagged in review are protected here and MUST NOT regress: unread authoritatively rather than doing ad-hoc DOM surgery (concern b). """ import json -import re import subprocess from pathlib import Path