Repository navigation
test(backend): wait for the named realtime events instead of a frame count - #264
Merged
Merged
Conversation
…count A late invites-changed beacon from the setup could fill the frame count before the event under test arrived, so the resign test failed at random.
arrzdev
commented
Nov 1, 2026
arrzdev
left a comment
Owner
Author
There was a problem hiding this comment.
Approve. settle now waits for the named events, so a late setup beacon can no longer fill the count. Both realtime tests use it, test-only, CI green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The two realtime tests in
game.routes.test.tswaited for "any 2 frames" on the watched channel. A lateinvites-changedbeacon from the setup (the accept inopenGame()) can land after the channel opens and fill that count, so the resign test sometimes returned beforegames-changedarrived:settlenow takes the events the test expects and waits until all of them have arrived (same 1 s ceiling), then returns every event seen. Both tests in the block use it. No product code changes.Verification
game.routes.test.ts20 runs in a row (for i in $(seq 1 20); do pnpm exec vitest run src/http/routes/game.routes.test.ts; done): passed 20/20, 49 tests eachpnpm typecheck: passpnpm biome:check: passpnpm exec turbo run build --filter=@repo/backend...: passpnpm --filter @repo/backend test:coverage: pass, 343 tests, floors met (All files 94.18 stmts / 84.86 branches / 97.53 funcs / 95.15 lines)The installed Vitest (4.1.12) has no
--repeatflag, so the 20 runs used a shell loop.