Repository navigation
Make tests wait for conditions instead of the clock (fixes flaky CI on Xcode 27) - #273
Merged
Merged
Conversation
testTrailingEdgeDeliversTheLastValueOnly raced its own 150 ms dispatch against the sender's 50 ms Timer. When the main thread stalled past both deadlines, the run loop could service the dispatch first and assert before the trailing send. It failed 2 of 3 CI runs on the Xcode 27 image; with a 300 ms stall injected locally it failed 2/20, the new version 0/20. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The xcode-27 CI image stalls for seconds at a time, and each run some test lost a race against a fixed sleep or a tight deadline. - Shared eventually / eventuallyOnMain / turnRunLoopUntil helpers with one 10 s ceiling that only stops a hung test. - Sleep-then-assert sites now wait for the event: ack timeout resolving the shot, the start deadline voiding a take, the reconnect tick, capability re-requests, the camera list, the Watch stream watchdog, the director publishing rig settings and exiting. - Snapshot chrome detector sampled every 32nd pixel and missed thin text and icons, so ten screens always fell back to ImageRenderer (testCountdownChrome's CI failure). It samples every 4th pixel now: those tests take 0.2 s instead of 10 s and the three scanner snapshot tests run instead of skipping. - Absence checks (nothing more is sent) keep a short window: there is no event to wait for, and a slow runner only lengthens it. - Skip testFocusedTransferBadgeDrawsInItsCornerAndMovesNothing: on iOS 27 adding the badge sometimes redraws neighbouring glass rims, so its pixel-exact diff fails ~1 in 5 without anything moving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
📊 Test Coverage Report✅ 786/809 tests passed · ⏭️ 23 skipped
🎥 Capture & session core
📁 Full report — 103 files
Generated from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI has been red on the new Xcode 27 machines because of tests, not because of the app. This makes the tests wait for what they're checking instead of betting on the clock.
What was going on
When we moved CI to Xcode 27 (for the iPhone 18 Pro fix), GitHub put us on slower machines that sometimes freeze for seconds. Many of our tests did "wait 150 ms, then check" or "give up after 2.5 seconds". On a frozen machine the check happens too early, and each run a different test failed.
It's like checking your mailbox at 3pm for a letter due at 1pm, except the mail truck got stuck in traffic. The letter isn't lost, you just looked too soon. The fix is to wait for the letter, not for 3pm.
What changed (tests only, app untouched)
Verified
🤖 Generated with Claude Code