diff --git a/clients/terminal/tui/ws_bridge.py b/clients/terminal/tui/ws_bridge.py index 5baa12c..410cb0f 100644 --- a/clients/terminal/tui/ws_bridge.py +++ b/clients/terminal/tui/ws_bridge.py @@ -119,10 +119,13 @@ await self._backoff() continue - # Connected — reset backoff and let the input loop send. + # Connected — reset backoff and let the input loop send. The status + # panel already labels the line "Connection: online", so the detail + # stays empty here (a non-empty detail appends after the label, + # e.g. "offline reconnecting…"). self._attempt = 0 self._set_connected(True) - self._notify(True, "online") + self._notify(True, "") try: await self._receive_until_closed() diff --git a/tests/clients/test_ws_bridge.py b/tests/clients/test_ws_bridge.py index 8766f38..4b70f5d 100644 --- a/tests/clients/test_ws_bridge.py +++ b/tests/clients/test_ws_bridge.py @@ -112,6 +112,10 @@ return [m.detail for m in bridge.app.messages if isinstance(m, ConnectionStatusChanged)] +def _status_states(bridge: WsBridge) -> list[bool]: + return [m.connected for m in bridge.app.messages if isinstance(m, ConnectionStatusChanged)] + + @pytest.mark.anyio async def test_reconnects_after_drop_and_continues_forwarding_events() -> None: """A socket delivers two frames then closes; the bridge backs off, @@ -161,10 +165,13 @@ assert calls["n"] >= 3, "must keep retrying past the initial refusals" assert "recovered" in [p.get("content") for p in _ws_payloads(bridge)] - # The status panel saw the offline→online transition. + # The status panel saw the offline→online transition. The success detail + # is empty (the panel labels the line "online" itself — no duplication). details = _status_details(bridge) assert any("reconnecting" in d for d in details) - assert any(d == "online" for d in details) + states = _status_states(bridge) + assert True in states, "must reach a connected state" + assert all(d == "" for d, s in zip(details, states) if s), "online detail must be empty" @pytest.mark.anyio