feat: Wire FDv2 connection-mode resolution in common_client#279
Open
tanderson-ld wants to merge 4 commits into
Open
feat: Wire FDv2 connection-mode resolution in common_client#279tanderson-ld wants to merge 4 commits into
tanderson-ld wants to merge 4 commits into
Conversation
Wires the FDv2 mode-resolution scaffolding (merged via #274) into the common_client runtime path while keeping the FDv1 ConnectionMode enum and all existing public API signatures unchanged. LDCommonClient: - setMode(ConnectionMode) keeps its FDv1 signature and now maps the 3 legacy modes to ResolvedConnectionMode internally before forwarding to DataSourceManager. - New setResolvedMode(ResolvedConnectionMode) is the advanced FDv2 entry point. Documented as EAP / not-stable. No internal caller in this PR; the Flutter SDK's ConnectionManager invokes it in the follow-up flutter PR. - DataSourceFactoriesFn (the public, optional constructor seam) remains typed Map<ConnectionMode, DataSourceFactory> so external callers can still customize streaming + polling. _backgroundFactory is SDK-managed (background is FDv2-only), and _composeFactoriesForManager translates the FDv1 map into the FDv2-keyed Map<FDv2ConnectionMode, DataSourceFactory> consumed by DataSourceManager. DataSourceManager (internal, not publicly exported): - Active mode held as ResolvedConnectionMode. - Factory map is keyed by FDv2ConnectionMode. - ResolvedOffline branches dispatch status as setOffline / networkUnavailable / backgroundDisabled depending on OfflineDetail. Tests updated to match.
This was referenced May 29, 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 2d2ff51. Configure here.
Splits the active mode and offline detail into two fields: - _activeConnectionMode: FDv2ConnectionMode -- drives factory lookup (matches the factory map's key type directly). - _offlineDetail: OfflineDetail -- semantically meaningful only when _activeConnectionMode is FDv2Offline; carries a stale value in other modes and is intentionally only read inside the FDv2Offline arm of _setupConnection. ResolvedConnectionMode is now a true boundary type: consumed by setMode, decomposed into the two fields, then discarded. This removes the .connectionMode getter call previously needed for factory lookup. setMode dedup is rewritten to compare the FDv2 mode and (when offline) the offline detail explicitly, so a redundant call with the same effective state still short-circuits. Constructor initializes _offlineDetail to OfflineSetOffline() as a placeholder; it is overwritten the next time setMode receives a ResolvedOffline value.
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
Wires the FDv2 mode-resolution scaffolding (merged via #274) into the
common_clientruntime path. Keeps the FDv1ConnectionModeenum and all existing public API signatures unchanged.This is the first half of the further split of the original behavior PR (#275, now closed). The follow-up flutter-only PR wires this into the Flutter SDK.
LDCommonClient
setMode(ConnectionMode)keeps its FDv1 signature; internally maps the 3 legacy modes toResolvedConnectionModebefore forwarding toDataSourceManager.setResolvedMode(ResolvedConnectionMode)is the advanced FDv2 entry point. Documented as EAP / not-stable. No internal caller in this PR -- the Flutter SDK'sConnectionManagerinvokes it in the follow-up flutter PR.DataSourceFactoriesFn(the public, optional constructor seam) stays typedMap<ConnectionMode, DataSourceFactory>so external callers can still customize streaming + polling._backgroundFactoryis SDK-managed (background is FDv2-only), and_composeFactoriesForManagertranslates the FDv1 map into the FDv2-keyedMap<FDv2ConnectionMode, DataSourceFactory>consumed byDataSourceManager.DataSourceManager (internal, not publicly exported)
ResolvedConnectionMode.FDv2ConnectionMode.ResolvedOfflinebranches dispatch status assetOffline/networkUnavailable/backgroundDisableddepending onOfflineDetail.Tests updated to match.
Note
Medium Risk
Changes core data-source connection and status behavior (including removal of manager-level network toggling); public API is preserved but internal mode transitions and offline semantics are more complex until the Flutter layer adopts setResolvedMode.
Overview
Wires FDv2 connection-mode resolution into the
common_clientruntime while keeping the publicConnectionModeAPI unchanged.DataSourceManagernow tracksFDv2ConnectionModeplusOfflineDetail, acceptsResolvedConnectionModeviasetMode, and keys factories by FDv2 modes (including background). Offline no longer always means “set offline”:ResolvedOfflinemapsOfflineSetOffline,OfflineNetworkUnavailable, andOfflineBackgroundDisabledto the matching data-source status without starting a connection. InternalsetNetworkAvailableon the manager is removed—network-unavailable behavior is expected to come through resolved offline modes instead.LDCommonClientmaps legacysetMode(ConnectionMode)to resolved modes, adds EAPsetResolvedMode, composes FDv1 custom factories into an FDv2 factory map via_composeFactoriesForManager, and registers an SDK-managed background polling factory.setNetworkAvailabilityno longer touches the data source manager (events only).Tests are updated for FDv2 modes and the new offline status branches.
Reviewed by Cursor Bugbot for commit 0921328. Bugbot is set up for automated code reviews on this repo. Configure here.