test(#3993): re-anchor _load_session_error_block past the new stale-load guard

The stale-load guard (#3993 Codex race fix) adds an early  at the top
of the loadSession catch block; the test helper anchored  on the first
 after the catch, which now truncated at the guard. Anchor the body
extraction past the guard (from ) so it captures the 404/non-404
self-heal body as before. Behavior unchanged.
This commit is contained in:
nesquena-hermes
2026-06-11 22:37:09 +00:00
parent 8e7d3b086d
commit 952ac146e0

View File

@@ -43,8 +43,13 @@ def _load_session_error_block() -> str:
assert start > 0, "loadSession metadata request not found"
catch_idx = SESSIONS_JS.find("} catch(e) {", start)
assert catch_idx > start, "loadSession metadata catch block not found"
end = SESSIONS_JS.find("return;", catch_idx)
assert end > catch_idx, "loadSession metadata catch return not found"
# The catch opens with a stale-load guard that itself contains an early
# `return;` (#3993 Codex race fix). Skip past that guard so we extract the
# 404 / non-404 self-heal body, not just the guard.
body_start = SESSIONS_JS.find("if(_msgInner){", catch_idx)
assert body_start > catch_idx, "loadSession catch body not found"
end = SESSIONS_JS.find("return;", body_start)
assert end > body_start, "loadSession metadata catch return not found"
return SESSIONS_JS[catch_idx:end]