fix(review): unblock CI on the stale-unread-dot salvage (#4946)

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.
This commit is contained in:
Nathan Esquenazi
2026-07-10 21:05:47 -07:00
parent 58af505cc6
commit da00a5ae8c
2 changed files with 7 additions and 1 deletions
@@ -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 = () => {};
@@ -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