feat: Add goodbye-event FDv1 fallback directive test (SDK-2511)#359
Draft
devin-ai-integration[bot] wants to merge 2 commits into
Draft
feat: Add goodbye-event FDv1 fallback directive test (SDK-2511)#359devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Add a test that exercises the in-band goodbye SSE event form of the FDv1 Fallback Directive (protocolFallbackTTL field on the goodbye event), per FDV2PL spec §3.7 and CSFDV2 spec §8.3.4. This transport is essential for browser SDKs using native EventSource, which cannot read HTTP response headers on the streaming connection. Changes: - Add ProtocolFallbackTTL field to framework.Goodbye struct - Add PushGoodbyeWithFallback to StreamingService - Add DirectiveViaGoodbyeEngagesFDv1 test to the FDv1FallbackDirective suite Co-Authored-By: Bee Klimt <bklimt@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:
|
Contributor
Author
|
@cursor review |
kinyoklion
reviewed
Jun 12, 2026
| // Send the goodbye event with protocolFallbackTTL to trigger FDv1 fallback. | ||
| // TTL 0 means indefinite fallback — the SDK must not attempt FDv2 recovery. | ||
| dataSystem.Synchronizers[0].streaming.PushGoodbyeWithFallback("fdv1-fallback-directed", 0) | ||
| conn.Cancel() |
Member
There was a problem hiding this comment.
I am a little concerned that the dropped connection and the SDK processing the fallback might race?
Contributor
Author
There was a problem hiding this comment.
Good catch — removed conn.Cancel() entirely. The test now waits for the SDK to close the streaming connection itself (via conn.Context.Done()), which proves the SDK actually processed the goodbye event before transitioning. Force-cancelling could have raced the SDK's event processing and masked bugs where the goodbye is ignored.
…oodbye Instead of force-cancelling the connection (which races the SDK's goodbye event processing), wait for the SDK to close the streaming connection itself via context cancellation. This proves the SDK actually processed the protocolFallbackTTL directive rather than just seeing a dropped connection. Co-Authored-By: Bee Klimt <bklimt@launchdarkly.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.
Requirements
Related issues
SDK-2511 — Strengthen FDv1 fallback contract test to validate flag delivery
Describe the solution you've provided
The existing
FDv1FallbackDirectivetests exercise theX-LD-FD-FallbackHTTP response header form of the directive. This PR adds coverage for the in-band goodbye SSE event form (protocolFallbackTTLfield on thegoodbyeevent), per FDV2PL spec §3.7 and CSFDV2 spec §8.3.4.This transport is essential for browser SDKs using native
EventSource, which cannot read HTTP response headers on streaming connections.Changes:
framework/types.go: AddProtocolFallbackTTL *intfield toGoodbyestruct (matchesgoodbye.jsonschema)mockld/streaming_service.go: AddPushGoodbyeWithFallback(reason, ttlSeconds)helpersdktests/common_tests_stream_fdv2.go: AddDirectiveViaGoodbyeEngagesFDv1test — delivers a full FDv2 streaming basis, pushes agoodbyewithprotocolFallbackTTL: 0, then asserts the SDK transitions to FDv1 and evaluates flag values from FDv1 dataDescribe alternatives you've considered
Could have added the
protocolFallbackTTLfield directly toPushGoodbye, but a separate method keeps the existing goodbye-without-fallback call sites clean and makes the intent explicit.Additional context
The
unparamlint warning onfdv1FallbackBody'sflagKeyparameter (all callers pass"flag-key") was suppressed with a//nolintdirective since the parameter exists for API flexibility.Link to Devin session: https://app.devin.ai/sessions/2d369b0a4d114c6d9fd948cc39f26a9c