Repository navigation
Detach workspace bank accounts when disabling Payments - #106102
Conversation
Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
|
I created this draft PR from an upstream branch because I don't have push access to your fork. To copy the branch to your fork and push updates: git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-detachWorkspaceBankOnPaymentsDisable
git checkout -b claude-detachWorkspaceBankOnPaymentsDisable upstream/claude-detachWorkspaceBankOnPaymentsDisable
git push -u origin claude-detachWorkspaceBankOnPaymentsDisableYou can then close this draft and open a replacement PR from your fork. |
|
🤖 Web test steps verification results: Verified workspace navigation to Workflows > Payments on dev NewDot web. Bank setup requires an emailed security code, so the connected-bank precondition and detachment regression could not be tested.
|
|
🤖 Android test steps verification results: Verified navigation on standalone Android NewDot and created an admin workspace with Payments enabled, but no bank was connected. Bank setup reached mandatory emailed-code verification; stopped without fabricating bank state.
|
|
@MelvinBot complete checklists and also make the test steps Precondition: You are a workspace admin, Payments is enabled, and a business bank account is connected to the workspace. Open the workspace in New Expensify and go to Workflows > Payments. |
|
Updated the PR description with your precondition, six numbered test steps, expected results, and staging QA instructions. Checked the verified items: issue linkage, written test/QA steps, and added regression tests. Left unverified testing, console, offline, and platform confirmations unchecked: previous Web and Android runs were blocked by emailed-code verification when connecting a bank. The PR remains a draft; the steps are documented as pending execution, not passed. |
|
@MelvinBot conflicts |
|
Confirmed this PR conflicts with No changes were committed or pushed, and no tests were run. The conflicts remain unresolved; completing this requires a checkout with sufficient Git history and a working fetch. |
|
@MelvinBot resolve conflicts |
Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
|
Resolved and pushed the conflicts with
GitHub now reports no merge conflicts. The PR remains a draft; required checks/review are still pending. |
|
|
|
@MelvinBot merge main complete author checklists make the steps section clean with qa steps saying same as tests pls |
Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
|
Merged 280 focused tests, TypeScript, targeted lint, and Storybook passed. Full-suite checks remain incomplete; manual verification remains unverified, as documented in AI Tests. |
|
|
|
@MelvinBot make it ready |
|
Marked Detach workspace bank accounts when disabling Payments ready for review. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| const lastUsedPaymentMethod = typeof lastPaymentMethod === 'string' ? lastPaymentMethod : lastPaymentMethod?.expense?.name; | ||
| const shouldClearBankAccountID = reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO; | ||
|
|
||
| const oldBankAccountID = Object.keys(bankAccountList ?? {}).find((accountID) => { |
There was a problem hiding this comment.
❌ CONSISTENCY-18 (docs)
The early-return guard gained two new clauses (!shouldClearBankAccountID and reimbursementChoice === currentReimbursementChoice), but the comment directly above it only explains the original "the bank account selection is only redundant when the workspace's own bank account is selected" reasoning. The new reimbursementChoice === currentReimbursementChoice clause is non-obvious — it is specifically there so a reimbursement-choice change (e.g. switching MANUAL -> YES with the same bank) is not mistakenly skipped as a redundant bank selection, which is exactly what the new does not skip a reimbursement choice change when the bank account stays the same test covers. Without a note, the next reader cannot tell why unchanged-bank-but-changed-choice must still fall through.
Extend the comment to cover the new conditions, e.g.:
// A bank account can list the workspace in its policyIDs while the workspace itself points at another account,
// so the selection is only redundant when the workspace's own bank account is the selected one too.
// Only skip when the reimbursement choice is unchanged as well, otherwise a choice change (e.g. manual -> direct)
// with the same bank account would be dropped. Never skip when we are disabling Payments.
if (
!shouldClearBankAccountID &&
reimbursementChoice === currentReimbursementChoice &&
oldBankAccountID !== undefined &&
String(bankAccountID) === oldBankAccountID &&
currentAchAccount?.bankAccountID === bankAccountID
) {
return;
}Reviewed at: eb0b7cb | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb0b7cb6f6
ℹ️ 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".
| reimbursementChoice: currentReimbursementChoice ?? null, | ||
| achAccount: { | ||
| reimburser: currentAchAccount?.reimburser ?? null, | ||
| bankAccountID: currentAchAccount?.bankAccountID ?? null, | ||
| accountNumber: currentAchAccount?.accountNumber ?? null, | ||
| addressName: currentAchAccount?.addressName ?? null, | ||
| bankName: currentAchAccount?.bankName ?? null, | ||
| state: currentAchAccount?.state ?? null, | ||
| }, | ||
| achAccount: shouldClearBankAccountID | ||
| ? (currentAchAccount ?? null) |
There was a problem hiding this comment.
Preserve queued re-enables when disable fails
When a user toggles Payments back on before an offline or slow disable request finishes—a flow explicitly exercised by the added test—the second call applies its optimistic manual/no-bank state immediately, but a failure of the first request unconditionally restores the previous reimbursement choice, ACH account, and bank associations. The later re-enable success only clears pending flags, so it never reapplies its state; the old bank therefore appears connected even though the server processed the later enable without a bank ID. Make this rollback conflict-aware or prevent another toggle while the request is pending.
AGENTS.md reference: AGENTS.md:L97-L102
Useful? React with 👍 / 👎.
dylanexpensify
left a comment
There was a problem hiding this comment.
Looks good from a product perspective 👍
| if (oldBankAccountID !== undefined && String(bankAccountID) === oldBankAccountID && currentAchAccount?.bankAccountID === bankAccountID) { | ||
| if ( | ||
| !shouldClearBankAccountID && | ||
| reimbursementChoice === currentReimbursementChoice && |
There was a problem hiding this comment.
Removed the out-of-scope reimbursement-choice condition and its dedicated test. Kept the disable-Payments guard and bank-detachment coverage.
Pushed the update. 279 focused tests, TypeScript, lint, and spelling passed; broader validation limits are documented in AI Tests.
|
@MelvinBot remove test steps 6 and 7 |
Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
|
MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR. Next steps: A human should review the recent commits and resolve the conflicting CI errors manually. |
2 similar comments
|
MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR. Next steps: A human should review the recent commits and resolve the conflicting CI errors manually. |
|
MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR. Next steps: A human should review the recent commits and resolve the conflicting CI errors manually. |
|
Removed test steps 6 and 7 from the PR description. QA remains “Same as tests.” |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-11-10.17-37-42.mp4Android: mWeb Chrome2026-11-10.17-30-00.mp4iOS: HybridApp2026-11-10.17-42-33.mp4iOS: mWeb Safari2026-11-10.17-07-41.mp4MacOS: Chrome / Safari2026-11-10.17-05-45.mp4 |
|
🚧 Beamanator 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/Beamanator in version: 9.5.36-0 🚀
|
|
No FullStory changes needed — this PR only fixes stale workspace bank-account connections when disabling Payments; it adds no new UI, screens, or user properties. |
|
No help site update needed — this PR fixes stale bank-account connections after disabling Payments, restoring expected behavior without adding a new workflow or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.36-0 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
Disabling Payments now immediately clears the workspace ACH connection and removes only that workspace's bank-list associations. The bank account remains available for explicit relinking and other workspaces keep their connections. Failed requests restore the complete previous ACH account and changed association fields.
The Payments toggle passes its existing bank list to the action. Disabling cannot be skipped as a redundant bank selection or reattach the old account. Existing incomplete bank setups remain supported.
AI Tests
Scope reduction (2026-11-10):
prettierscript is unavailable and targeted formatter invocations were not permitted. No new manual UI verification was performed.Main-merge revalidation (2026-11-09):
prettierscript is unavailable. These checks are not claimed as passing.Conflict-resolution revalidation (2026-11-06):
prettierscript remains unavailable; an additional targeted formatting check could not run.Original implementation checks (before merging current main):
npm run prettier -- --log-level erroris unavailable because this checkout has no prettier script; ran the repository'snpm run fmt(oxfmt) instead.check-changedfailed because the run supplied an empty base ref (origin/); explicit compliance checking of the modified Payments component passed.Fixed Issues
$ #105918
PROPOSAL: #105918 (comment)
Tests
Precondition: You are a workspace admin, Payments is enabled, and a business bank account is connected to the workspace.
Offline tests
QA Steps
Same as tests.
PR Author Checklist
Checked on behalf of
FitseTLTas requested. These checkbox updates do not establish completion of unverified manual tests; actual verification results and blockers are recorded in AI Tests.### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
Web verification blocker (not evidence of the fix passing):
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari