Skip to content

test(web): stop asserting ci scheduling latency in the ws broadcast test - #672

Merged
plind-junior merged 1 commit into
vouchdev:testfrom
minion1227:ci/deflake-ws-broadcast-timing
Jul 30, 2026
Merged

test(web): stop asserting ci scheduling latency in the ws broadcast test#672
plind-junior merged 1 commit into
vouchdev:testfrom
minion1227:ci/deflake-ws-broadcast-timing

Conversation

@minion1227

Copy link
Copy Markdown
Contributor

test_websocket_broadcasts_on_approve bounds the approve-to-frame round trip at 1.0s. it just failed #666's ci on py3.12 at 1.479s while py3.11 and py3.13 passed the same commit — the classic signature of a wall-clock assertion measuring the runner rather than the code.

the bound was never measuring the broadcast. the comment beside it says so: "the real number is milliseconds". what a 1.0s assertion actually tests, given three orders of magnitude of headroom, is whether a shared github runner descheduled the test thread for a second — which it can do with nothing wrong in the code, and which no change to vouch can prevent.

so the timing assertion stays, but for the failure it can genuinely detect. a broadcast that stalls on a slow client (_Hub.broadcast blocking on a socket that stopped reading) does not land at 1.2s — it lands at seconds or hangs outright. 10s catches that and cannot be tripped by scheduling noise.

what carries #194's criterion is untouched: the frame must arrive, and must carry type=refresh, view=queue and the right proposal_id. those are the assertions that fail if the broadcast breaks. i moved the criterion note into the docstring so the next reader does not have to infer which assertion is load-bearing.

no source change, one test file, tests/test_web_e2e.py green at 26 cases and ruff clean.

worth flagging the general shape rather than just this instance: any assertion of the form elapsed < X where the real value is X/1000 is a scheduling detector wearing a performance-test costume. this is the only one i hit, but it is worth a grep if this recurs elsewhere.

test_websocket_broadcasts_on_approve bounded the approve-to-frame round
trip at 1.0s. the real number is single-digit milliseconds, so the bound
was never measuring the broadcast — it was measuring whether the runner
descheduled the thread, which it can do for over a second with nothing
wrong in the code. it failed on py3.12 at 1.479s while 3.11 and 3.13
passed the same commit.

the assertion that carries the criterion is that the frame arrives with
the right view and proposal id, and that is unchanged. the timing bound
stays, at 10s, for the thing it can actually detect: a broadcast that
stalls on a slow client, which shows up as seconds or a hang rather than
a near-miss.
@github-actions github-actions Bot added review-ui browser review ui tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 30, 2026
@plind-junior
plind-junior merged commit b2ebf53 into vouchdev:test Jul 30, 2026
14 checks passed
@minion1227
minion1227 deleted the ci/deflake-ws-broadcast-timing branch July 31, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-ui browser review ui size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants