Skip to content

Expensify Card - Spend rule changes are saved without confirming the changes #92707

Closed

Description

@applause-bot

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: 9.3.99-2
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #92009
Email or phone of affected tester (no customers): applausetester+ssndjois2jd1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Log in with Expensifail account.
  • Set up workspace with bank account and enable Expensify Card feature.
  • Enable Rules.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Expensify Card.
  3. Click Issue card.
  4. Select user.
  5. Select Virtual card.
  6. Select limit type and enter amount > Next.
  7. Enable Spend rule, then enter any rule details.
  8. Enable Expiration date, then add dates.
  9. Proceed to confirm page.
  10. On confirm page, click Expiration date.
  11. Disable both spend rule and expiration date.
  12. Click RHP back button.
  13. Click Expiration date again.

Expected Result:

Spend rule will be enabled because user clicks back button instead of Confirm button.

Actual Result:

Spend rule is disabled when user clicks back button instead of Confirm button (spend rule changes are saved without confirming it), which is inconsistent with expiration date because expiration date is enabled.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7171634_1780584668035.13.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7171634

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 4, 2026
  2. applause-bot commented on Jun 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/a0f326faad19e577a540755c8bf3206622c16ed76274197cb3e92418d8025c92

  3. melvin-bot commented on Jun 4, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #92009

  4. melvin-bot commented on Jun 4, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Jun 4, 2026

    @MelvinBot
    Contributor

    Proposal

    Summary: The "Add spend rule" toggle commits to Onyx immediately on toggle, while the "Add expiration date" toggle only commits when you press Confirm. So when you edit from the confirmation page and press the back button (which discards), the spend-rule change is already persisted but the expiration change is not — producing the inconsistent state in the report.

    What is the root cause of that problem?

    The two toggles on the Set card rules step use different persistence models:

    When editing from the confirm page, the header back button runs handleBackButtonPress, which navigates back to CONFIRMATION without passing any data — so it neither saves the local expiration state nor reverts the already-saved spendRuleEnabled. Net result of the repro: spendRuleEnabled=false is already persisted (spend rule disappears), while validFrom/validThru are untouched (expiration date stays) — the exact inconsistency reported.

    Why spend rule was built to persist immediately

    The spend rule section navigates to sub-pages (Choose rule, Merchant, Category, Max amount) that read/write the issue-card data, so its state must survive that navigation via Onyx. The expiration date is fully inline, so local state is sufficient for it. That architectural difference is what created the mismatch.

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

    Make the spend-rule edit respect the same "back = discard, Confirm = save" gate the expiration date already follows.

    When the step is entered in edit mode (isEditing), snapshot the spend-rule fields once (spendRuleEnabled, spendRuleOption, spendRuleID, spendRuleValue). In handleBackButtonPress, when isEditing, restore that snapshot via setIssueNewCardStepAndData (passing the snapshot back as data) instead of returning to CONFIRMATION with no data. That way pressing back discards spend-rule changes, matching the expiration date toggle, and Confirm continues to save as it does today.

    What alternative solutions did you explore? (Optional)

    • Make expiration date persist immediately too (mirror the spend rule): this would make both consistent but in the opposite direction — back would then save both, which contradicts the reporter's expected behavior that back should discard.
    Possibly related (same area, different bug)

    Expensify/App#92391 — "Restriction field opens blank Set card rule page when rules are disabled." Same issuing-flow area; not a duplicate.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement this to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. JS00001 commented on Jun 4, 2026

    @JS00001
    Contributor

    Behind a beta

  8. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jun 4, 2026
  9. JS00001 commented on Jun 8, 2026

    @JS00001
    Contributor

    Will work on a fix for this

  10. JS00001 commented on Jun 8, 2026

    @JS00001
    Contributor

    I dont think this is a bug, it feels like the other fields are a bug instead. If the user enters data and goes back, the entered data should still be visible. Going to close this one

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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions