feat: Thread FDv1 fallback TTL through polling and streaming data sources - #1806
feat: Thread FDv1 fallback TTL through polling and streaming data sources#1806joker23 wants to merge 12 commits into
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
|
@cursor review |
e4fa9cb to
1400310
Compare
|
@cursor review |
46de8d4 to
6604149
Compare
|
@cursor review |
|
@cursor review |
29aefb7 to
73eeb30
Compare
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 { |
There was a problem hiding this comment.
replacing with
…rces This commit will add in fallback TTL reading support as well as allow RN native event source read headers.
e95c2f2 to
005c842
Compare
This will allow us to resolve directives that should override the fallback behavior such as goodbye or error
005c842 to
adfcb4d
Compare
| // Recoverable error: save it and retry if attempts remain | ||
| lastResult = result; | ||
|
|
||
| if (attempt < maxRetries) { |
There was a problem hiding this comment.
We should be checking the fallback before the retries.
|
Probably makes sense to wait for @kinyoklion's review since he left a comment. |
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
Medium Risk
Changes FDv2 data-source orchestration, selector lifetime, and when clients fall back to FDv1—behavior-critical paths with broad test coverage but real production impact if directives are misread.
Overview
Adds centralized FDv1 fallback directive parsing (
x-ld-fd-fallback,x-ld-fd-fallback-ttlin seconds → ms, plus in-bandprotocolFallbackTTLon goodbye) and threadsFallbackDirectivethroughFDv2SourceResulthelpers instead of a bare boolean.Polling reads directives on every response; a goodbye paired with fallback is reported as terminal_error so the orchestrator switches off FDv2. Polling initializer skips retries when a recoverable error carries a fallback directive.
Streaming defers fallback from
onopenheaders until the next queued result (pendingFallback/resolveFallback/putWithFallback), merges deferred TTL into ping-triggered polls without mutating the poll result object, and clears committed/pending fallback on clean reconnect. Error, malformed JSON, ping failure, and error-filter paths can surface deferred fallback with TTL.Orchestrator (
FDv2DataSource) checks FDv1 fallback after all result handling so a transfer-none changeSet withfdv1Fallback: truestops the initializer chain.FDv2DataManagerBaseno longer clears the selector when anonepayload arrives (e.g. HTTP 304).CI bumps
@launchdarkly/js-client-sdk-commonESM size limit 39300 → 41500.Reviewed by Cursor Bugbot for commit 0f10c0e. Bugbot is set up for automated code reviews on this repo. Configure here.