You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expensify card-Error modal when deleting WS is not displayed when physical card exists #97805
Version Number: 9.4.49-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:#97318 Email or phone of affected tester (no customers):applausetester+jp_2040826@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iOS 25.5/iPhone 13, Windows 10 /chrome App Component: Workspace Settings
Action Performed:
Preconditions
Login with a new expensifail account
Create new workspace
Set Expensify card to Enable
Add a physical Expensify card
Open Expensify App on iOS
Login with account from Precondition
Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
Go to Workspaces tab.
Click 3-dot menu on the workspace with Expensify Card > Delete workspace > Delete.
Expected Result:
The error modal "Your company still has Expensify Cards. Please reach out to Concierge to remove them." is displayed
Actual Result:
An error modal is not displayed and the workspace gets deleted. The Issue isn't reproducible for a virtual card.
Root Cause: This is a backend / internal issue — the fix is not in the App repo. When you're online, App does not decide whether to block a workspace deletion; it sends the DeleteWorkspace request and only shows the "Your company still has Expensify Cards…" modal if the backend rejects the request. App applies zero physical-vs-virtual card logic anywhere in this flow. So the fact that a virtual card blocks deletion but a physical card does not means the backend's "does this workspace still have open Expensify Cards?" guard is not counting the physical card (most likely because of the card's state after creation, e.g. a not-yet-activated physical card).
Recommended next step: Escalate to an internal engineer with access to the backend DeleteWorkspace/DeletePolicy command (Auth / Web-Expensify) to fix the open-Expensify-Card guard so it also counts physical cards. No App-side change is needed.
Investigation details (App-side, confirmed)
Online path relies entirely on the backend response
The only up-front local block is gated on being offline: DeleteWorkspaceFlow.tsx:114 — hasDeleteWorkspaceExpensifyCardsError = … && !!isOffline. Its comment says this is deliberate: when online, App lets the backend decide.
The mirrored guard in the action (Policy.ts:434-439) is skipped when online, so the real DeleteWorkspace API request is sent.
Online, the error modal only appears if the backend writes an error onto the policy: DeleteWorkspaceFlow.tsx:154-163 — shouldLatchDeleteWorkspaceErrorModal requires policyLatestErrorMessage. If the backend deletes successfully and returns no error, no modal shows and the workspace is gone — exactly the reported behavior.
App never distinguishes physical vs virtual cards here
hasExpensifyCardsEnabledOnWorkspace is a policy-level boolean (areExpensifyCardsEnabled), not a card-type check.
The card filtering used by this flow keys purely off card state, never card type: CardUtils.ts:1218-1223 (isActiveCard inspects card.state, never isVirtual/CARD_TYPE).
Card-type constants exist in App but are not referenced anywhere in the delete-workspace decision.
Why the "Reset and refresh" precondition matters: it clears optimistic/offline state so the delete goes cleanly through the pure online→backend path, making the backend's accept/reject the sole decider. Confirming the exact backend query/state check requires backend access.
Confidence: High that the divergence is backend-side (App has no card-type logic in this flow). The specific mechanism (physical card in a non-counted state) is the most likely explanation but should be verified against the backend guard and a real delete request's logs.
Both touch the same delete-workspace-with-Expensify-Card modal but describe different symptoms; neither covers the physical-card-not-blocking behavior reported here.
Next Steps: This requires a backend fix, so it can't be implemented from the App repo. An internal engineer should take it from here. Reply with @MelvinBot <your feedback> to refine this analysis.
Activity
applause-bot commentedon Aug 4, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/95f82a090a3370ecdcb3e28532c65c9f3444b8ce27d97ac917cf51b6677f1301
MelvinBot commentedon Aug 4, 2026
Issue Analysis
Root Cause: This is a backend / internal issue — the fix is not in the App repo. When you're online, App does not decide whether to block a workspace deletion; it sends the
DeleteWorkspacerequest and only shows the "Your company still has Expensify Cards…" modal if the backend rejects the request. App applies zero physical-vs-virtual card logic anywhere in this flow. So the fact that a virtual card blocks deletion but a physical card does not means the backend's "does this workspace still have open Expensify Cards?" guard is not counting the physical card (most likely because of the card's state after creation, e.g. a not-yet-activated physical card).Recommended next step: Escalate to an internal engineer with access to the backend
DeleteWorkspace/DeletePolicycommand (Auth / Web-Expensify) to fix the open-Expensify-Card guard so it also counts physical cards. No App-side change is needed.Investigation details (App-side, confirmed)
Online path relies entirely on the backend response
DeleteWorkspaceFlow.tsx:114—hasDeleteWorkspaceExpensifyCardsError = … && !!isOffline. Its comment says this is deliberate: when online, App lets the backend decide.Policy.ts:434-439) is skipped when online, so the realDeleteWorkspaceAPI request is sent.DeleteWorkspaceFlow.tsx:154-163—shouldLatchDeleteWorkspaceErrorModalrequirespolicyLatestErrorMessage. If the backend deletes successfully and returns no error, no modal shows and the workspace is gone — exactly the reported behavior.App never distinguishes physical vs virtual cards here
hasExpensifyCardsEnabledOnWorkspaceis a policy-level boolean (areExpensifyCardsEnabled), not a card-type check.CardUtils.ts:1218-1223(isActiveCardinspectscard.state, neverisVirtual/CARD_TYPE).Why the "Reset and refresh" precondition matters: it clears optimistic/offline state so the delete goes cleanly through the pure online→backend path, making the backend's accept/reject the sole decider. Confirming the exact backend query/state check requires backend access.
Confidence: High that the divergence is backend-side (App has no card-type logic in this flow). The specific mechanism (physical card in a non-counted state) is the most likely explanation but should be verified against the backend guard and a real delete request's logs.
Possibly related issues (not duplicates)
Both touch the same delete-workspace-with-Expensify-Card modal but describe different symptoms; neither covers the physical-card-not-blocking behavior reported here.
Next Steps: This requires a backend fix, so it can't be implemented from the App repo. An internal engineer should take it from here. Reply with
@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Aug 4, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)melvin-bot commentedon Aug 4, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022084671970393594376
shubham1206agra commentedon Aug 5, 2026
Asking for help
allgandalf commentedon Aug 6, 2026
asked for expected behaviour on slack https://expensify.slack.com/archives/C086VHWPPUM/p1785987628438459
allgandalf commentedon Aug 7, 2026
this is the expected behaviour for cards not shipped , closing https://expensify.slack.com/archives/C086VHWPPUM/p1786000171589509?thread_ts=1785987628.438459&cid=C086VHWPPUM