Skip to content

test(debates): route the last two device-menu opens through the connection guard - #2479

Merged
ohohoreilly merged 1 commit into
masterfrom
ohohoreilly/device-menu-open-race-tail
Sep 20, 2026
Merged

ohohoreilly merged 1 commit into
masterfrom
ohohoreilly/device-menu-open-race-tail

Conversation

@ohohoreilly

Copy link
Copy Markdown
Contributor

#2477 routed the device-menu tests through openDeviceSettings, which waits for roomConnect to have been called and for the trigger to be enabled — exactly devicesLocked === false. Two sites in the same file still open a menu with a bare fireEvent.click, and one of them is genuinely exposed to the same race.

The exposed one

ignores stale device enumeration results during rapid hardware changes (line 1521) opens the Audio settings menu as its first interaction, with a synchronous getByRole. Nothing before it waits on the connection: it awaits the ready button and createLocalTracks, both of which are local-preview concerns and independent of roomState. So if the intro connection is still in flight at that point, the effect at debate-pre-join-screen.tsx:188 closes the menu underneath it and every radio disappears.

Reproduced with the same technique #2477 used, and it gives the same error:

TestingLibraryElementError: Unable to find role="radio" and name "Studio Mic"

A controlled A/B, same test, same condition — roomConnect resolving after 200ms so the connection lands mid-test rather than never:

open via result
fireEvent.click(getByRole('button', …)) (today) fails, Unable to find role="radio"
await openDeviceSettings('Audio settings') passes

Holding roomConnect permanently pending reproduces it deterministically too, which is how it was found.

The other one

Line 1149, inside lets participants choose microphone and camera devices from desktop settings menus, switches Audio → Video with a bare click. That test opens Audio through the helper first, so devicesLocked is already false by the time it switches and I could not get it to fail. Changed for consistency rather than because it was breaking — it is the same shape, and leaving one bare click in the file invites the next one.

Why the file still passed

openDeviceSettings covers 20 call sites; these two were the remainder. With only one exposed site left the hit rate is far below the roughly 1-in-6 the file used to show, which is why 10/10 under contention did not catch it — the win from #2477 is real, this is the tail of it.

Validation

  • 181/181 on an idle machine.
  • 10/10 under CPU contention (16 spinners on 16 cores) — the condition that reproduced the original at about 1 run in 6.
  • The deterministic repro above fails before this change and passes after.

Tests only; no product code touched.

…ction guard

#2477 moved the device tests onto `openDeviceSettings`, which waits for the
intro connection to settle before opening a settings menu. Two bare
`fireEvent.click` opens were left in the file.

`ignores stale device enumeration results during rapid hardware changes`
opens Audio settings as its first interaction and waits on nothing that
tracks `roomState`, so a connection landing mid-test closes the menu
underneath it and the radios vanish — the same `Unable to find
role="radio"` this file has been failing with. With `roomConnect`
resolving after 200ms it fails through the bare click and passes through
the helper.

The switch to Video settings at line 1149 follows a guarded open, so
`devicesLocked` is already false and it could not be made to fail; changed
for consistency.

181/181 idle, 10/10 under CPU contention.
@vercel

vercel Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
geogenesis Ready Ready Preview Sep 20, 2026 3:11am UTC

Request Review

@ohohoreilly
ohohoreilly merged commit a5c5653 into master Sep 20, 2026
4 checks passed
@ohohoreilly
ohohoreilly deleted the ohohoreilly/device-menu-open-race-tail branch September 20, 2026 03:26

This branch was successfully deployed

1 active deployment
Preview — 8cdc4935 Deployed Sep 20, 2026 by vercel[bot]
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