test(chat): accept keyed reasoning fallback path

This commit is contained in:
Frank Song committed 2026-07-15 06:58:02 +08:00
1 parent 90e9f04dab
commit e5c5fd63d4
3 files changed
+21 -10

No files matched your search

+6 -2
View File
@@ -938,9 +938,13 @@ def test_messages_js_supports_live_reasoning_and_tool_completion(cleanup_test_se
"live reasoning SSE events must update the active Worklog Thinking Card text"
assert "const liveThinkingText=_liveThinkingText();" in src, \
"live reasoning SSE events must compute the current segment's Worklog Thinking Card text once"
assert "if(!_upsertAnchorReasoning(liveThinkingText))" in src, \
assert "const anchorReasoningFallback={};" in src, \
"live reasoning SSE events must capture the active anchor id for fallback"
assert "if(!_upsertAnchorReasoning(liveThinkingText, anchorReasoningFallback))" in src, \
"live reasoning SSE events must prefer the anchor renderer before falling back"
assert "_updateLiveThinkingCard(liveThinkingText,{anchorRenderFallback:true,sessionId:activeSid,streamId})" in src, \
assert "_updateLiveThinkingCard(liveThinkingText,{" in src and "...anchorReasoningFallback" in src, \
"live reasoning SSE events must carry anchor identity into the fallback renderer"
assert "anchorRenderFallback:true" in src and "sessionId:activeSid" in src and "streamId" in src, \
"live reasoning SSE events must keep the current segment's Worklog Thinking Card as fallback"
assert "source.addEventListener('tool_complete'" in src or 'source.addEventListener("tool_complete"' in src, \
"messages.js must listen for live tool completion SSE events"
@@ -1307,8 +1307,13 @@ def test_slice6_live_shadow_feed_wires_anchor_scene_for_visible_order_handoff():
reasoning_body = _event_listener_body(src, "reasoning")
assert "_applyToAnchor" not in reasoning_body
assert "const liveThinkingText=_liveThinkingText();" in reasoning_body
assert "if(!_upsertAnchorReasoning(liveThinkingText))" in reasoning_body
assert "_updateLiveThinkingCard(liveThinkingText,{anchorRenderFallback:true,sessionId:activeSid,streamId})" in reasoning_body
assert "const anchorReasoningFallback={};" in reasoning_body
assert "if(!_upsertAnchorReasoning(liveThinkingText, anchorReasoningFallback))" in reasoning_body
assert "_updateLiveThinkingCard(liveThinkingText,{" in reasoning_body
assert "...anchorReasoningFallback" in reasoning_body
assert "anchorRenderFallback:true" in reasoning_body
assert "sessionId:activeSid" in reasoning_body
assert "streamId" in reasoning_body
assert "function _flushReasoningToAnchor()" in src
assert "_upsertAnchorReasoning(reasoningText" in src
assert "`live-reasoning:${streamId}:final`" in src
+8 -6
View File
@@ -686,21 +686,23 @@ class TestToolCallGroupingStatic:
assert "const liveThinkingText=_liveThinkingText();" in reasoning_fn, (
"Reasoning SSE updates should cache the live thinking text before routing."
)
assert "_upsertAnchorReasoning(liveThinkingText)" in reasoning_fn, (
primary_call = "_upsertAnchorReasoning(liveThinkingText, anchorReasoningFallback)"
assert primary_call in reasoning_fn, (
"Anchor reasoning must remain the primary renderer path."
)
fallback_call = "_updateLiveThinkingCard(liveThinkingText,{anchorRenderFallback:true,sessionId:activeSid,streamId})"
assert reasoning_fn.index("_upsertAnchorReasoning(liveThinkingText)") < reasoning_fn.index(
fallback_call
), (
fallback_call = "_updateLiveThinkingCard(liveThinkingText,{"
assert reasoning_fn.index(primary_call) < reasoning_fn.index(fallback_call), (
"The legacy thinking card should only run after anchor upsert fails."
)
assert "if(!_upsertAnchorReasoning(liveThinkingText)){" in reasoning_fn, (
assert "if(!_upsertAnchorReasoning(liveThinkingText, anchorReasoningFallback)){" in reasoning_fn, (
"The legacy thinking card should be a falsy-anchor fallback."
)
assert reasoning_fn.count(fallback_call) == 1, (
"Reasoning SSE updates should call the live thinking card only in fallback."
)
assert "...anchorReasoningFallback" in reasoning_fn, (
"The fallback renderer must receive the exact Anchor reasoning identity."
)
assert "_updateLiveThinkingCard(" in render_live_thinking_fn, (
"Inline parsed thinking still needs the live thinking card renderer."
)