Skip to content

test(desktop): hold a join's answers apart from the window's loop - #197

Merged
bketelsen merged 1 commit into
mainfrom
bk/join-test-flake
Nov 11, 2026
Merged

bketelsen merged 1 commit into
mainfrom
bk/join-test-flake

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Summary

TestAnOldJoinCannotFinishTheNewRun (from 9b369da) is flaky. It failed #188's CI (run 43057093200) with current error not shown, and it fails 94 times in 100 when pinned to one CPU shared with three busy loops.

Cause: the test swapped the whole window's event loop for a held channel. The answers of a.calls still in flight from the window's start, such as a second vault list after the connection, also landed on that channel. On a slow runner one arrived first, the test took it for the old join's answer, and the real old answer then failed the check.

Fix: joinFlow gets a post hook, which is the window's loop when nil. The test sets it, so it holds only the join's answers. Pinned the same way, the test now passes 100 times in 100. It still fails ("old answer replaced the new join") if the run-ID check in joinFlow.start is removed.

Production behavior is unchanged. This doesn't touch #194, which is a different problem in the same flow.

Risk tier

Risk tier: 1 — a test and a test seam. No changed path matches the repository's L1 or L2 globs.

Verification

  • make check green (host)
  • go test -race ./internal/desktop/window/ green
  • make desktop-build green
  • Starved run before and after: 94 of 100 fail, then 0 of 100
  • Revert test: without the run-ID check in joinFlow.start, the test fails

TestAnOldJoinCannotFinishTheNewRun swapped the whole window's loop for a
held one, so an answer of a call still in flight from the start could be
taken for the join's. On one starved CPU it failed 94 times in 100, and
it failed #188's CI. The join flow posts to its own hook when it has
one, and the test holds only the join's answers: 100 in 100 pass there.
@github-actions github-actions Bot added the level:L3 Skim label Nov 11, 2026
@bketelsen
bketelsen merged commit 6aa569d into main Nov 11, 2026
9 of 10 checks passed
@bketelsen
bketelsen deleted the bk/join-test-flake branch November 11, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants