From ae67cd3428cd910ad7e8b6e7ef3d6941a40d87a6 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Mon, 29 Jun 2026 17:32:49 -0400 Subject: [PATCH] test(chat): refresh restore guard source-shape assertions (#5224) --- tests/test_1694_terminal_cleanup_ownership.py | 2 +- tests/test_session_rotate_url_sync.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_1694_terminal_cleanup_ownership.py b/tests/test_1694_terminal_cleanup_ownership.py index 8711b0a23..23dce8d86 100644 --- a/tests/test_1694_terminal_cleanup_ownership.py +++ b/tests/test_1694_terminal_cleanup_ownership.py @@ -123,7 +123,7 @@ def test_settled_restore_and_error_close_only_the_event_source_owner(): assert "function _handleStreamError(source)" in MESSAGES_JS assert "_closeSource(source);" in restore_body assert "_closeSource(source);" in error_body - assert "_restoreSettledSession(source)" in event_body + assert "_restoreSettledSession(source, {preserveVisibleOnShorterTerminalSnapshot:true})" in event_body assert "_handleStreamError(source)" in event_body assert "_restoreSettledSession())" not in event_body assert "_handleStreamError();" not in event_body diff --git a/tests/test_session_rotate_url_sync.py b/tests/test_session_rotate_url_sync.py index 5f223d8ff..40779959f 100644 --- a/tests/test_session_rotate_url_sync.py +++ b/tests/test_session_rotate_url_sync.py @@ -23,13 +23,12 @@ def test_stream_completion_syncs_rotated_session_id_to_tab_state(): assert settled_pos != -1 # Proximity window scoping "the completion/settled handler block near the - # session assignment". #4720 added a documented `_oldestIdx` reset statement - # into the completion block (between the marker and the localStorage sync), - # growing it past the original 800; widen to 1000 — still well within the - # single done/settled handler, so the guard's intent (the rotated session id - # is synced to tab state right after the session assignment) is preserved. + # session assignment". The settled restore block now includes the terminal + # stale-prefix guard before the tab-state sync, so keep the assertion local + # to the handler while widening the slice enough to cover the new helper + # state and the unchanged localStorage/update-url writes. completion_block = MESSAGES_JS[completion_pos : completion_pos + 1000] - settled_block = MESSAGES_JS[settled_pos : settled_pos + 1000] + settled_block = MESSAGES_JS[settled_pos : settled_pos + 1800] for block in (completion_block, settled_block): assert "localStorage.setItem('hermes-webui-session',S.session.session_id);" in block