Skip to content

test(websocket): gate the bind/debug/ignore specs on the response arriving - #444

Merged
camreeves merged 1 commit into
masterfrom
fix/websocket-spec-fixed-sleeps
Aug 6, 2026
Merged

test(websocket): gate the bind/debug/ignore specs on the response arriving#444
camreeves merged 1 commit into
masterfrom
fix/websocket-spec-fixed-sleeps

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

Three specs in session_spec.cr sent a websocket request, slept a fixed 100.milliseconds, then asserted on updates.size. That's a race rather than a wait — under any extra load the response hasn't arrived and the spec fails with expected 1, got 0, pointing at websockets when the branch under test had nothing to do with them.

wait_for_updates already exists in this file for exactly this purpose, with a comment saying so, and the receives updates spec already uses it. unbind, debug and ignore were simply never converted.

How I found it

Merging the Azure consent stack (#440#441#442). After rebasing #442 onto master, websocket API debug failed twice in a row, while passing on master and on every earlier run of the same code. #442 only touches tenant_consent.cr and adds one utility — it cannot affect a websocket subscription. What it does add is six examples with Redis round-trips, and that was enough to push the fixed sleep over.

So this is a latent flake that gets exposed by any branch that adds work to the suite, which makes it worth fixing rather than retrying past.

The helper polls to a 5-second deadline and raises on timeout, so a real regression still fails — it just stops failing for the wrong reason.

exec (line ~111) still uses a fixed sleep; it goes through test_websocket_exec, which doesn't expose updates to its block. Left alone rather than widened here.

🤖 Generated with Claude Code

…iving

These three sent a request, slept a fixed 100ms, then asserted on
`updates.size`. That is a race, not a wait: under any extra load the
response has not arrived yet and the spec fails with "expected 1, got 0"
somewhere unrelated to whatever the branch actually changed.

`wait_for_updates` already exists for exactly this, with a comment saying
so, and the `receives updates` spec already uses it — these three were
simply never converted. The helper polls to a 5s deadline and fails
loudly on timeout, so a genuine regression still reports as one.

Found while merging the Azure consent stack: the `debug` spec failed
twice in a row on a branch that only touched the consent controller,
while passing on master. Six extra examples were enough to tip it.
@camreeves
camreeves merged commit 8edfee0 into master Aug 6, 2026
8 of 11 checks passed
@camreeves
camreeves deleted the fix/websocket-spec-fixed-sleeps branch August 6, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant