test(llc): de-flake queryChannels persistence verifies#2659
Conversation
The two `Client with connected user with persistence`.`.queryChannels` tests in `client_test.dart` waited only 50ms past the 1s debounce on `ChannelClientState`'s persistence writes. That margin worked locally but raced the wall clock on the legacy_version_analyze CI runner. PR #2652 (coalesce queryChannels on flaky-network reconnects) wrapped `queryChannelsOnline` in `InFlightCache.run`, adding a couple of microtasks of `Future.sync` + `whenComplete` overhead — enough to shift the trailing-edge debounce past the 1050ms window on slow CI. - Await `expectLater` (was fire-and-forget) so stream emissions are observed before the timing wait starts. - Discard interactions accumulated during `setUp` (`connectUser` schedules its own debounced persistence writes that would otherwise pollute the call count). - Bump the post-emit delay to 1500ms so both the `updateChannelState` and `updateChannelThreads` debounces have safely fired before `verify().called(N)` runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTwo ChangesDebounced Persistence Timing in queryChannels Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2659 +/- ##
=======================================
Coverage 65.29% 65.29%
=======================================
Files 423 423
Lines 26642 26642
=======================================
Hits 17397 17397
Misses 9245 9245 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
The two
Client with connected user with persistence..queryChannelstests inclient_test.dartwaited only 50 ms past the 1 s debounce onChannelClientState's persistence writes. The margin worked locally but raced the wall clock on thelegacy_version_analyzeCI runner — those tests have failed on every master commit since #2652.#2652 wrapped
queryChannelsOnlineinInFlightCache.run, which adds a couple of microtasks ofFuture.sync+whenCompleteoverhead. Enough to shift the trailing-edge debouncedupdateChannelStatepast the 1050 ms window on slow CI — and to occasionally split a single channel's two rapid debounce triggers into two separate fires, depending on which side of the 1 s boundary they land.Fix
await expectLater(...)(was fire-and-forget) so stream emissions are observed before the timing wait starts.clearInteractions(persistence)after waiting past the setUp-induced debounce window, so calls scheduled byconnectUserdon't pollute the test's count.delayfrom 1050 ms to 1500 ms — generous margin past the 1 s debounce on bothupdateChannelStateandupdateChannelThreads.Test plan
flutter test packages/stream_chat/test/src/client/client_test.dart— all 155 tests pass.melos run analyzeclean.🤖 Generated with Claude Code
Summary by CodeRabbit