feat: add FDv1AdapterSynchronizer wrapping IDataSynchronizer as IFDv2Synchronizer#540
Open
beekld wants to merge 24 commits into
Open
feat: add FDv1AdapterSynchronizer wrapping IDataSynchronizer as IFDv2Synchronizer#540beekld wants to merge 24 commits into
beekld wants to merge 24 commits into
Conversation
9f04fa3 to
ea3b92b
Compare
1780156 to
479e599
Compare
ea3b92b to
142b2ff
Compare
479e599 to
403bdff
Compare
142b2ff to
7ea2f7c
Compare
403bdff to
20da492
Compare
7ea2f7c to
e2824ec
Compare
20da492 to
95351be
Compare
e2824ec to
f0b2aab
Compare
95351be to
7202ca6
Compare
f0b2aab to
f94ce01
Compare
7202ca6 to
1bcd458
Compare
f94ce01 to
eb28df0
Compare
1bcd458 to
a183532
Compare
eb28df0 to
3e76ae5
Compare
a183532 to
e0396ff
Compare
2 tasks
e0396ff to
cce4172
Compare
2 tasks
cce4172 to
458539d
Compare
af2d13f to
bfe0441
Compare
458539d to
5aace2f
Compare
bfe0441 to
af660a0
Compare
5aace2f to
5988ce1
Compare
18951d8 to
35aa744
Compare
5988ce1 to
88190bc
Compare
beekld
added a commit
that referenced
this pull request
Jun 9, 2026
beekld
added a commit
that referenced
this pull request
Jun 9, 2026
beekld
added a commit
that referenced
this pull request
Jun 11, 2026
beekld
added a commit
that referenced
this pull request
Jun 11, 2026
## Summary Implements the FDv1 fallback directive in the FDv2 data system with TTL-based recovery. - `FDv2SourceResult` carries `std::optional<FDv1FallbackDirective>` with a TTL (default 1h, 0 = indefinite). - Sources parse `X-LD-FD-Fallback-TTL` (header) and `protocolFallbackTTL` (goodbye). - On directive: switch to FDv1 if configured, otherwise disconnect (`kInterrupted`). Schedule retry after TTL. - On TTL elapse: `SourceManager::SwitchBackToFDv2()` re-enables FDv2 (including previously terminal-error-blocked factories), blocks FDv1, restarts synchronizers. End-to-end fallback will work once an FDv1 streaming source is wrapped as an `IFDv2Synchronizer` (#540). ## Test plan - [x] `SourceManager` tests cover the new block/unblock semantics - [x] Source-level tests cover TTL parsing (HTTP + goodbye), default, malformed - [x] Orchestrator tests cover directive flows in initializer/synchronizer paths, TTL elapse rebuild, FDv2 recovery - [x] Full server suite green <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes core flag-data orchestration and protocol fallback behavior; mis-handling could leave clients on the wrong protocol or retry timing, though behavior is heavily tested. > > **Overview** > Adds **server-directed FDv1 fallback** for the FDv2 data path: results now carry an optional `FDv1FallbackDirective` (TTL, default 1h; **0 = stay on FDv1 indefinitely**) instead of a boolean flag. > > **Parsing:** Goodbye JSON gains `protocolFallbackTTL`; polling and streaming read `X-LD-FD-Fallback` / `X-LD-FD-Fallback-TTL`, with body/goodbye directives overriding headers. > > **Orchestration:** On directive, `SourceManager` blocks FDv2 factories and selects an `IsFDv1Fallback()` synchronizer; missing adapter → `kInterrupted` without forcing `kOff`. A cancellable timer calls `SwitchBackToFDv2()` (re-enabling FDv2 factories blocked for terminal errors) and restarts synchronizers. Destructor/`Close()` no longer sets status to `kOff`; retry timers are cancelled on close. > > **Other:** Logging tweaks (initializer/synchronizer start, deduped synchronizer interrupts). Broad unit/orchestrator tests cover TTL parsing, switching, recovery, and edge cases. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 81b1c7f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
beekld
added a commit
that referenced
this pull request
Jun 11, 2026
kinyoklion
reviewed
Jun 11, 2026
kinyoklion
reviewed
Jun 11, 2026
beekld
added a commit
that referenced
this pull request
Jun 11, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2f68933. Configure here.
beekld
added a commit
that referenced
this pull request
Jun 12, 2026
beekld
added a commit
that referenced
this pull request
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds an adapter that wraps any FDv1
IDataSynchronizer(e.g. the existingStreamingDataSource) and presents it as anIFDv2Synchronizer. FDv1Init/Upsertcallbacks delivered through an internalIDestinationare translated intoFDv2SourceResult::ChangeSetresults (kFullforInit,kPartialforUpsert), with empty selectors andfdv1_fallback=false.The orchestrator picks this up after
SwitchToFDv1Fallback()once a factory whoseIsFDv1Fallback()returns true is configured. Wiring the adapter into the public config builders is a separate concern, deferred until the Configuration API work.Test plan
Note
Medium Risk
Touches core flag data sync and fallback behavior with async lifecycle and threading; risk is mitigated by isolation behind IFDv2Synchronizer and broad unit tests, but mis-mapping status or shutdown could affect live updates until config is wired.
Overview
Adds
FDv1AdapterSynchronizer, which wraps an FDv1IDataSynchronizer(e.g. streaming) and exposes it asIFDv2Synchronizerfor FDv2 orchestration and FDv1 fallback paths.An internal
ConvertingDestinationturns FDv1Init/UpsertintoFDv2SourceResult::ChangeSet(kFull/kPartial, empty selectors,fdv1_fallback=false).Next()lazily starts the wrapped source once, queues multiple results in FIFO order, and races close vs. pending work viaWhenAny.DataSourceStatusManagererrors map toInterruptedorTerminalError.The new sources are registered in
CMakeLists.txt. 12 gtest cases cover lifecycle, conversion, queuing, status mapping, and shutdown. Public config wiring is left for a follow-up.Reviewed by Cursor Bugbot for commit 796d25c. Bugbot is set up for automated code reviews on this repo. Configure here.