Skip to content

Expensify card-Error modal when deleting WS is not displayed when physical card exists #97805

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


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

  1. Open Expensify App on iOS
  2. Login with account from Precondition
  3. Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
  4. Go to Workspaces tab.
  5. 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.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7225682_1785858377332.IMG_6404.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7225682

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @allgandalf

Activity

  1. applause-bot commented on Aug 4, 2026

    @applause-bot
    Author

    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

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 4, 2026
  3. MelvinBot commented on Aug 4, 2026

    @MelvinBot
    Contributor

    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 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.

    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 4, 2026
  5. melvin-bot commented on Aug 4, 2026

    @melvin-bot

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

  6. melvin-bot commented on Aug 4, 2026

    @melvin-bot
  7. shubham1206agra commented on Aug 5, 2026

    @shubham1206agra
    Contributor

    Asking for help

  8. added
    InternalRequires API changes or must be handled by Expensify staff
    and removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 5, 2026
  9. allgandalf commented on Aug 6, 2026

    @allgandalf
    Contributor
  10. allgandalf commented on Aug 7, 2026

    @allgandalf
    Contributor
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.DailyKSv2InternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions