Skip to content

Fix HybridApp sign-out after server clears the session - #107591

Merged
mollfpr merged 3 commits into
mainfrom
claude-hybridServerClearSignOut-102528-20261120
Nov 23, 2026
Merged

mollfpr merged 3 commits into
mainfrom
claude-hybridServerClearSignOut-102528-20261120

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When you close your account in the mobile app, the server signs you out by clearing all of the app's stored data (Onyx). That clear also wipes two HybridApp values the sign-in flow checks, useNewDotSignInPage and readyToShowAuthScreens, and nothing set them again. So when you came back and entered a valid magic code, the sign-in went through, but the app stayed on the code screen. Tapping Sign In again sent the same, now used, code, which is why you saw "Incorrect magic code".

Closing an account also left Expensify Classic signed in. The Classic sign-out was in a .then on API.write, and a write resolves as soon as it's queued, without the response, so that code never ran.

This replaces #105535, which was reverted for #105679. #105535 moved the Classic sign-out out of the normal sign-out path and into a listener that only ran when a clear removed stored HybridApp data. On a fresh install, the first-launch clear runs before that data exists, so Classic was no longer signed out there. That sign-out is what removes a placeholder user Classic creates at startup. Without it, Classic skips loading the new account, including the setting that keeps it in New Expensify, and the next launch opens Classic.

What this PR does:

  • The normal sign-out path (clearStorageAndRedirect) behaves exactly as on main, including on a fresh install. Its two HybridApp steps now live in one shared function.
  • When an update from the server clears the app's data, whether it comes in a response, over Pusher or in a push notification, the HybridApp sign-in values are reset in the same update as the clear, and Classic is signed out after that update is applied. Because the reset is part of the same update, the clear can't wipe it, and it's skipped if the clear itself fails.
  • closeAccount drops the .then that never ran.
  • New tests in tests/actions/HybridAppSignOutTest.ts cover closing an account and signing back in, a rejected code, failures while applying the clear, clears from Pusher and push notifications, and the fresh-install case from New user-Refreshing the app with unvalidated account signed in redirects to Classic #105679.

Fixed Issues

$ #102528
PROPOSAL: #102528 (comment)

Tests

Test 1: Close an account and sign back in

  1. Sign in with a test account.
  2. Tap your profile picture in the top-right corner, then go to Security > Close account.
  3. Type any reason in the first box.
  4. Type the account's email in the second box.
  5. Tap Close account, then tap Yes, continue in the popup.
  6. On the "Let's make sure it's you" screen, enter the code from your email. The screen continues by itself after the last digit.
  7. Verify the sign-in page opens and shows "Account closed successfully".
  8. Enter the same email and tap Continue.
  9. Enter the new code from your email.
  10. Verify you are signed in as soon as the last digit is entered, with no error.

Test 2: A wrong code doesn't close the account

  1. Follow Test 1, steps 1 to 5.
  2. On the "Let's make sure it's you" screen, enter a wrong 6-digit code.
  3. Verify an error appears and you stay on that screen.
  4. Go back and verify you are still signed in and the app works.
  5. Close the app completely and open it again.
  6. Verify you are still signed in.

Test 3: Open the app again after closing an account

  1. Follow Test 1, steps 1 to 7.
  2. Close the app completely and open it again.
  3. Verify the sign-in page opens.

Test 4: Fresh install with a new account

  1. Delete the app from the device, then install it again.
  2. Open the app, enter an email that has never been used with Expensify, and tap Continue.
  3. Tap Join. If the phone asks to allow notifications, pick either option.
  4. Finish the setup screens until the Home page opens, then tap Inbox.
  5. Close the app completely and open it again.
  6. Verify the app opens in New Expensify, not Expensify Classic.

Test 5: Close one account and sign in to another

Before you start, check that account B shows Switch to Expensify Classic on its Account page. If it doesn't, skip this test and note it. On a dev build, any account has this option under Account > Troubleshoot.

  1. Follow Test 1, steps 1 to 7, with account A.
  2. On the sign-in page, enter account B's email, tap Continue, and enter the code from your email.
  3. Verify you are signed in and the Account page shows account B's email.
  4. Tap Switch to Expensify Classic.
  5. Verify Expensify Classic opens with account B's name and data, and nothing from account A.

Test 6: Normal sign out

  1. Sign in with a test account.
  2. Tap your profile picture in the top-right corner, scroll down, and tap Sign out.
  3. Verify the sign-in page opens.
  4. Sign back in with the same email and the code from your email.
  5. Verify you are signed in.

Test 7: Switching accounts as a copilot

