Fix bannerHidesWhenScoringUnavailable CI flake#353
Merged
jubishop merged 1 commit intoMay 25, 2026
Merged
Conversation
The drain task can be scheduled (banner → .loading) before it has reached engine.start() → observation emit → scheduleCacheRebuild() → cacheDebounce's 5 s sleep registration. If advanceTime runs first, currentTime jumps past the not-yet-scheduled wakeTime and the rebuild never fires — banner stays .loading. Wait for the sleep to register first, then advance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
SearchRecommendationCollectorTests.bannerHidesWhenScoringUnavailablestarted failing in CI after #PR284's race-condition refactor ofawaitScoringContext(commit 682e477). Locally the test passed; on CI the harness's slower scheduling exposed a latent timing race in the test itself — production behavior is unchanged..loading) before it has reachedengine.start()→ observation emit →scheduleCacheRebuild()→cacheDebounce's 5 s sleep registration. IfadvanceTime(by: .seconds(5))ran first,FakeSleeper.currentTimejumped to 6 s and the rebuild's sleep then registered withwakeTime = 11 s, which never woke —scoringRevisionnever ticked, banner stayed.loading,Wait.until(.hidden)timed out.fakeSleeper.waitForSleepRequests(count: 1)before advancing the clock, and bump the advance to 10 s for headroom. Refreshed the stale// well beyond the engine's 400 ms cacheRebuild debouncecomment (Adapt rebuild debounce and cancel in-flight on background #341 made it 5 s).Test plan
xcodebuild test -only-testing:PodHavenTests/SearchRecommendationCollectorTests— all 22 tests pass locally🤖 Generated with Claude Code