test(chat): refresh restore guard source-shape assertions (#5224)

This commit is contained in:
Rod Boev
2026-06-29 17:32:49 -04:00
committed by nesquena-hermes
parent 494d137082
commit ae67cd3428
2 changed files with 6 additions and 7 deletions
@@ -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
+5 -6
View File
@@ -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