Skip to content

feat: FDv2 contract test wiring, suppressions, and example app, cleanup configuration exports.#1225

Merged
kinyoklion merged 94 commits intomainfrom
rlamb/fdv2-contract-tests-and-example
Mar 26, 2026
Merged

feat: FDv2 contract test wiring, suppressions, and example app, cleanup configuration exports.#1225
kinyoklion merged 94 commits intomainfrom
rlamb/fdv2-contract-tests-and-example

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented Mar 25, 2026

Summary

  • Add FDv2 config types (SDKConfigConnectionModeConfig, SDKConfigModeDefinition) to contract-test-utils
  • Translate FDv2 connection mode parameters in ClientEntity — maps initialConnectionMode to ManualModeSwitching and customConnectionModes to connectionModes
  • Add test suppressions file for FDv2-specific endpoint changes
  • Include an interactive FDv2 browser example app with polling/streaming mode switching

Note

Medium Risk
Medium risk because it changes how client-side contract tests and SDK option validation/exports represent FDv2 dataSystem configuration, 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. ClientEntity maps new dataSystem.connectionModeConfig inputs into SDK dataSystem options (manual initial mode + custom mode table) and propagates per-entry endpoint overrides into legacy baseUri/streamUri for compatibility; it also adjusts useReport handling.

Internal FDv2 config surface is reorganized/clarified. Platform-default types (PlatformDataSystemDefaults) and internal-only fields (InternalDataSystemOptions including foreground/background modes) are moved to datasource/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.txt for FDv2-specific contract-test expectation drift, adds a new packages/sdk/browser/example-fdv2 workspace with build/test wiring (Playwright) for interactive FDv2 mode/streaming checks, and updates .gitignore and root package.json workspaces.

Written by Cursor Bugbot for commit f3446bf. This will update automatically on new commits. Configure here.

…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.
…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.
… 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.
…er-apply-changes

# Conflicts:
#	packages/shared/sdk-client/src/datasource/fdv2/FDv2DataSource.ts
…er-base

# Conflicts:
#	packages/shared/sdk-client/src/index.ts
Account for new FDv2 applyChanges code in FlagUpdater/FlagStore that
flows into the browser SDK bundle.
@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.
@kinyoklion kinyoklion marked this pull request as ready for review March 25, 2026 22:32
@kinyoklion kinyoklion requested a review from a team as a code owner March 25, 2026 22:32
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
@kinyoklion kinyoklion changed the title feat: FDv2 contract test wiring, suppressions, and example app feat: FDv2 contract test wiring, suppressions, and example app, cleanup configuration exports. Mar 26, 2026
…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.
Copy link
Copy Markdown

@cursor cursor bot left a comment

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

@kinyoklion kinyoklion merged commit c67c5f6 into main Mar 26, 2026
45 checks passed
@kinyoklion kinyoklion deleted the rlamb/fdv2-contract-tests-and-example branch March 26, 2026 22:57
@github-actions github-actions bot mentioned this pull request Mar 25, 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.

2 participants