Skip to content

Fix bannerHidesWhenScoringUnavailable CI flake#353

Merged
jubishop merged 1 commit into
worktree-searchRecommendationsfrom
worktree-fix-bannerHidesWhenScoringUnavailable
May 25, 2026
Merged

Fix bannerHidesWhenScoringUnavailable CI flake#353
jubishop merged 1 commit into
worktree-searchRecommendationsfrom
worktree-fix-bannerHidesWhenScoringUnavailable

Conversation

@jubishop
Copy link
Copy Markdown
Owner

Summary

  • SearchRecommendationCollectorTests.bannerHidesWhenScoringUnavailable started failing in CI after #PR284's race-condition refactor of awaitScoringContext (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.
  • The race: 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(by: .seconds(5)) ran first, FakeSleeper.currentTime jumped to 6 s and the rebuild's sleep then registered with wakeTime = 11 s, which never woke — scoringRevision never ticked, banner stayed .loading, Wait.until(.hidden) timed out.
  • Fix is test-only: wait for the cacheRebuild's sleep to be enqueued via 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 debounce comment (Adapt rebuild debounce and cancel in-flight on background #341 made it 5 s).

Test plan

🤖 Generated with Claude Code

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>
@jubishop jubishop changed the base branch from worktree-searchRecommendations to main May 25, 2026 19:08
@jubishop jubishop changed the base branch from main to worktree-searchRecommendations May 25, 2026 19:08
@jubishop jubishop merged commit e99c520 into worktree-searchRecommendations May 25, 2026
2 checks passed
@jubishop jubishop deleted the worktree-fix-bannerHidesWhenScoringUnavailable branch May 25, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant