Make Destroy debug button force an observable sign out#96322
Conversation
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
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.
|
|
I looked into the failing checks. There's nothing to fix with a code push — the only failing check is the PR Author Checklist ( Why it's failing: The checklist job reports "0 out of 38 checklist items" completed. That's the human PR Author Checklist in the description, plus the Everything else is green:
To turn the checklist green: complete the PR Author Checklist and fill in the |
Explanation of Change
The "Destroy" row in the Troubleshoot test-tool menu (
invalidateCredentials) previously only cleared the stored auto-generated device credentials. Because the currentauthTokenstayed valid and no request was fired, nothing observable happened — the user stayed signed in until some unrelated action later happened to trigger a reauth, so the button appeared to do nothing.This implements Option 2 from the approved analysis: make "Destroy" force an observable sign out for debugging (e.g. to reproduce auth/logout issues). It now:
authToken(INVALID_TOKEN), likeinvalidateAuthTokendoes.openApp()).With credentials gone and the token corrupted, the request gets a
407, the reauthentication flow hits the missing-credentials guard inReauthentication.ts, andredirectToSignInlands the tester on the login screen. The token corruption + request are chained after the credentialsOnyx.mergeresolves so the reauth flow reads the already-empty credentials. The comment above the button was updated to describe the new behavior."Invalidate" (reauth test — session stays active by design) is unchanged.
Fixed Issues
$ #95592
PROPOSAL: #95592 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate your change worked.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas they need to test for regressions.
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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari