Skip to content

feat: support per-mode FDv1 fallback configuration#1246

Merged
kinyoklion merged 5 commits intomainfrom
rlamb/sdk-2127/fdv1-fallback-configuration
Apr 7, 2026
Merged

feat: support per-mode FDv1 fallback configuration#1246
kinyoklion merged 5 commits intomainfrom
rlamb/sdk-2127/fdv1-fallback-configuration

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented Apr 6, 2026

The FDv1 fallback polling interval and endpoints are now configurable per connection mode instead of using a single global pollInterval. Background mode defaults to 1 hour, foreground modes default to 5 minutes. When a user overrides a mode without specifying fdv1Fallback, the built-in default is preserved.


Note

Medium Risk
Moderate risk because it changes how the FDv1 fallback synchronizer is constructed (poll interval and service endpoints) based on per-mode configuration, which could affect data sync behavior across modes. Changes are scoped and covered by new validation and data manager tests.

Overview
Adds per-connection-mode configuration for the FDv1 polling fallback via a new ModeDefinition.fdv1Fallback (poll interval + endpoint overrides) and exports FDv1FallbackConfig.

Updates the built-in MODE_TABLE to include FDv1 fallback defaults (5 min for foreground modes, 1 hr for background) and extends validation (modeDefinitionValidators, recordOf defaults precedence, and top-level dataSystem defaults) so partial mode overrides preserve these built-in fallback defaults.

Changes FDv2DataManagerBase to build the FDv1 fallback synchronizer using the mode’s fdv1Fallback poll interval and optional per-mode ServiceEndpoints, and adds tests covering defaulting/merging and correct poll interval selection for background mode and endpoint-only overrides.

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


Open with Devin

The FDv1 fallback polling interval and endpoints are now configurable
per connection mode instead of using a single global pollInterval.
Background mode defaults to 1 hour, foreground modes default to 5
minutes. When a user overrides a mode without specifying fdv1Fallback,
the built-in default is preserved.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

@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 Apr 6, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

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

@kinyoklion
Copy link
Copy Markdown
Member Author

bugbot review

@kinyoklion kinyoklion marked this pull request as ready for review April 6, 2026 21:30
@kinyoklion kinyoklion requested a review from a team as a code owner April 6, 2026 21:30
cursor[bot]

This comment was marked as resolved.

@kinyoklion kinyoklion marked this pull request as draft April 6, 2026 21:31
A partial fdv1Fallback override (e.g. only endpoints) no longer discards
the mode's default pollInterval. The merge now spreads the default
fallback config under the user override at the field level.
@kinyoklion
Copy link
Copy Markdown
Member Author

bugbot review

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

Reviewed by Cursor Bugbot for commit 118f816. Configure here.

@kinyoklion kinyoklion marked this pull request as ready for review April 6, 2026 22:05
setFlushCallback(callback: () => void): void;
}

function mergeModeTables(
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.

Wouldn't the validator already handle most of what this function is doing?

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.

Not as it is, but I am looking into it.

There was already a mode merge for modes that weren't defined.
There are defaults for incorrect definitions.
But not validation time defaults exactly.

@joker23
Copy link
Copy Markdown
Contributor

joker23 commented Apr 6, 2026

going to approve since the potential validator redundancy comment should be a nit imo

Wire MODE_TABLE as the default for connectionModes in the dataSystem
validator so per-mode fdv1Fallback defaults (pollInterval, endpoints)
are filled in during validation. This removes the mergeModeTables
function and restores the simple spread merge in FDv2DataManagerBase.

Also adds a defaults option to recordOf (matching validatorOf pattern)
for compound validators that need built-in defaults.
@kinyoklion kinyoklion marked this pull request as draft April 6, 2026 23:07
Add direct unit tests for the recordOf built-in defaults option in
validateOptions.test.ts. Add integration tests in
LDClientDataSystemOptions.test.ts verifying fdv1Fallback defaults flow
through the full dataSystem validation pipeline.
Remove the FDv2DataManagerBase test that hardcoded validated output
instead of testing the actual validation path.

Add comprehensive fdv1Fallback permutation tests to the dataSystem
validation suite covering: interval only, endpoints only, both, empty
object, non-number pollInterval, non-string endpoint URIs, and
non-object fdv1Fallback. Each verifies that defaults are filled in
and invalid values are dropped with warnings.
@kinyoklion kinyoklion marked this pull request as ready for review April 7, 2026 16:12
@joker23 joker23 self-requested a review April 7, 2026 16:16
Copy link
Copy Markdown
Contributor

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

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 4 additional findings.

Open in Devin Review

@kinyoklion kinyoklion merged commit 9956bce into main Apr 7, 2026
45 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-2127/fdv1-fallback-configuration branch April 7, 2026 16:24
@github-actions github-actions bot mentioned this pull request Apr 6, 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