Use an account that was added as a copilot on another account.

  1. Sign in and tap your profile picture in the top-right corner.
  2. Tap Switch and pick the other account.
  3. Verify the app switches to that account and you are not signed out.
  4. Tap Switch again and pick your own account.
  5. Close the app completely and open it again.
  6. Verify you are still signed in to your own account.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: TaduJR <TaduJR@users.noreply.github.com>
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/actions/HybridApp/index.ts 85.50% <100.00%> (+19.99%) ⬆️
src/libs/actions/SignInRedirect.ts 86.56% <100.00%> (+2.50%) ⬆️
src/libs/actions/User.ts 53.08% <ø> (+1.45%) ⬆️
src/libs/actions/OnyxUpdates.ts 98.35% <96.96%> (-0.35%) ⬇️
... and 8 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ❌ fail

Testing was blocked before device interaction because CI cannot obtain the valid magic code required to reopen the account. No account was closed, no screenshots were captured, and no test recording was verified; this is not a confirmed product failure. PR build provenance was unverified, and the available Android environment is standalone NewDot—not HybridApp/OldDot.

Step Status
1. Open the appNot attempted; the complete reauthentication flow was blocked.
⚠️
2. Navigate to Account > Security > Close accountNot attempted following the task-level blocker.
⚠️
3. Enter a closure reasonNot attempted; the close-account screen was not reached.
⚠️
4. Enter the account email and close the accountNot attempted to avoid closing an account that could not subsequently be reopened.
⚠️
5. Verify logoutUnverified; account closure was not performed.
⚠️
6. Enter the closed account’s emailNot attempted; no account was closed.
⚠️
7. Enter a valid magic code and verify successful reopeningBlocked: CI cannot obtain the externally delivered magic code. Requires manual verification with a disposable account on a HybridApp build containing this PR.
⚠️
8. Verify no JS console errorsNot inspected; the requested flow was not executed.
⚠️

view run

@MelvinBot

MelvinBot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

Account reopening could not be tested because the required emailed magic code is inaccessible; the test account was left open and signed in. Only the existing web session was inspected: the running PR build was not independently verified, and HybridApp behavior remains untested.

Dev NewDot web Home before any account closure

Step Status
1. Open the appHome and Account navigation were visible in the existing signed-in session.
Dev NewDot web Home before any account closure
✅
2. Navigate to Account > Security > Close accountNot attempted because subsequent reauthentication could not be completed.
⚠️
3. Enter a closure reasonThe closure form was not opened or modified.
⚠️
4. Enter email and tap Close accountNot attempted to avoid closing an account that could not be reopened. Current validation UI was not verified.
⚠️
5. Verify logoutNo closure or logout attempted; account remains signed in.
⚠️
6. Enter the closed account’s emailNot attempted; no account was closed.
⚠️
7. Enter a valid magic code and verify reopeningBlocked by unavailable inbox access. Successful reopening and absence of “Incorrect magic code” remain unverified.
⚠️
8. Verify no JS console errorsUnverified: the flow was not executed, and supported web tooling does not expose console inspection.
⚠️

view run · no recording available

@TaduJR

TaduJR commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot please make one change on this PR, then push. Don't change anything else.

Compare knip issues against main fails with one new finding: src/libs/actions/HybridApp/index.ts::resetSignInFlow. SignInRedirect.ts was the only file importing it on main, and this PR replaces that call with signOutFromOldDotAndRestartSignIn(). The function stays, because signOutFromOldDotAndRestartSignIn() still calls it. Only the export goes.

In src/libs/actions/HybridApp/index.ts, replace the export block at the end of the file with this. It's the same list without resetSignInFlow, on one line as oxfmt formats it:

-export {
-    getHybridAppSettings,
-    setReadyToShowAuthScreens,
-    resetSignInFlow,
-    getResetSignInFlowUpdate,
-    setUseNewDotSignInPage,
-    closeReactNativeApp,
-    signOutFromOldDot,
-    signOutFromOldDotAndRestartSignIn,
-};
+export {getHybridAppSettings, setReadyToShowAuthScreens, getResetSignInFlowUpdate, setUseNewDotSignInPage, closeReactNativeApp, signOutFromOldDot, signOutFromOldDotAndRestartSignIn};

@TaduJR

TaduJR commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot

Please update the description with the below

Description

Explanation of Change

When you close your account in the mobile app, the server signs you out by clearing all of the app's stored data (Onyx). That clear also wipes two HybridApp values the sign-in flow checks, useNewDotSignInPage and readyToShowAuthScreens, and nothing set them again. So when you came back and entered a valid magic code, the sign-in went through, but the app stayed on the code screen. Tapping Sign In again sent the same, now used, code, which is why you saw "Incorrect magic code".

