Skip to content

Tests wait on conditions instead of sleeping for them - #277

Merged
Mpdreamz merged 3 commits into
mainfrom
fix/fragile-timing-tests
Nov 16, 2026
Merged

Mpdreamz merged 3 commits into
mainfrom
fix/fragile-timing-tests

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Part of keeping CI free of wall-clock flakes.

  • ACPClientTests (3 tests): a fixed Task.sleep of 50/30/20 ms followed by an assertion is now a waitFor on the condition (the refusal and cancel written, session/new on the wire, session/cancel sent). New shared helper Tests/HeedCoreTests/WaitFor.swift: polls, returns as soon as the condition holds, 30 s deadline that only a broken behaviour reaches.
  • ApprovalTests aSlowAnswerTimesOutAndTheServerHearsTheHookLeft: the 200 ms sleep before gone.ids is now a wait for the server to hear the hook left.
  • anAgentThatGoesAway...: stressed at 200 cases with the pool starved, it hit the request's own 60 s deadline before the poll resumed; the request gets an hour, since the agent going away is what ends it.

Not changed: theHookStaysFast was already taken out of the suite by #269 (timings live in mise run bench). The three on-thread bounds in PermissionRoundTripTests are timed on the hook's own thread against a hook ceiling and passed 200/200 each with 6 CPU hogs per core plus pool-blocking tasks, so they stay as they are.

Verified: 200-case parametrized loops under CPU hogs and pool-blocking tasks (before: refusal test failed 1-2 of 200; after: 0 of 1000), mutations (refusal not sent, cancel not sent, wrong close reason, permissionGone not called) each fail their test, mise run test, lint, fmt.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the bug Something isn't working label Nov 16, 2026
@Mpdreamz
Mpdreamz force-pushed the fix/fragile-timing-tests branch from 2eaf079 to 3622adb Compare November 16, 2026 16:05
@Mpdreamz
Mpdreamz merged commit dfea747 into main Nov 16, 2026
3 checks passed
@Mpdreamz
Mpdreamz deleted the fix/fragile-timing-tests branch November 16, 2026 16:33
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