Skip to content

Commit 92e95af

Browse files
committed
test(tui): pin wall-clock-rotated spinner verb in Working-regression guards
Three tests assert 'Working' is absent from the rendered activity spinner to guard against the old static 'Working…' placeholder. The verb rotates on time.monotonic() over a list that legitimately includes 'Working', so the suite fails deterministically for the verb's 10-minute rotation window every ~21 hours. Pin spinner_message in those tests so the guard only catches the real regression.
1 parent e7eabc6 commit 92e95af

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

tests/ui_and_conv/test_empty_think_part_indicator.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,16 @@ def test_moon_fallback_during_active_turn():
213213
assert agent_blocks[0].plain.strip() == ""
214214

215215

216-
def test_working_indicator_stays_visible_when_content_block_visible():
216+
def test_working_indicator_stays_visible_when_content_block_visible(monkeypatch):
217217
"""The activity spinner stays visible while content streams."""
218218
from rich.text import Text
219219

220+
from pythinker_code.ui.shell.visualize import _live_view
221+
222+
# The verb rotates on wall-clock over a list that legitimately includes
223+
# "Working"; pin it so the static-"Working…" regression guard below cannot
224+
# false-positive during that verb's 10-minute rotation window.
225+
monkeypatch.setattr(_live_view, "spinner_message", lambda now=None, **_kw: "Composing…")
220226
view = _LiveView(StatusUpdate())
221227
view.dispatch_wire_message(TurnBegin(user_input="test"))
222228
view.dispatch_wire_message(StepBegin(n=1))
@@ -286,7 +292,10 @@ def test_moon_fallback_after_all_tools_flushed(monkeypatch):
286292
def test_working_indicator_stays_visible_while_parallel_tool_still_running(monkeypatch):
287293
"""The activity spinner stays visible while tool blocks are visible."""
288294
from pythinker_code.ui.shell.console import console as shell_console
295+
from pythinker_code.ui.shell.visualize import _live_view
289296

297+
# Pin the wall-clock-rotated verb; see the content-block variant above.
298+
monkeypatch.setattr(_live_view, "spinner_message", lambda now=None, **_kw: "Composing…")
290299
view = _LiveView(StatusUpdate())
291300
monkeypatch.setattr(shell_console, "print", lambda *args, **kwargs: None)
292301

tests/ui_and_conv/test_modal_lifecycle.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,17 @@ async def test_compose_equals_panels_plus_agent_output() -> None:
914914

915915

916916
@pytest.mark.asyncio
917-
async def test_compose_agent_output_includes_spinners_and_tool_calls() -> None:
917+
async def test_compose_agent_output_includes_spinners_and_tool_calls(monkeypatch) -> None:
918918
"""compose_agent_output() should include activity indicators and tool call blocks."""
919919
from rich.text import Text
920920

921+
from pythinker_code.ui.shell.visualize import _live_view
921922
from pythinker_code.wire.types import ToolCall
922923

924+
# The spinner verb rotates on wall-clock over a list that legitimately
925+
# includes "Working"; pin it so the static-"Working…" regression guard
926+
# below cannot false-positive during that verb's rotation window.
927+
monkeypatch.setattr(_live_view, "spinner_message", lambda now=None, **_kw: "Composing…")
923928
view = _LiveView(StatusUpdate())
924929
view._active_turn_depth = 1 # working fallback requires active turn
925930

0 commit comments

Comments
 (0)