From eeb4735078bc291ab6dcd4e2f5ba4df58c35ea2a Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 30 Jun 2026 02:31:38 -0700 Subject: [PATCH] test(web_server): assert ws-ping invariant, not frozen 20.0 literal The loopback ws-ping window is now 30s/60s (#48445/#50005), so the hardcoded == 20.0 assertion was a change-detector that broke the moment the loopback tuning landed. Assert the behavioral contract instead: ping stays enabled (positive) and timeout >= interval. --- tests/test_web_server.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_web_server.py b/tests/test_web_server.py index b06677f382f..a525b6f828a 100644 --- a/tests/test_web_server.py +++ b/tests/test_web_server.py @@ -71,14 +71,21 @@ def _stub_uvicorn(monkeypatch): def test_start_server_enables_ws_ping_for_half_open_detection(monkeypatch): """WS ping must be configured so half-open connections (reverse-proxy 524, - dropped tunnels) raise WebSocketDisconnect into the reaping path (#32377).""" + dropped tunnels) raise WebSocketDisconnect into the reaping path (#32377). + + Loopback binds (the Desktop case) get a longer window to ride out + GIL-pressure event-loop stalls (#48445/#50005). The invariant asserted + here is that ping stays enabled (non-None, positive) and the timeout is + never shorter than the interval — not a frozen literal, which churns every + time the window is retuned.""" captured = _stub_uvicorn(monkeypatch) # Loopback bind => no auth gate, so this reaches the Config constructor. web_server.start_server(host="127.0.0.1", port=0, open_browser=False) - assert captured["ws_ping_interval"] == 20.0 - assert captured["ws_ping_timeout"] == 20.0 + assert captured["ws_ping_interval"] and captured["ws_ping_interval"] > 0 + assert captured["ws_ping_timeout"] and captured["ws_ping_timeout"] > 0 + assert captured["ws_ping_timeout"] >= captured["ws_ping_interval"] def test_start_server_runs_on_uvicorns_loop_factory(monkeypatch):