fix(perps): preserve stream cache across Android background teardown - #34504
fix(perps): preserve stream cache across Android background teardown#34504abretonc7s wants to merge 2 commits into
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: This affects:
The change is Android-specific and well-tested with new unit tests. Risk is medium because it changes connection/cache behavior that could affect data freshness in the Perps UI. Performance Test Selection: |
|



Description
Preserves same-session Perps stream caches when Android's background grace-period timer disconnects the transport. Active in-app teardown and account/provider/network changes keep their existing hard-clear behavior.
Stacked on #34474. Review only the two-file diff against
fix/perps-stream-recovery.Why
On a physical Pixel 6, a 25-second background interval expired the Android grace timer and cleared the last visible positions/orders. Foreground recovery therefore had no resident order to paint even though the account/provider session had not changed.
With this change, the identical recipe restored the resident ETH order in
958.624 ms. That run separately exposed the Homepage orders throttle; it is intentionally not fixed here and will be the next stacked PR.Test scenarios
Validation
PerpsConnectionManager.test.ts: 78/78 pass on this exact branch.android-homepage-background-reconnect-v1lost resident cache after 25 seconds backgrounded.android-homepage-background-reconnect-v2rendered the resident order at958.624 ms.Risk
The preservation condition is limited to an Android timer armed while the app is not active. Identity changes and explicit/active teardown continue to clear caches.