-
Notifications
You must be signed in to change notification settings - Fork 39
feat: wire fdv1-fallback capability into node-client, browser, and react-native contract-test entities #1858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a8bbf89
504515c
fb4dcc5
8a0e71d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { | |
| SDKConfigDataSynchronizer, | ||
| SDKConfigModeDefinition, | ||
| SDKConfigParams, | ||
| SDKConfigPollingParams, | ||
| ClientSideTestHook as TestHook, | ||
| ValueType, | ||
| } from '@launchdarkly/js-contract-test-utils/client'; | ||
|
|
@@ -64,7 +65,10 @@ function translateSynchronizer(sync: SDKConfigDataSynchronizer): SynchronizerEnt | |
| return undefined; | ||
| } | ||
|
|
||
| function translateModeDefinition(modeDef: SDKConfigModeDefinition): ModeDefinition { | ||
| function translateModeDefinition( | ||
| modeDef: SDKConfigModeDefinition, | ||
| fdv1Fallback?: SDKConfigPollingParams | null, | ||
| ): ModeDefinition { | ||
| const initializers: InitializerEntry[] = (modeDef.initializers ?? []) | ||
| .map(translateInitializer) | ||
| .filter((x): x is InitializerEntry => x !== undefined); | ||
|
|
@@ -73,6 +77,19 @@ function translateModeDefinition(modeDef: SDKConfigModeDefinition): ModeDefiniti | |
| .map(translateSynchronizer) | ||
| .filter((x): x is SynchronizerEntry => x !== undefined); | ||
|
|
||
| if (fdv1Fallback?.baseUri) { | ||
| return { | ||
| initializers, | ||
| synchronizers, | ||
| fdv1Fallback: { | ||
| ...(fdv1Fallback.pollIntervalMs != null && { | ||
| pollInterval: fdv1Fallback.pollIntervalMs / 1000, | ||
| }), | ||
| endpoints: { pollingBaseUri: fdv1Fallback.baseUri }, | ||
| }, | ||
| }; | ||
| } | ||
|
Comment on lines
+80
to
+91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Fallback polling settings are thrown away when no fallback address is given The fallback polling settings are only kept when an address is present ( Impact: Test runs that configure the fallback with just a poll interval get default behavior instead of the requested one, producing confusing failures. Condition gating on baseUri discards pollIntervalMs-only fallback config
Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| return { initializers, synchronizers }; | ||
| } | ||
|
|
||
|
|
@@ -147,7 +164,7 @@ function makeSdkConfig(options: SDKConfigParams, tag: string) { | |
| initialConnectionMode: 'streaming', | ||
| }; | ||
| dataSystem.connectionModes = { | ||
| streaming: translateModeDefinition(modeDef), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FDv1 fallback skipped for custom modesMedium Severity
Additional Locations (2)Reviewed by Cursor Bugbot for commit f296bbf. Configure here. |
||
| streaming: translateModeDefinition(modeDef, options.dataSystem.fdv1Fallback), | ||
| }; | ||
| applyEndpointOverrides(modeDef); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Tests in this file will be skipped by the LaunchDarkly SDK test harness running | ||
| # the FDv2-feature branch against the React Native client-side SDK. Add a path per line. | ||
| # Lines beginning with '#' are comments. | ||
|
|
||
| # RN's forked EventSource (react-native-sse) fires `open` too late (from | ||
| # onreadystatechange at readyState DONE, not from onprogress at LOADING) and never | ||
| # populates headers on error events, so FDv1 fallback directives carried on stream | ||
| # response headers don't reach the SDK in time (or at all, on the error path). | ||
| streaming/fdv2/FDv1 fallback directive/directive on streaming error engages FDv1 fallback | ||
| streaming/fdv2/FDv1 fallback directive/directive on streaming success applies payload then engages FDv1 | ||
| streaming/fdv2/FDv1 fallback directive/directive without FDv1 fallback configured halts the data system | ||
| tags/FDv1 fallback directive requests | ||
|
Comment on lines
+5
to
+12
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is tracked in a separate ticket |
||


Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Fallback polling settings are ignored when tests use custom connection modes
The fallback polling settings sent by the test harness are only passed along in the default single-mode path (
translateModeDefinition(modeDef, options.dataSystem.fdv1Fallback)atpackages/sdk/browser/contract-tests/entity/src/ClientEntity.ts:167) and are dropped for every custom connection mode, so those runs silently use built-in defaults instead of the values the test asked for.Impact: Tests that combine custom connection modes with fallback settings exercise the wrong endpoint and interval, producing misleading pass/fail results.
How the fallback config is lost in the custom-connection-mode branch
options.dataSystem.fdv1Fallbackis a sibling ofoptions.dataSystem.connectionModeConfig(packages/tooling/contract-test-utils/src/types/ConfigParams.ts:30), but in theconnectionModeConfigbranch each mode is translated withtranslateModeDefinition(modeDef)and no fallback argument (packages/sdk/browser/contract-tests/entity/src/ClientEntity.ts:150,packages/sdk/node-client/contract-tests/src/sdkClientEntity.ts:156,packages/sdk/react-native/contract-tests/entity/src/ClientEntity.ts:149). Withoutfdv1Fallbackon theModeDefinition, the SDK falls back toMODE_TABLEdefaults (300s poll interval, default polling endpoint) inpackages/shared/sdk-client/src/datasource/FDv2DataManagerBase.ts.Additionally, the new code only emits the fallback config when
fdv1Fallback?.baseUriis truthy, so a harness config supplying onlypollIntervalMsis discarded entirely. The server-side entity applies the fallback whenever the object is present (packages/sdk/server-node/contract-tests/src/sdkClientEntity.ts), which is the more faithful translation.Was this helpful? React with 👍 or 👎 to provide feedback.