feat: FDv2 contract test wiring, suppressions, and example app, cleanup configuration exports.#1225
Conversation
…xtensions Add InitializerEntry/SynchronizerEntry types for type-safe mode definitions, refine protocolHandler validation to use isNullish for version/target fields, add connectionModes config option, split validator arrays for initializers vs synchronizers, and extend DataManager with optional streaming/flush methods.
Add applyChanges method to FlagManager and FlagPersistence that handles full replacement, partial upsert, and no-change persistence in a single call, designed for the FDv2 data path.
Add SourceFactoryProvider that converts declarative InitializerEntry and SynchronizerEntry config into concrete initializer factories and synchronizer slots, with support for per-entry endpoint and interval overrides.
…data-manager-base
…cycle Add shared data manager that orchestrates FDv2 connection mode switching, state debouncing, streaming control, and data source lifecycle management. Implements the DataManager interface with support for foreground/background modes, forced/automatic streaming, and flush callbacks.
Conditionally use FDv2DataManagerBase when dataSystem config is present, falling back to BrowserDataManager for FDv1. Update CI bundle size limits to account for new FDv2 code paths.
Add FDv2 config types to contract-test-utils, translate FDv2 connection mode parameters in ClientEntity, add test suppressions for FDv2-specific endpoint changes, and include an interactive FDv2 browser example app.
- Fix ping handler to use per-entry endpoint-overridden requestor and the factory's selector getter (sg) for fresh selectors on each ping - Extract duplicated streaming base config into shared buildStreamingBase helper - Restructure SourceFactoryContext to group polling/streaming config into nested objects (polling.paths, polling.intervalSeconds, streaming.paths, streaming.initialReconnectDelaySeconds) - Resolve merge conflict in FDv2DataSource (warn -> debug)
Adapt factory context construction to use nested polling/streaming config objects and remove selectorGetter from the context (now passed directly via factory sg parameter).
Account for new FDv2 SourceFactoryProvider and related code paths.
…lient-integration
…contract-tests-and-example
… checks Push applyChanges down through the flag manager layers so the FDv2 path no longer routes through FDv1's upsert (which has version checks and inactive-context guards). FlagStore.applyPartial inserts without version comparison, and FlagUpdater.applyChanges sets the active context directly and emits change events.
…data-manager-base
…lient-integration
…contract-tests-and-example
…er-apply-changes # Conflicts: # packages/shared/sdk-client/src/datasource/fdv2/FDv2DataSource.ts
…er-base # Conflicts: # packages/shared/sdk-client/src/index.ts
…lient-integration
…contract-tests-and-example
Account for new FDv2 applyChanges code in FlagUpdater/FlagStore that flows into the browser SDK bundle.
…data-manager-base
…lient-integration
…contract-tests-and-example
…data-manager-base
…lient-integration
…contract-tests-and-example
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
|
@launchdarkly/js-client-sdk-common size report |
There was a problem hiding this comment.
Temporary app for testing FDv2 functionality.
loadEnvFile('.env') fails when built from the repo root via yarn
workspaces. Use import.meta.url to resolve the path relative to the
config file's directory.
Removed the conditional assignment of payloadFilterKey from options.dataSystem.
- Set serviceEndpoints (streaming/polling/events) unconditionally before FDv1/FDv2 branching so FDv2 path always has correct endpoints - Hoist payloadFilter out of connectionModeConfig block to dataSystem level - Add proper return types to translate functions (InitializerEntry, SynchronizerEntry, ModeDefinition) with type guard filters - Fix example-fdv2 homepage URL in package.json - Add temporary file comment to example app
Export InitializerEntry, SynchronizerEntry, ModeDefinition, ManualModeSwitching, FDv2ConnectionMode, and data source entry types so users and contract tests can properly type connectionModes config.
…oregroundConnectionMode - Add EAP disclaimer to all public FDv2 types (FDv2ConnectionMode, EndpointConfig, data source entries, ModeDefinition, ManualModeSwitching, AutomaticModeSwitchingConfig, LDClientDataSystemOptions) - Remove backgroundConnectionMode from public LDClientDataSystemOptions - Move PlatformDataSystemDefaults from api/ to internal datasource/ - Add InternalDataSystemOptions extending the public type with backgroundConnectionMode and foregroundConnectionMode (both populated from platform defaults, not user-configurable) - Export FDv2 configuration types from browser SDK common.ts
…connectionModeConfig
Check for options.dataSystem presence (not just connectionModeConfig)
so the SDK activates FDv2 even when the test harness sends
{ useDefaultDataSystem: true } without custom connection modes.
Summary
SDKConfigConnectionModeConfig,SDKConfigModeDefinition) to contract-test-utilsClientEntity— mapsinitialConnectionModetoManualModeSwitchingandcustomConnectionModestoconnectionModesNote
Medium Risk
Medium risk because it changes how client-side contract tests and SDK option validation/exports represent FDv2
dataSystemconfiguration, which can affect initialization and endpoint selection. Most changes are additive/internal, plus a new example workspace and test suppressions.Overview
FDv2 contract tests now accept and translate FDv2 data-system config.
ClientEntitymaps newdataSystem.connectionModeConfiginputs into SDKdataSystemoptions (manual initial mode + custom mode table) and propagates per-entry endpoint overrides into legacybaseUri/streamUrifor compatibility; it also adjustsuseReporthandling.Internal FDv2 config surface is reorganized/clarified. Platform-default types (
PlatformDataSystemDefaults) and internal-only fields (InternalDataSystemOptionsincluding foreground/background modes) are moved todatasource/LDClientDataSystemOptions, with validation and tests updated accordingly, and FDv2 datasource types are re-exported from the browser package.Adds supporting artifacts. Introduces
suppressions_datamode_changes.txtfor FDv2-specific contract-test expectation drift, adds a newpackages/sdk/browser/example-fdv2workspace with build/test wiring (Playwright) for interactive FDv2 mode/streaming checks, and updates.gitignoreand rootpackage.jsonworkspaces.Written by Cursor Bugbot for commit f3446bf. This will update automatically on new commits. Configure here.