Skip to content

test(desktop-linux): allow explained Xvfb retries in display race test - #247

Merged
ElbertePlinio merged 4 commits into
mainfrom
fix/240-display-allocation-flake
Oct 5, 2026
Merged

ElbertePlinio merged 4 commits into
mainfrom
fix/240-display-allocation-flake

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

The allocator retries by design. When an Xvfb attempt fails with confirmed cleanup, startXvfb moves to the next display. A stale lock or socket file passes reserveFreeDisplay, and the test's fake Xvfb exits on it. A foreign server can also take a display after the check. Both cases give a valid extra spawn. The race test asserted exactly 12 spawns, so it failed on correct retry behavior.

The fake Xvfb now logs each display it actually claims. The test checks that the claims equal the 12 allocated displays exactly. That means one claim per display, no duplicate claim, and no retry that leaked a claimed server. Spawns must be at least 12, and every claim must appear in the spawn log. So every extra spawn is a failed attempt that never claimed a display. Product code is unchanged.

QA pass skipped: this change is test-only and has no user-facing behavior.

Requirement Verified by Scenario Result Evidence
Reproduce the extra spawn Automated test (temporary copy) Stale lock with a dead pid written on a reserved display Old assertion: expected 12, got 13. New assertions pass Local run
No double claim or leaked server Automated test Claims equal the allocated displays Passes Local run, CI
File passes under load Automated test 6 parallel copies next to the desktop-linux suite 6 of 6 passed Local run
Full suite and coverage Automated test bun run test:coverage 2882 passed, 6 skipped, thresholds intact Local run, CI
Lint, types, function limits oxlint, tsc, PickCheck 0.4.0 --base origin/main All clean Local run

Closes #240

Stale or foreign X locks on a reserved display make the fake server
fail, and startXvfb correctly retries the next display. Assert one
claim per allocated display instead of an exact spawn count.

Closes #240
The fake Xvfb now writes one event log. It records spawn, claim and
fail lines, and an overlap line when another fake from the test is
alive on the same display. The claim line lands before the socket can
be seen, and fail lines land before the fake exits, so the log is
complete once every worker reports.

The race test fails on any overlap or unsettled spawn and when the
claimed displays differ from the allocated ones. Retries caused by a
stale or foreign lock or socket still pass. Failure messages include
the worker results and the event log.

Refs #240
@ElbertePlinio
ElbertePlinio merged commit 9ff2cd7 into main Oct 5, 2026
14 of 15 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/240-display-allocation-flake branch October 5, 2026 22:32
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.

test: display allocation spawn count flakes under parallel load

1 participant