Skip to content

feat: Thread FDv1 fallback TTL through polling and streaming data sources - #1806

Merged
joker23 merged 13 commits into
mainfrom
skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading
Aug 13, 2026
Merged

feat: Thread FDv1 fallback TTL through polling and streaming data sources#1806
joker23 merged 13 commits into
mainfrom
skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading

Conversation

@joker23

@joker23 joker23 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

BEGIN_COMMIT_OVERRIDE
chore: Thread FDv1 fallback TTL through polling and streaming data sources
END_COMMIT_OVERRIDE

This commit will add in fallback TTL reading support as well as allow RN native event source read headers.

NOTE: while working this PR, I found a lot of gaps in the RN eventsource. Internally tracked in ticket 2721 in sdk project.


Note

Overview
Extends FDv2 polling and streaming so FDv1 fallback directives carry optional TTL (x-ld-fd-fallback / x-ld-fd-fallback-ttl, plus in-band protocolFallbackTTL on goodbye). Result builders now take a shared FallbackDirective instead of a bare boolean, and header TTL is interpreted in seconds and converted to milliseconds.

Orchestration and data manager: FDv2DataSource checks fdv1Fallback on any initializer result (including transfer-none / HTTP 304-style payloads) and stops the initializer chain when the server directs FDv1. FDv2DataManagerBase no longer overwrites the stored selector when a none payload arrives without state, so a prior full payload’s basis survives 304/none confirmations.

Polling: Goodbye paired with a fallback directive is surfaced as terminal_error so the orchestrator moves off FDv1; recoverable errors with fallback skip initializer retries. Streaming: Open headers defer fallback until the next queued result; reconnect without fallback clears pending/committed fallback; ping-triggered polls merge deferred TTL without mutating the handler’s result object.

CI package size limit for @launchdarkly/js-client-sdk-common is raised from 39300 to 44000 bytes.

Reviewed by Cursor Bugbot for commit 18c0cfd. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 41502 bytes
Compressed size limit: 44000
Uncompressed size: 224541 bytes

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32444 bytes
Compressed size limit: 34000
Uncompressed size: 116232 bytes

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179887 bytes
Compressed size limit: 200000
Uncompressed size: 833430 bytes

@joker23

joker23 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from e4fa9cb to 1400310 Compare July 17, 2026 14:01
@joker23

joker23 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

cursor[bot]

This comment was marked as resolved.

Comment thread packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.ts Outdated
Comment thread .github/workflows/sdk-client.yml Outdated
@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from 46de8d4 to 6604149 Compare July 17, 2026 16:56
@joker23

joker23 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23

joker23 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.ts Outdated
cursor[bot]

This comment was marked as resolved.

Comment thread packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.ts Outdated
@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from 29aefb7 to 73eeb30 Compare July 17, 2026 22:00
@joker23

joker23 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23

joker23 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c01baaa. Configure here.

terminalError,
} from './FDv2SourceResult';

function getFallback(headers: { get(name: string): string | null }): boolean {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replacing with

export function readFallbackDirective(headers: {

@joker23
joker23 marked this pull request as ready for review July 20, 2026 16:55
@joker23
joker23 requested a review from a team as a code owner July 20, 2026 16:55

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Comment thread packages/shared/sdk-client/src/datasource/fdv2/PollingBase.ts Outdated
Comment thread packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts Outdated
Comment thread packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts Outdated
Comment thread packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts Outdated
Comment thread packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts Outdated
Comment thread packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts
cursor[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from e95c2f2 to 005c842 Compare July 22, 2026 15:16
devin-ai-integration[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from 005c842 to adfcb4d Compare July 22, 2026 16:07
devin-ai-integration[bot]

This comment was marked as resolved.

@joker23
joker23 requested a review from tanderson-ld July 22, 2026 16:35
@tanderson-ld

Copy link
Copy Markdown
Contributor

Probably makes sense to wait for @kinyoklion's review since he left a comment.

devin-ai-integration[bot]

This comment was marked as resolved.

@joker23
joker23 requested a review from kinyoklion August 6, 2026 19:21
// A 'none' payload (e.g. an HTTP 304, or a streaming 'none' intent)
// carries no state -- it confirms existing data is still current and
// must not clear a selector already obtained from a prior payload.
if (payload.type !== 'none') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we really need to verify that an intent of none would never change the selector. Because if it did, then I assume we could get drift in the value used for the basis and then trigger a full transfer on a reconnect.

An aside is that a 304 in a browser is a replay, as it is in RN, but maybe it isn't for node client.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that the HTTP library in both cases re-presents the cached values.

@joker23
joker23 force-pushed the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch from 0f10c0e to 92a909d Compare August 13, 2026 14:34
@joker23
joker23 merged commit 65c543f into main Aug 13, 2026
56 checks passed
@joker23
joker23 deleted the skz/SDK-2687/fdv1-fallback-fix-fallback-ttl-source-threading branch August 13, 2026 14:59
@github-actions github-actions Bot mentioned this pull request Aug 13, 2026
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.

3 participants