test: drain transient STATUS results in errorEventFromServer test#340
Merged
aaron-zeisler merged 1 commit intomainfrom Apr 2, 2026
Merged
Conversation
Under resource contention the EventSource may experience a transient connection fault before the SSE events arrive, producing a STATUS(INTERRUPTED) that beats the expected CHANGE_SET into the result queue. This mirrors the existing pattern used by reconnectAfterPartialProtocolSequenceDeliversChangeset. Fixes SDK-2111 Co-Authored-By: Aaron Zeisler <azeisler@launchdarkly.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
aaron-zeisler
approved these changes
Mar 31, 2026
tanderson-ld
approved these changes
Apr 1, 2026
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.
Requirements
Related issues
FDv2StreamingSynchronizerTest.errorEventFromServerintermittently returnsSTATUSinstead ofCHANGE_SETDescribe the solution you've provided
The
errorEventFromServertest previously calledsync.next()exactly once and asserted the result wasCHANGE_SET. Under resource contention (full test suite), theEventSourcecan experience a transient connection fault before the SSE events arrive, producing aSTATUS(INTERRUPTED)that beats the expectedCHANGE_SETinto the result queue.The fix replaces the single
next()call with a drain loop (up to 10 iterations) that consumes and asserts on transientSTATUSresults until the expectedCHANGE_SETarrives. This mirrors the existing pattern already used byreconnectAfterPartialProtocolSequenceDeliversChangesetin the same test class, and reflects real-worldSourceManagerbehavior which callsnext()in a loop.No production code is changed.
Items for reviewer attention:
@Rule Timeout.seconds(10)will kill the test well before 10 × 5s. Verify this interaction is acceptable.heartbeatEvent,shutdownAfterEventReceived) could be similarly flaky and benefit from the same pattern.Describe alternatives you've considered
handleError()(Option C): inappropriate since the current production behavior of reporting every interruption is correct.Additional context
The JIRA ticket description was also reformatted (escaped markdown from Cursor was rendering poorly in Jira).
Link to Devin session: https://app.devin.ai/sessions/555f5a4faf774eba9d03b6c61e12402e
Note
Low Risk
Low risk because changes are confined to a unit/integration test; it only adjusts assertions to tolerate transient
STATUS(INTERRUPTED)results that can occur under contention.Overview
Makes
FDv2StreamingSynchronizerTest.errorEventFromServernon-flaky by no longer assuming the firstsync.next()result is aCHANGE_SET.The test now drains up to 10 queued
STATUSresults (asserting they areSTATUS) until the expectedCHANGE_SETarrives, then asserts the changeset is present.Written by Cursor Bugbot for commit bb26cd4. This will update automatically on new commits. Configure here.