Closing an account also left Expensify Classic signed in. The Classic sign-out was in a .then on API.write, and a write resolves as soon as it's queued, without the response, so that code never ran.

This replaces #105535, which was reverted for #105679. #105535 moved the Classic sign-out out of the normal sign-out path and into a listener that only ran when a clear removed stored HybridApp data. On a fresh install, the first-launch clear runs before that data exists, so Classic was no longer signed out there. That sign-out is what removes a placeholder user Classic creates at startup. Without it, Classic skips loading the new account, including the setting that keeps it in New Expensify, and the next launch opens Classic.

What this PR does:

  • The normal sign-out path (clearStorageAndRedirect) behaves exactly as on main, including on a fresh install. Its two HybridApp steps now live in one shared function.
  • When an update from the server clears the app's data, whether it comes in a response, over Pusher or in a push notification, the HybridApp sign-in values are reset in the same update as the clear, and Classic is signed out after that update is applied. Because the reset is part of the same update, the clear can't wipe it, and it's skipped if the clear itself fails.
  • closeAccount drops the .then that never ran.
  • New tests in tests/actions/HybridAppSignOutTest.ts cover closing an account and signing back in, a rejected code, failures while applying the clear, clears from Pusher and push notifications, and the fresh-install case from New user-Refreshing the app with unvalidated account signed in redirects to Classic #105679.

Fixed Issues

$ #102528
PROPOSAL: #102528 (comment)

Tests

Test 1: Close an account and sign back in

  1. Sign in with a test account.
  2. Go to Account > Security > Close account.
  3. Type any reason in the first box.
  4. Type the account's email in the second box.
  5. Tap Close account, then tap Yes, continue in the popup.
  6. On the "Let's make sure it's you" screen, enter the code from your email and tap Verify.
  7. Verify the sign-in page opens and shows "Account closed successfully".
  8. Enter the same email and tap Continue.
  9. Enter the new code from your email.
  10. Verify you are signed in as soon as the last digit is entered, with no error.

Test 2: A wrong code doesn't close the account

  1. Follow Test 1, steps 1 to 5.
  2. On the "Let's make sure it's you" screen, enter a wrong 6-digit code and tap Verify.
  3. Verify an error appears and you stay on that screen.
  4. Go back and verify you are still signed in and the app works.
  5. Close the app completely and open it again.
  6. Verify you are still signed in.

Test 3: Open the app again after closing an account

  1. Follow Test 1, steps 1 to 7.
  2. Close the app completely and open it again.
  3. Verify the sign-in page opens.

Test 4: Fresh install with a new account

  1. Delete the app from the device, then install it again.
  2. Open the app, enter an email that has never been used with Expensify, and tap Continue.
  3. Tap Join. If the phone asks to allow notifications, pick either option.
  4. Finish the setup screens until the Inbox opens.
  5. Close the app completely and open it again.
  6. Verify the app opens in New Expensify, not Expensify Classic.

Test 5: Close one account and sign in to another

Before you start, check that account B shows Switch to Expensify Classic on its Account page. If it doesn't, skip this test and note it. On a dev build, any account has this option under Account > Troubleshoot.

  1. Follow Test 1, steps 1 to 7, with account A.
  2. On the sign-in page, enter account B's email, tap Continue, and enter the code from your email.
  3. Verify you are signed in and the Account page shows account B's email.
  4. Tap Switch to Expensify Classic.
  5. Verify Expensify Classic opens with account B's email and data, and nothing from account A.

Test 6: Normal sign out

  1. Sign in with a test account.
  2. Go to Account and tap Sign out.
  3. Verify the sign-in page opens.
  4. Sign back in with the same email and the code from your email.
  5. Verify you are signed in.

Test 7: Switching accounts as a copilot

Use an account that was added as a copilot on another account.

  1. Sign in and go to Account.
  2. Tap Switch and pick the other account.
  3. Verify the app switches to that account and you are not signed out.
  4. Tap Switch again and pick your own account.
  5. Close the app completely and open it again.
  6. Verify you are still signed in to your own account.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: TaduJR <TaduJR@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Pushed d6bfefd: exactly the requested export change, nothing else. The function and internal call remain.

Knip no longer reports resetSignInFlow. Lint, typecheck, spelling, Storybook smoke, and all 41,859 tests passed. Oxfmt passed; no Prettier script exists.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

@TaduJR

TaduJR commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot

Please update the description with the below

Description

Explanation of Change

