[No QA] stop syncing app data when the app comes to the foreground - #98888
Conversation
A foreground proves nothing about missed events, so this call is a guess. If the socket died while the app was backgrounded, it resubscribes on foreground and that resubscription already syncs. If the socket survived, nothing was missed. If it is a zombie, the Pusher SDK's own activity timeout drops it and the resubscription syncs there too. The guess costs a duplicate: the foreground sync fires at t=0 and completes in 282ms, the resubscription fires a median 1.08s later, so the coverage resolver finds an empty queue and both go on the wire. Queue flushing on foreground is unchanged, so pending writes still go out immediately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
Hi @adhorodyski. The build isn't working for testing. Could you please check?
cc @mountiny |
|
Can you sync with main? |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
@adhorodyski please sync up with main we need new builds as the min app version got bumped |
|
Updated |
Onboarding - User lands on workspace page instead to home page when signupVersion Number: v9.4.58-0 PR:98888 Action Performed:
Expected Result:User should land on Home page Actual Result:User lands on workspace page Workaround:Unknown Platforms:
Screenshots/VideosVideo.mp4 |
|
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel! Android - Track distance page becomes unresponsive when open start pointVersion Number: 9.4.58-0 PR:98888 Action Performed:
Expected Result:Page should response Actual Result:Page becomes unresponsive, map preview is missing and all tabs (Map ,Manual, GPS, Odometar) does not response Workaround:Unknown Platforms:Which of our officially supported platforms is this issue occurring on?
Screenshots/VideosBug7244379_1787841999328.Recording__1511.mp4Upwork Automation - Do Not Edit |
|
Regression was completed 2 issues were found: |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6756b5663
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
mountiny
left a comment
There was a problem hiding this comment.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
- I verified tests pass on all platforms & I tested again on:
- Android: HybridApp
- Android: mWeb Chrome
- iOS: HybridApp
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
- If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
Screenshots/Videos
Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
|
QA ran full regression testing on these builds and did not find anything specific to these changes. Going to move this ahead and we will carefully observe if anything odd is reported in staging |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.65-0 🚀
|
|
No help site changes are required. I did not create a docs PR. This PR removes one internal network call and changes no user-facing behavior, UI, or copy, so nothing under WhyThe change deletes the Checks I ran:
Since there is no help site PR to review, there is nothing for you to mark |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.4.65-3 🚀
Bundle Size Analysis (Sentry): |

Explanation of Change
Removes the foreground
reconnect()call: every foreground fired aReconnectApp, and the Pusher resubscription fires the same sync a second later. A resubscription proves the socket came back, a foreground proves nothing. Queue flushing stays. Native only — web never fired this listener.Drops 5.0% of pushed
ReconnectApp: 15,568 of 194,497 triggers in2026-08-17T10:30-14:30Z. The 6.7% of foregrounds without a same-minute resubscribe wait for the next event, up to 150s (pusher-jsactivityTimeout+pongTimeout) until #98884 lands.NetworkState.onReachabilityConfirmed()still callsreconnect(): two of its three publishers are hard stops where the socket never dropped, so nothing resubscribes (src/libs/NetworkState.ts:158-162). #2803 owns that duplicate.The issue's 4s dedup window would need a constant re-measured whenever #98884 or #99084 change the trigger set.
Before and after
Run on a matched window: same weekday, same hours UTC.
ReconnectApp[Reconnect] Triggering reconnectionControl, must not move
Gap-detection escalation ran at 0.39%, 141 of 35,720, on 08-12. A rise means full syncs were traded for stalled clients.
Fixed Issues
$ #93966
PROPOSAL:
Tests
npx jest tests/unit/ReconnectTest.ts— 7 pass, includingforeground flushes the queue without syncing.npx jest tests/unit/NetworkStateTest.ts tests/unit/NetworkStateReachabilityTest.ts— reachability recovery still syncs.[Reconnect] Triggering reconnectionfor that foreground, afterPusher re-subscribed to private user channel.command:ReconnectApp "Conflict action determined"and repeat step 3. Onepush, no second determination.shouldReportActivityisfalseon web, so this listener never ran there and this PR does not touch web behaviour.Offline tests
NetworkState.refresh()still runs, and the offline indicator stays up.QA Steps
No QA. This PR has no user-visible UI or copy change. It removes a duplicate background sync so one fewer network request fires on foreground. The behavior is covered by the unit tests and the manual steps in the Tests section.
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
This PR has no visual or UI-facing surface — it deletes one function call from a background sync listener, so there is nothing to capture on any platform.
Android: Native
N/A — no visual change.
Android: mWeb Chrome
N/A — no visual change.
iOS: Native
N/A — no visual change.
iOS: mWeb Safari
N/A — no visual change.
MacOS: Chrome / Safari
N/A — no visual change.