Skip to content

chore: add FDv2 recovery primitives to SourceManager and Conditions - #1856

Open
joker23 wants to merge 1 commit into
mainfrom
skz/SDK-2911/fdv1-fallback-fix-recovery-primitives
Open

chore: add FDv2 recovery primitives to SourceManager and Conditions#1856
joker23 wants to merge 1 commit into
mainfrom
skz/SDK-2911/fdv1-fallback-fix-recovery-primitives

Conversation

@joker23

@joker23 joker23 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds SourceManager.fdv2Recovery() (reverses fdv1Fallback() -- blocks FDv1 slots, unblocks non-FDv1 slots, resets the synchronizer index) and a read-only SourceManager.isCurrentSynchronizerFDv1Fallback getter, plus Conditions.createFDv2RecoveryCondition(ttlMs) and a new 'fdv2Recovery' condition type.

These are primitives only -- nothing on main calls them yet. The next PR in this stack wires them into FDv2DataSource's orchestration loop to schedule a return to FDv2 after an FDv1 fallback TTL expires. Ships with unit tests for both new SourceManager members.


Note

Overview
Adds recovery primitives for switching back from FDv1 fallback to FDv2 synchronizers. These are not wired into the orchestration loop yet; a follow-up PR will use them in FDv2DataSource.

SourceManager gains fdv2Recovery() as the inverse of fdv1Fallback(): FDv1 fallback slots are blocked, non-FDv1 slots are unblocked, and the synchronizer index resets so the next pick starts at the primary FDv2 slot. A new isCurrentSynchronizerFDv1Fallback getter reports whether the active synchronizer is the FDv1 fallback (false when no synchronizer has been selected yet).

Conditions extends ConditionType with 'fdv2Recovery' and adds createFDv2RecoveryCondition(ttlMs), a timer that resolves with that type after the TTL—intended to schedule return to FDv2 after an FDv1 fallback period.

Unit tests cover slot state transitions, index reset after recovery, and the FDv1-fallback getter behavior.

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

@joker23 joker23 changed the title skz/SDK 2911/fdv1 fallback fix recovery primitives chore: add FDv2 recovery primitives to SourceManager and Conditions Aug 13, 2026
@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: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@joker23

joker23 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 ab34b76. Configure here.

@joker23
joker23 marked this pull request as ready for review August 13, 2026 16:46
@joker23
joker23 requested a review from a team as a code owner August 13, 2026 16:46

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

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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

* Creates a cancelable timer that resolves with the given {@link ConditionType}
* when it fires. Wraps {@link cancelableTimedPromise} to convert its
* reject-on-timeout semantics into resolve-with-type semantics.
* Wraps {@link cancelableTimedPromise} into a promise that resolves (not rejects)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think I am fond of this comment change.

* - `'recovery'`: reset to the primary synchronizer
*/
export type ConditionType = 'fallback' | 'recovery';
export type ConditionType = 'fallback' | 'recovery' | 'fdv2Recovery';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is the correct modeling.

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