When you close your account in the mobile app, the server signs you out by clearing all of the app's stored data (Onyx). That clear also wipes two HybridApp values the sign-in flow checks, useNewDotSignInPage and readyToShowAuthScreens, and nothing set them again. So when you came back and entered a valid magic code, the sign-in went through, but the app stayed on the code screen. Tapping Sign In again sent the same, now used, code, which is why you saw "Incorrect magic code".

Closing an account also left Expensify Classic signed in. The Classic sign-out was in a .then on API.write, and a write resolves as soon as it's queued, without the response, so that code never ran.

This replaces #105535, which was reverted for #105679. #105535 moved the Classic sign-out out of the normal sign-out path and into a listener that only ran when a clear removed stored HybridApp data. On a fresh install, the first-launch clear runs before that data exists, so Classic was no longer signed out there. That sign-out is what removes a placeholder user Classic creates at startup. Without it, Classic skips loading the new account, including the setting that keeps it in New Expensify, and the next launch opens Classic.

What this PR does:

  • The normal sign-out path (clearStorageAndRedirect) behaves exactly as on main, including on a fresh install. Its two HybridApp steps now live in one shared function.
  • When an update from the server clears the app's data, whether it comes in a response, over Pusher or in a push notification, the HybridApp sign-in values are reset in the same update as the clear, and Classic is signed out after that update is applied. Because the reset is part of the same update, the clear can't wipe it, and it's skipped if the clear itself fails.
  • closeAccount drops the .then that never ran.
  • New tests in tests/actions/HybridAppSignOutTest.ts cover closing an account and signing back in, a rejected code, failures while applying the clear, clears from Pusher and push notifications, and the fresh-install case from New user-Refreshing the app with unvalidated account signed in redirects to Classic #105679.

Fixed Issues

$ #102528
PROPOSAL: #102528 (comment)

Tests

Test 1: Close an account and sign back in

  1. Sign in with a test account.
  2. Go to Account > Security > Close account.
  3. Type any reason in the first box.
  4. Type the account's email in the second box.
  5. Tap Close account, then tap Yes, continue in the popup.
  6. On the "Let's make sure it's you" screen, enter the code from your email and tap Verify.
  7. Verify the sign-in page opens and shows "Account closed successfully".
  8. Enter the same email and tap Continue.
  9. Enter the new code from your email.
  10. Verify you are signed in as soon as the last digit is entered, with no error.

Test 2: A wrong code doesn't close the account

  1. Follow Test 1, steps 1 to 5.
  2. On the "Let's make sure it's you" screen, enter a wrong 6-digit code and tap Verify.
  3. Verify an error appears and you stay on that screen.
  4. Go back and verify you are still signed in and the app works.
  5. Close the app completely and open it again.
  6. Verify you are still signed in.

Test 3: Open the app again after closing an account

  1. Follow Test 1, steps 1 to 7.
  2. Close the app completely and open it again.
  3. Verify the sign-in page opens.

Test 4: Fresh install with a new account

  1. Delete the app from the device, then install it again.
  2. Open the app, enter an email that has never been used with Expensify, and tap Continue.
  3. Tap Join. If the phone asks to allow notifications, pick either option.
  4. Finish the setup screens until the Inbox opens.
  5. Close the app completely and open it again.
  6. Verify the app opens in New Expensify, not Expensify Classic.

Test 5: Close one account and sign in to another

Before you start, check that account B shows Switch to Expensify Classic on its Account page. If it doesn't, skip this test and note it. On a dev build, any account has this option under Account > Troubleshoot.

  1. Follow Test 1, steps 1 to 7, with account A.
  2. On the sign-in page, enter account B's email, tap Continue, and enter the code from your email.
  3. Verify you are signed in and the Account page shows account B's email.
  4. Tap Switch to Expensify Classic.
  5. Verify Expensify Classic opens with account B's email and data, and nothing from account A.

Test 6: Normal sign out

  1. Sign in with a test account.
  2. Go to Account and tap Sign out.
  3. Verify the sign-in page opens.
  4. Sign back in with the same email and the code from your email.
  5. Verify you are signed in.

Test 7: Switching accounts as a copilot

Use an account that was added as a copilot on another account.

  1. Sign in and go to Account.
  2. Tap Switch and pick the other account.
  3. Verify the app switches to that account and you are not signed out.
  4. Tap Switch again and pick your own account.
  5. Close the app completely and open it again.
  6. Verify you are still signed in to your own account.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the PR description with your supplied text, test steps, and checked checklist. No code changes made.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Verified the PR description already matches your supplied text, test steps, and checked checklist. No further changes needed.


view run

@TaduJR

TaduJR commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please replace the Tests with the below one

Details

Test 1: Close an account and sign back in

  1. Sign in with a test account.
  2. Tap your profile picture in the top-right corner, then go to Security > Close account.
  3. Type any reason in the first box.
  4. Type the account's email in the second box.
  5. Tap Close account, then tap Yes, continue in the popup.
  6. On the "Let's make sure it's you" screen, enter the code from your email. The screen continues by itself after the last digit.
  7. Verify the sign-in page opens and shows "Account closed successfully".
  8. Enter the same email and tap Continue.
  9. Enter the new code from your email.
  10. Verify you are signed in as soon as the last digit is entered, with no error.

Test 2: A wrong code doesn't close the account

  1. Follow Test 1, steps 1 to 5.
  2. On the "Let's make sure it's you" screen, enter a wrong 6-digit code.
  3. Verify an error appears and you stay on that screen.
  4. Go back and verify you are still signed in and the app works.
  5. Close the app completely and open it again.
  6. Verify you are still signed in.

Test 3: Open the app again after closing an account

  1. Follow Test 1, steps 1 to 7.
  2. Close the app completely and open it again.
  3. Verify the sign-in page opens.

Test 4: Fresh install with a new account

  1. Delete the app from the device, then install it again.
  2. Open the app, enter an email that has never been used with Expensify, and tap Continue.
  3. Tap Join. If the phone asks to allow notifications, pick either option.
  4. Finish the setup screens until the Home page opens, then tap Inbox.
  5. Close the app completely and open it again.
  6. Verify the app opens in New Expensify, not Expensify Classic.

Test 5: Close one account and sign in to another

Before you start, check that account B shows Switch to Expensify Classic on its Account page. If it doesn't, skip this test and note it. On a dev build, any account has this option under Account > Troubleshoot.

  1. Follow Test 1, steps 1 to 7, with account A.
  2. On the sign-in page, enter account B's email, tap Continue, and enter the code from your email.
  3. Verify you are signed in and the Account page shows account B's email.
  4. Tap Switch to Expensify Classic.
  5. Verify Expensify Classic opens with account B's name and data, and nothing from account A.

Test 6: Normal sign out

  1. Sign in with a test account.
  2. Tap your profile picture in the top-right corner, scroll down, and tap Sign out.
  3. Verify the sign-in page opens.
  4. Sign back in with the same email and the code from your email.
  5. Verify you are signed in.

Test 7: Switching accounts as a copilot

Use an account that was added as a copilot on another account.

  1. Sign in and tap your profile picture in the top-right corner.
  2. Tap Switch and pick the other account.
  3. Verify the app switches to that account and you are not signed out.
  4. Tap Switch again and pick your own account.
  5. Close the app completely and open it again.
  6. Verify you are still signed in to your own account.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the Tests section with your revised steps. Everything else is unchanged.


view run

@TaduJR

TaduJR commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

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 Issues section 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 Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • 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 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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • 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 using Avatar have 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so 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 main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • 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-Native.mp4
Android: mWeb Chrome
iOS: HybridApp
iOS-Native.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari

@TaduJR

TaduJR commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot

Please make the PR ready.

@MelvinBot
MelvinBot marked this pull request as ready for review November 22, 2026 16:47
@MelvinBot
MelvinBot requested a review from a team as a code owner November 22, 2026 16:47
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Marked the PR as ready for review.


view run

@expensify-chore-bot
expensify-chore-bot Bot removed request for a team November 22, 2026 16:48
@expensify-chore-bot

Copy link
Copy Markdown

@TaduJR 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]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T17:03:09.827326Z d6bfefd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@TaduJR

TaduJR commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please merge main

Co-authored-by: TaduJR <TaduJR@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner November 22, 2026 17:24
@expensify-chore-bot

Copy link
Copy Markdown

@mollfpr 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]

@expensify-chore-bot
expensify-chore-bot Bot removed the request for review from a team November 22, 2026 17:24
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged main into the PR branch and pushed 2be4d33, with no conflicts.

Lint, typecheck, spelling, formatting, Storybook smoke, and all 42,395 tests passed.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

@TaduJR TaduJR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TaduJR

TaduJR commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

All yours @mollfpr

Thanks!

@mollfpr mollfpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@mollfpr
mollfpr merged commit 57b3aef into main Nov 23, 2026
45 of 47 checks passed
@mollfpr
mollfpr deleted the claude-hybridServerClearSignOut-102528-20261120 branch November 23, 2026 14:09
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mollfpr has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mollfpr in version: 9.5.53-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed — this PR restores expected sign-out and sign-in behavior after account closure without introducing a new workflow or making existing help instructions incorrect.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/arosiclair in version: 9.5.53-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants