Skip to content

Make the permission rejoin test deterministic under load - #260

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/permission-rejoin-race
Nov 15, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/permission-rejoin-race

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The CI failure of aHookRejoinsAHeedThatRestartedAndGetsItsAnswer (answer .pass, second.queued == 0) is a test-only timing assumption, not a loss in the product: PermissionHook, PermissionBroker and the control socket behave as documented (no rejoin before a receipt; rejoin after one).

Two causes in the test, both reproduced:

  • It stopped the fake heed when queued == 1, which rises before the receipt is written (the write is queued on the server queue). Stopping in that gap drops the connection before the hook has a receipt, so it correctly does not rejoin. With a 5 ms gap injected it failed in most of 300 cases.
  • The restart (sleep, start) ran as Swift tasks; with the cooperative pool saturated by other tests it resumed past the hook's wall-clock 5 s ceiling (fallback .ceiling).

Now it waits on receipted (set after the receipt is queued, which is ahead of stop() on the serial queue) and restarts heed from its own thread. The product is unchanged, the test stays strict, no timeout was widened.

Verified: fmt, lint and the full suite (2270 tests) pass. Not merged.

🤖 Generated with Claude Code

…nd of the receipt's timing

The test stopped the fake heed as soon as it had queued the ask, which is before the receipt is written, and ran the restart (sleep, start) as Swift tasks whose resumption a loaded suite can hold past the hook's five second ceiling. Both read as heed losing the ask. It now waits for the receipt to be handed to the server and restarts heed from its own thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working label Nov 15, 2026
@Mpdreamz
Mpdreamz merged commit d108711 into main Nov 15, 2026
7 checks passed
@Mpdreamz
Mpdreamz deleted the fix/permission-rejoin-race branch November 15, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant