Skip to content

[$175] Web - App does not goes through the sign on page after press Invalidate #106782

Open

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.5.37-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Expensify/issues/684139
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11 - Chrome

Action Performed:

Precondition:
Needs an account on a domain with SAML required.

  1. Sign in on web and open Reports.
  2. Apply a filter, for example status:outstanding, and note the URL.
  3. Open the test tools menu and press Invalidate auth token.

Expected Result:

Verify the app goes through the sign on page and comes back to the same Reports URL with the filter applied.

Actual Result:

App does not goes through the sign on page after press Invalidate

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7290914_1792487478977.E-10099_-_Trim.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 12, 2026
  2. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 12, 2026
  3. melvin-bot commented on Nov 12, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @cretadn22 (External)

  4. changed the title [-]Web - App does not goes through the sign on page after press Invalidate[/-] [+][$175] Web - App does not goes through the sign on page after press Invalidate[/+] on Nov 12, 2026
  5. melvin-bot commented on Nov 12, 2026

    @melvin-bot
  6. MelvinBot commented on Nov 12, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    A SAML-required account was unavailable, so the issue was not reproduced; testing covered only the supplied Gmail account on dev NewDot web. Code investigation suggests deferred token validation rather than a confirmed failure of SAML sign-on.

    Reports with Outstanding status applied and filter dialog open

    Step Status
    1. Sign in and open ReportsUsed the existing authenticated session, completed onboarding, and opened Spend → Reports. Sign-in was performed by CI.
    ✅
    2. Apply status:outstanding and note URLApplied Outstanding through Filters and confirmed “Status: Outstanding.” The browser snapshot still reported the dev-server root URL, so a filter-bearing URL was not verified.
    Reports with Outstanding status applied and filter dialog open
    ✅
    3. Test tools → Invalidate auth tokenRuntime verification blocked: No SAML-required fixture; invalidation was not attempted.
    Preliminary root-cause hypothesis: The action replaces local tokens but does not issue a request or redirect (Session/index.ts:1171–1174). The replacement remains truthy, so the app still considers the user authenticated (useIsAuthenticated.tsx:6–9). Without a subsequent eligible request returning 407, reauthentication need not begin.
    Confidence: High in this code behavior, but low that it explains the reported run without its request/navigation trace.
    ⚠️
    4. Go through sign-on and return to the same filtered Reports URLRuntime verification blocked: Neither the SAML round trip nor exact URL restoration was verified.
    Alternative checked: Ordinary required-SAML sessions should not silently refresh using device credentials: the SAML redirect branch runs first (Reauthentication.ts:223–265). Existing tests explicitly cover preserving the outstanding-filter path during forced SAML sign-out (SessionTest.ts:1483–1508); these were inspected, not executed.
    Recommended next check: Repeat with a confirmed SAML-required, non-support account and capture whether an authenticated request follows invalidation and returns 407. Compare click-only with invalidation followed by an authenticated request. If only the latter triggers sign-on, the immediate-sign-on expectation needs an explicit request trigger. If 407 occurs without sign-on, investigate the reauthentication guards before proposing a fix. No code change is yet verified as the solution.
    ⚠️

    view run · view recording

  7. TassioSales commented on Nov 12, 2026

    @TassioSales

    Proposal

    What is the root cause of that problem?

    In src/libs/actions/Session/index.ts, invalidateAuthToken() exclusively updates local in-memory and Onyx state:

    function invalidateAuthToken() {
        NetworkStore.setAuthToken(INVALID_TOKEN);
        Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN});
    }

    Unlike invalidateCredentials() (which invokes openApp() after clearing credentials), invalidateAuthToken() does not fire any authenticated network request. Because token invalidation is deferred until the next network request, pressing "Invalidate" while viewing Reports does not generate a 407 response. Without a 407, the Reauthentication middleware is never executed, and accounts requiring SAML are not redirected to the SAML sign-in page.

    What changes do you think we should make in order to solve the problem?

    In src/libs/actions/Session/index.ts, trigger an immediate authenticated request (openApp()) within invalidateAuthToken() once the invalid token is set:

    function invalidateAuthToken() {
        NetworkStore.setAuthToken(INVALID_TOKEN);
        Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN}).then(() => {
            openApp();
        });
    }

    When openApp() executes with INVALID_TOKEN, the server returns a 407. For SAML-required accounts, Reauthentication.ts detects account?.isSAMLRequired and invokes redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true), sending the user through the SAML sign-on flow and returning to the current Reports URL with filters preserved.

    What alternative solutions did you explore? (Optional)

    Calling openApp() directly in TestToolMenu.tsx on the Invalidate button's onPress, but placing it in invalidateAuthToken() ensures any test trigger of invalidateAuthToken() immediately tests the reauthentication pipeline.

  8. cocvn157 commented on Nov 13, 2026

    @cocvn157

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On a domain with SAML required, when a user opens Reports, applies a filter (e.g. status:outstanding), opens the Test Tools modal, and presses Invalidate (Authentication status -> Invalidate), nothing happens immediately — the app stays on the Reports page instead of exercising the SAML reauthentication flow (redirecting through the SAML sign-on page and returning to the filtered Reports URL).

    What is the root cause of that problem?

    1. invalidateAuthToken() corrupts the local token without firing an authenticated request to trigger the 407 -> reauthenticate() pipeline:
      In src/libs/actions/Session/index.ts:1171-1174:

      function invalidateAuthToken() {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN});
      }

      Because INVALID_TOKEN ('pizza') is a non-empty string, useIsAuthenticated() remains true. Reauthentication in NewDot is strictly request-driven: Reauthentication.ts:229-243 only runs when an API request is sent with the corrupted token and receives 407 NOT_AUTHENTICATED from the server. When the tester simply presses Invalidate while already on /search?q=status:outstanding (the QA step introduced by PR #100475), no network request is sent, so no 407 occurs and reauthenticate() is never invoked.

    2. Why invalidateCredentials() in src/libs/actions/Session/index.ts:1165-1168 must also be updated if invalidateAuthToken() dispatches openApp():
      Look at invalidateCredentials() right above invalidateAuthToken() (added in PR #96322):

      Promise.all([Onyx.merge(ONYXKEYS.CREDENTIALS, clearedCredentials), Onyx.merge(ONYXKEYS.STASHED_CREDENTIALS, clearedCredentials)]).then(() => {
          invalidateAuthToken();
          openApp();
      });

      If openApp() is added inside invalidateAuthToken() without removing the redundant openApp() in invalidateCredentials(), pressing Destroy (invalidateCredentials()) will fire two concurrent OpenApp requests back-to-back!

    What changes do you think we should make in order to solve the problem?

    1. Update invalidateAuthToken() and invalidateCredentials() in src/libs/actions/Session/index.ts:1165-1174:
      Have invalidateAuthToken() wait for the ONYXKEYS.SESSION merge to settle and then call openApp() so the reauthentication flow is immediately exercised:

      • For standard accounts (with valid CREDENTIALS in Onyx), openApp() gets a 407, Reauthentication.ts silently reauthenticates using autoGeneratedLogin/autoGeneratedPassword, mints a fresh token, and replays OpenApp while keeping the session active.
      • For SAML-required accounts (account?.isSAMLRequired), openApp() gets a 407, Reauthentication.ts:229-243 hits the SAML guard and calls redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true), preserving ONYXKEYS.LAST_VISITED_PATH (/search?q=status:outstanding) and redirecting through the SAML sign-on flow back to the filtered Reports URL.
      • In invalidateCredentials(), delegate the token invalidation + openApp() trigger to invalidateAuthToken() so openApp() is only called once:
      function invalidateCredentials() {
          const clearedCredentials = {autoGeneratedLogin: '', autoGeneratedPassword: ''};
          Promise.all([Onyx.merge(ONYXKEYS.CREDENTIALS, clearedCredentials), Onyx.merge(ONYXKEYS.STASHED_CREDENTIALS, clearedCredentials)]).then(() => {
              invalidateAuthToken();
          });
      }
      
      function invalidateAuthToken() {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN}).then(() => {
              openApp();
          });
      }
    2. Add unit test coverage in tests/actions/SessionTest.ts:

      • Verify invalidateAuthToken() sets INVALID_TOKEN on ONYXKEYS.SESSION and dispatches WRITE_COMMANDS.OPEN_APP once.
      • Verify invalidateCredentials() clears ONYXKEYS.CREDENTIALS and ONYXKEYS.STASHED_CREDENTIALS, sets INVALID_TOKEN, and dispatches WRITE_COMMANDS.OPEN_APP exactly once (not twice).

    What alternative solutions did you explore? (Optional)

    • Triggering a navigation or manual action after pressing Invalidate in QA steps: While performing another action that sends an API command after pressing Invalidate would eventually trigger a 407, firing openApp() inside invalidateAuthToken() (matching invalidateCredentials() from PR #96322) makes the Invalidate test tool immediately exercise the reauthentication pipeline on press without requiring the tester to find another action that triggers a network call.
  9. tranvanminhnhat commented on Nov 13, 2026

    @tranvanminhnhat

    Contributor details
    Your Expensify account email: tranvanminhnhat99@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01867c2936746cf5ca

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On web, when an account on a SAML-required domain navigates to Reports, applies a filter (e.g. status:outstanding), opens the Test Tools menu, and clicks "Invalidate" under Authentication status, the app does not trigger the reauthentication pipeline to navigate through the SAML sign-in page and return to the filtered Reports URL.

    What is the root cause of that problem?

    1. In src/libs/actions/Session/index.ts:1171-1174:

      function invalidateAuthToken() {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN});
      }

      invalidateAuthToken() only mutates in-memory and Onyx auth tokens to INVALID_TOKEN ('pizza'). It does not dispatch any authenticated network request.

    2. In NewDot, the reauthentication flow is strictly request/response-driven:
      Reauthentication.ts:229-243 is only invoked when an in-flight API request is transmitted with an invalid token and the backend returns a 407 NOT_AUTHENTICATED error.

    3. When the tester follows the QA steps introduced in PR [Payment due @huult] Keep the page across a forced SAML re-auth #100475 and simply clicks "Invalidate" while viewing /search?q=status:outstanding, no network request is dispatched. Because no request is sent, no 407 response is received, reauthenticate() never executes, and the SAML redirect (redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true)) is never triggered.

    What changes do you think we should make in order to solve the problem?

    1. In src/libs/actions/Session/index.ts:

      • Update invalidateAuthToken() to dispatch openApp() after Onyx.merge(ONYXKEYS.SESSION, ...) resolves:
        function invalidateAuthToken() {
            NetworkStore.setAuthToken(INVALID_TOKEN);
            Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN}).then(() => {
                openApp();
            });
        }
      • In invalidateCredentials() right above line 1166, remove the redundant openApp() call so that invoking invalidateCredentials() triggers invalidateAuthToken() which dispatches openApp() exactly once, avoiding duplicate concurrent requests:
        function invalidateCredentials() {
            const clearedCredentials = {autoGeneratedLogin: '', autoGeneratedPassword: ''};
            Promise.all([Onyx.merge(ONYXKEYS.CREDENTIALS, clearedCredentials), Onyx.merge(ONYXKEYS.STASHED_CREDENTIALS, clearedCredentials)]).then(() => {
                invalidateAuthToken();
            });
        }
    2. When invalidateAuthToken() triggers openApp(), the server responds with 407 NOT_AUTHENTICATED:

      • For SAML-required accounts (account?.isSAMLRequired), Reauthentication.ts:229-243 hits the SAML branch, triggering redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true).
      • SignInRedirect.ts:111-120 preserves ONYXKEYS.LAST_VISITED_PATH and redirects through the SAML sign-in page back to the filtered Reports URL as expected by PR [Payment due @huult] Keep the page across a forced SAML re-auth #100475.
      • For standard accounts, Reauthentication.ts silently re-authenticates via stored credentials and stays on the active screen.
      • If offline, openApp() is queued by SequentialQueue and automatically executes once connectivity is restored, satisfying the offline QA requirements.

    What alternative solutions did you explore? (Optional)

    • Calling openApp() directly inside TestToolMenu.tsx on the Invalidate button's onPress: Rejected because placing it directly in invalidateAuthToken() ensures all troubleshooting and test tool paths consistently trigger the reauthentication pipeline.

    What automated tests can you add to prevent this from re-occurring?

    In tests/actions/SessionTest.ts:

    • Add a unit test verifying that invalidateAuthToken() sets INVALID_TOKEN and dispatches WRITE_COMMANDS.OPEN_APP once.
    • Add a unit test verifying that invalidateCredentials() clears credentials and dispatches WRITE_COMMANDS.OPEN_APP exactly once.
  10. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. Stephen3453 commented on Nov 13, 2026

    @Stephen3453

    Proposal

    What is the root cause of that problem?

    invalidateAuthToken() in src/libs/actions/Session/index.ts:1171-1174 only calls NetworkStore.setAuthToken(INVALID_TOKEN) and merges the same value into ONYXKEYS.SESSION. It sends no request. In Reauthentication.ts the SAML-required branch (redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true)) runs only when a request comes back 407, so pressing Invalidate on a static Reports page never reaches it. The sibling action invalidateCredentials() (Session/index.ts:1165-1168) works because it calls openApp() right after invalidateAuthToken(). The "Invalidate" button in src/components/TestToolMenu.tsx has no such trigger.

    What changes do you think we should make in order to solve the problem?

    Fire the request from the button, not from the shared action. In TestToolMenu.tsx, change the Invalidate onPress to call invalidateAuthToken() and then openApp().

    • setAuthToken is synchronous, and Reauthentication.ts notes that requests read the NetworkStore token directly, so there is no need to wait for the Onyx.merge promise.
    • invalidateCredentials() stays untouched, so Destroy can never send two OpenApp requests.
    • The Invalidate with delay path (expireSessionWithDelay) keeps its deliberate no-request behaviour.

    Test: in tests/ui/TestToolMenuTest.tsx, which already mocks @userActions/Session, mock openApp too. Press initialSettingsPage.troubleshoot.invalidate and assert invalidateAuthToken and openApp are each called once, in that order. Press ...destroy and assert openApp is not called by the menu (the action does it).

    What alternative solutions did you explore? (Optional)

    TassioSales, cocvn157 and tranvanminhnhat put openApp() inside invalidateAuthToken() (the latter two also edit invalidateCredentials()). That works, but it changes a shared action, needs the invalidateCredentials() refactor to avoid a double request, and adds an unneeded .then on the Onyx merge. Mine is a one-line change in the one caller that wants the request. MelvinBot's note that the request never fires is the same root cause.

  12. bradwue313 commented on Nov 13, 2026

    @bradwue313

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On web with a SAML-required domain, after opening Reports and applying a filter (e.g. status:outstanding), pressing Invalidate (Authentication status -> Invalidate) in the Test Tools menu leaves the user on Reports instead of triggering reauthentication, redirecting through the SAML sign-in flow, and returning to the filtered Reports URL.

    What is the root cause of that problem?

    1. invalidateAuthToken() updates only local token state and fires no authenticated request:
      In src/libs/actions/Session/index.ts#L1171-L1174:
      function invalidateAuthToken() {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN});
      }
      Test Tools calls invalidateAuthToken() directly in src/components/TestToolMenu.tsx#L168-L176. Because no API request is dispatched while sitting idle on Reports, no 407 NOT_AUTHENTICATED response is received.
    2. SAML redirect only executes inside request-driven reauthenticate():
      In src/libs/Reauthentication.ts#L229-L243, the account?.isSAMLRequired && !isSupportSession && !isSupportAuthTokenUsed branch only runs when an API request returns 407 and enters Reauthentication middleware (redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true)). By contrast, its sibling invalidateCredentials() explicitly calls openApp() right after invalidateAuthToken().

    What changes do you think we should make in order to solve the problem?

    Trigger openApp() once when Invalidate is pressed (without breaking expireSessionWithDelay() or causing invalidateCredentials() to dispatch a duplicate openApp()):

    Option A (preferred — keep invalidateAuthToken() composable and avoid double-calling from invalidateCredentials()):
    In src/libs/actions/Session/index.ts:

    • Parameterize invalidateAuthToken(shouldTriggerReauth = true) (or keep invalidateAuthToken local-only and fire openApp() at the TestToolMenu onPress site, passing false from invalidateCredentials() which already awaits credential clearing before calling openApp()):
      function invalidateAuthToken(shouldTriggerReauth = true) {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN}).then(() => {
              if (shouldTriggerReauth) {
                  openApp();
              }
          });
      }
      And in invalidateCredentials(), pass invalidateAuthToken(false) before openApp() so credential clearing still completes before the single openApp() fires.
    • Wait for Onyx.merge(ONYXKEYS.SESSION, ...) to settle before openApp() when triggered via invalidateAuthToken(), so any Onyx subscribers reading SESSION see INVALID_TOKEN consistently while NetworkStore already has INVALID_TOKEN synchronously.
    • Leave expireSessionWithDelay() (src/libs/actions/Session/index.ts#L1179-L1185) untouched so the 15s delayed flow keeps its intended behavior.

    What alternative solutions did we explore? (Optional)

    Calling openApp() unconditionally inside invalidateAuthToken() without updating invalidateCredentials() (Session/index.ts#L1166-L1167), which would invoke openApp() synchronously in invalidateCredentials() and again in the .then() microtask; or firing openApp() only from TestToolMenu.tsx, which wouldn't cover callers invoking Session.invalidateAuthToken() directly.

    Verification

    • Update tests/ui/TestToolMenuTest.tsx and/or tests/actions/SessionTest.ts to assert that triggering Invalidate invalidates SESSION.authToken and fires a single openApp() call, and that invalidateCredentials() still triggers openApp() only once after clearing credentials.

    Contributor details
    Your Expensify account email: aurelis.work@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01678d37eeaca5d26f

  13. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  14. kevinjosh10 commented on Nov 14, 2026

    @kevinjosh10

    Proposal

    What is the root cause of that problem?

    1. invalidateAuthToken() in src/libs/actions/Session/index.ts (lines 1171–1174) only mutates local state without firing an authenticated request:
      function invalidateAuthToken() {
          NetworkStore.setAuthToken(INVALID_TOKEN);
          Onyx.merge(ONYXKEYS.SESSION, {authToken: INVALID_TOKEN, encryptedAuthToken: INVALID_TOKEN});
      }
      Setting NetworkStore.setAuthToken(INVALID_TOKEN) and updating ONYXKEYS.SESSION corrupts the token in memory and local storage, but sends no network request to the backend.
    2. Reauthentication is only triggered when a network request receives a 407 response:
      In src/libs/Network/MainQueue.ts and src/libs/actions/Reauthentication.ts, reauthentication logic (including the SAML redirection via redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true)) executes only when an outgoing authenticated API request fails with an HTTP 407 response. On a static view like Reports with no background polling or active user interactions, no network request is made, so the invalid token sits dormant and the 407 handler is never triggered.
    3. Contrast this with invalidateCredentials() (lines 1156–1168) right above it:
      Promise.all([Onyx.merge(ONYXKEYS.CREDENTIALS, clearedCredentials), Onyx.merge(ONYXKEYS.STASHED_CREDENTIALS, clearedCredentials)]).then(() => {
          invalidateAuthToken();
          openApp();
      });
      invalidateCredentials() explicitly invokes openApp() to dispatch an authenticated request immediately after clearing credentials. In contrast, the "Invalidate" button in src/components/TestToolMenu.tsx (line 124) calls invalidateAuthToken() without firing any request.

    What changes do you think we should make in order to solve the problem?

    1. Trigger openApp() on Invalidate in src/components/TestToolMenu.tsx (lines 120–128):
      Import openApp from @userActions/App in src/components/TestToolMenu.tsx and invoke it after invalidating the token:

      {/* Instantly invalidates a user's local authToken. Useful for testing flows related to reauthentication. */}
      <TestToolRow title={translate('initialSettingsPage.troubleshoot.authenticationStatus')}>
          <Button
              sentryLabel={CONST.SENTRY_LABEL.TEST_TOOL_MENU.INVALIDATE_AUTH_TOKEN}
              size={CONST.BUTTON_SIZE.SMALL}
              onPress={() => {
                  invalidateAuthToken();
                  openApp();
              }}
          >
              <Button.Text>{translate('initialSettingsPage.troubleshoot.invalidate')}</Button.Text>
          </Button>
      </TestToolRow>
      • When openApp() fires with the invalidated NetworkStore token, the backend returns a 407 response.
      • For SAML-required accounts (account?.isSAMLRequired), Reauthentication.ts detects the SAML domain requirement and calls redirectToSignIn(CONST.SIGN_OUT_REASON.SAML_REQUIRED, undefined, true).
      • The current URL (e.g. /reports?status=outstanding) is preserved in ONYXKEYS.LAST_VISITED_PATH, the user transitions through the SAML sign-on flow, and upon successful authentication is routed back to the exact filtered Reports URL.
      • For standard accounts, the 407 is caught and automatically re-authenticated using stored credentials as expected.
    2. Why triggering from TestToolMenu.tsx is superior to modifying invalidateAuthToken directly:

      • Keeps invalidateAuthToken() purely responsible for mutating the local token state, preserving separation of concerns.
      • Prevents invalidateCredentials() from dispatching duplicate openApp() requests.
      • Leaves expireSessionWithDelay() intact without altering its delayed expiration flow.
    3. Automated Unit & UI Tests:

      • In tests/ui/TestToolMenuTest.tsx, add a test verifying that tapping the "Invalidate" button invokes both invalidateAuthToken and openApp in sequence.
      • Verify that tapping "Destroy" still calls invalidateCredentials without extra calls from the menu itself.

    What alternative solutions did you explore? (Optional)

    • Putting openApp() inside invalidateAuthToken() directly:
      Rejected because invalidateCredentials() already calls openApp() explicitly after awaiting the credential clearing promises (Promise.all([Onyx.merge(CREDENTIALS), Onyx.merge(STASHED_CREDENTIALS)])). Putting openApp() inside invalidateAuthToken() would cause invalidateCredentials() to fire two concurrent openApp() calls or would require modifying invalidateCredentials() with boolean flags. Calling openApp() directly from the button onPress in TestToolMenu.tsx is cleaner, safer, and completely avoids side effects.

    Contributor details

    Your Expensify account email: lkevinjosh10@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions