Conversation
…ncing Implements CONNMODE spec 3.5.1-3.5.4: a debounce manager that coalesces rapid platform state changes (network, lifecycle, requested mode) into a single reconciliation callback after a 1-second window. This is a self-contained component with no ConnectivityManager changes. Wiring into ConnectivityManager follows in the next commit. Made-with: Cursor
c91fb3b to
39781ed
Compare
…or FDv2 Integrates the debounce manager into FDv2 data source lifecycle: - FDv2 network/lifecycle listeners route through debounce instead of immediate rebuild (CONNMODE 3.5.1-3.5.4) - Event processor state updated immediately in listeners (not debounced) - Events flushed before background transitions (CONNMODE 3.3.1) - identify() bypasses debounce by destroying/recreating the manager (CONNMODE 3.5.6) - setForceOffline() remains immediate (backward compatibility) - FDv1 code path is unchanged Adds integration tests for debounce coalescing, identify bypass, event flush timing, force-offline bypass, and shutdown cleanup. Made-with: Cursor
39781ed to
aa1b6f3
Compare
…d test timeouts The 1-second StateDebounceManager debounce stacks with AndroidPlatformState's 500ms lifecycle debounce, causing LDClientDataSystemPlatformTest to exceed its 2-second timeouts on the CI emulator. Instead of inflating timeouts, add a package-private debounceMs field to LDConfig so both unit and instrumented tests can inject a short (50ms) debounce window. - Add debounceMs field + getter to LDConfig, Builder setter (package-private) - ConnectivityManager reads debounceMs from LDConfig instead of constructor arg - Remove the second (test-visible) ConnectivityManager constructor - ConnectivityManagerTest and LDClientDataSystemPlatformTest set debounceMs(50) Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 c134ebf. Configure here.
| return; | ||
| if (!autoModeSwitchingConfig.isNetwork()) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Debounce manager gets stale state when switching partially disabled
Medium Severity
When autoModeSwitchingConfig.isNetwork() is false, the connectivityChangeListener returns early without calling dm.setNetworkAvailable(), leaving the StateDebounceManager with stale network state. Symmetrically, when isLifecycle() is false, dm.setForeground() is never called. When the other (enabled) axis later triggers a debounce, handleDebouncedModeStateChange reads both dimensions from the debounce manager, causing resolveMode to use stale data — e.g., resolving to BACKGROUND when the network is actually offline, or STREAMING when the app is actually backgrounded.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c134ebf. Configure here.


Details Coming Soon
Requirements
Related issues
Provide links to any issues in this repository or elsewhere relating to this pull request.
Describe the solution you've provided
Provide a clear and concise description of what you expect to happen.
Describe alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context about the pull request here.
Note
Medium Risk
Changes FDv2 connection-mode switching timing by debouncing lifecycle/network transitions and adding immediate event-processor updates/flushes; regressions could cause delayed or missed data source rebuilds under rapid state changes.
Overview
Implements FDv2 state-change debouncing so rapid network/foreground transitions coalesce into a single data source rebuild (CONNMODE 3.5), via a new
StateDebounceManagerand updatedConnectivityManagerwiring.FDv2 listeners now update
EventProcessorstate immediately, flush events before backgrounding (CONNMODE 3.3.1), bypass debounce onidentify()by recreating the debounce manager, and close the manager on shutdown;setForceOffline()remains immediate.Adds a test-only
LDConfigdebounce override (debounceMs) and expands JVM/instrumented tests to cover debounce coalescing, identify bypass, background flush ordering, and shutdown behavior.Reviewed by Cursor Bugbot for commit c134ebf. Bugbot is set up for automated code reviews on this repo. Configure here.