diff --git a/tests/test_issue1690_scroll_completion.py b/tests/test_issue1690_scroll_completion.py index 66233b65..afd601a1 100644 --- a/tests/test_issue1690_scroll_completion.py +++ b/tests/test_issue1690_scroll_completion.py @@ -72,5 +72,13 @@ def test_session_switch_and_idle_session_load_keep_default_bottom_pin_behavior() load_session = _function_body(SESSIONS_JS, "loadSession") idle_branch = load_session[load_session.index("}else{\n S.busy=false;") : load_session.index("// Sync context usage indicator")] - assert "syncTopbar();renderMessages();" in idle_branch - assert "preserveScroll:true" not in idle_branch + # #3326: the idle branch now renders with a CONDITIONAL preserveScroll — + # `renderMessages(sameSessionForceReload?{preserveScroll:true}:undefined)`. + # For a normal cross-session idle load (currentSid!==sid) sameSessionForceReload + # is false, so the arg is undefined and the default bottom-pin behavior (#1690) + # is unchanged. preserveScroll only applies to a same-session external + # force-refresh (#3239), which is a different code path from #1690's scenario. + assert "syncTopbar();renderMessages(sameSessionForceReload?{preserveScroll:true}:undefined);" in idle_branch + # The idle path must NOT unconditionally preserveScroll — it stays bottom-pinned + # for cross-session loads. Guard against a regression to an always-on preserve. + assert "renderMessages({preserveScroll:true})" not in idle_branch diff --git a/tests/test_issue2341_pending_user_reattach.py b/tests/test_issue2341_pending_user_reattach.py index b0a4faf3..5e171094 100644 --- a/tests/test_issue2341_pending_user_reattach.py +++ b/tests/test_issue2341_pending_user_reattach.py @@ -25,7 +25,9 @@ def test_load_session_inflight_reattach_merges_pending_user_message_before_rende block = _load_session_inflight_branch() merge_pos = block.find("_mergePendingSessionMessage") - render_pos = block.find("renderMessages();") + # #3326 added an optional {preserveScroll} arg to the INFLIGHT-branch render + # call; match the call form rather than the bare `renderMessages();`. + render_pos = block.find("renderMessages(") assert merge_pos != -1, ( "loadSession's INFLIGHT reattach branch must merge pending_user_message " diff --git a/tests/test_issue3162_ensure_messages_loaded.py b/tests/test_issue3162_ensure_messages_loaded.py index cb44a394..823d7cd0 100644 --- a/tests/test_issue3162_ensure_messages_loaded.py +++ b/tests/test_issue3162_ensure_messages_loaded.py @@ -15,7 +15,9 @@ SESSIONS_JS = (REPO / "static" / "sessions.js").read_text(encoding="utf-8") def _ensure_messages_loaded_body() -> str: start = SESSIONS_JS.index("async function _ensureMessagesLoaded") - return SESSIONS_JS[start: start + 2000] + # Window widened (#3326 added reload-width-hint handling inside this function, + # pushing the carry-forward reassignment further down). + return SESSIONS_JS[start: start + 2600] def test_ensure_messages_loaded_declares_msgs_with_let(): diff --git a/tests/test_parallel_session_switch.py b/tests/test_parallel_session_switch.py index bd01d4eb..c81ec230 100644 --- a/tests/test_parallel_session_switch.py +++ b/tests/test_parallel_session_switch.py @@ -80,9 +80,14 @@ class TestLoadSessionIdleOverlap: found = False for pos in positions: - block = SESSIONS_JS[pos : pos + 600] + # Window widened 600→850 (#3326 added a reload-width-hint comment + + # conditional preserveScroll arg in the idle branch, pushing the + # _dirP.catch line further from the S.busy=false anchor). + block = SESSIONS_JS[pos : pos + 850] has_loaddir = "loadDir('.')" in block - has_render = "renderMessages()" in block + # #3326 added an optional {preserveScroll} arg to the idle-path render + # call; match the call form rather than the bare `renderMessages()`. + has_render = "renderMessages(" in block if has_loaddir and has_render: found = True assert "highlightCode()" not in block, ( diff --git a/tests/test_regressions.py b/tests/test_regressions.py index 428b3b46..3d6c565f 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -620,7 +620,9 @@ def test_loadSession_inflight_sets_busy_before_renderMessages(cleanup_test_sessi assert inflight_idx >= 0, "INFLIGHT branch not found in loadSession" inflight_block = src[inflight_idx:inflight_idx+1600] busy_pos = inflight_block.find("S.busy=true;") - render_pos = inflight_block.find("renderMessages();") + # #3326 added an optional {preserveScroll} arg to the INFLIGHT-branch render + # call, so match the call form rather than the bare `renderMessages();`. + render_pos = inflight_block.find("renderMessages(") assert busy_pos >= 0, "loadSession INFLIGHT branch must set S.busy=true" assert render_pos >= 0, "loadSession INFLIGHT branch must call renderMessages()" assert busy_pos < render_pos, \