Skip to content

Rules - "Apply to existing unsubmitted expenses" does not apply rules to existing expenses #81091

Closed

Description

@mitarachim

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.11-17
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: #80851
Email or phone of affected tester (no customers): dojnsijsonijdisjnsj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Rules are enabled.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with Apple as merchant.
  4. Go to workspace settings > Rules.
  5. Click Add merchant rule.
  6. Click Merchant in "For expenses with:" > enter Apple > click Save.
  7. Click Merchant in "Apply these updates:" > enter Banana.
  8. Enable "Apply to existing unsubmitted expenses"
  9. Click Add merchant rule.
  10. Open the expense created in Step 3.

Expected Result:

Merchant will change to Banana as "Apply to existing unsubmitted expenses" is enabled in Step 8.

Actual Result:

Merchant does not change to Banana after enabling "Apply to existing unsubmitted expenses" in Step 8.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7062464_1769823112846.9.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    on Jan 31, 2026
  2. added
    Daily
    Bug
    DeployBlocker
    on Jan 31, 2026
  3. melvin-bot commented on Jan 31, 2026

    @melvin-bot

    @JS00001 recently merged #80851, but they are OOO right now, so I'll auto-assign someone else.

  4. melvin-bot commented on Jan 31, 2026

    @melvin-bot

    Triggered auto assignment to @brianlee-expensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. melvin-bot commented on Jan 31, 2026

    @melvin-bot

    Triggered auto assignment to @stitesExpensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  6. melvin-bot commented on Jan 31, 2026

    @melvin-bot

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

  7. github-actions commented on Jan 31, 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.
  8. OSBotify commented on Jan 31, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Backend bug
    Causing PR: #80851 - "Allow admins to apply rule changes to existing unsubmitted expenses" by @luacmartins (High confidence)
    Related Issues: #80525

    Recommendation: NEEDS INVESTIGATION (Backend)

    The frontend implementation is correct and properly sends the shouldUpdateMatchingTransactions parameter to the API. However, the backend is not processing this parameter to actually update matching transactions. This requires investigation and a fix in the backend repository (Web-Expensify).

    Labels: Removing DeployBlockerCash and keeping DeployBlocker since this is a backend issue that requires a backend fix.

    📋 Detailed Analysis

    Evidence

    PR #80851 added the "Apply to existing unsubmitted expenses" toggle to the merchant rule form. The PR was merged on 2026-01-29 and is included in the current staging deploy (9.3.11-17).

    The issue is reproducible on staging but not in production (N/A - new feature). This confirms the bug was introduced by this PR.

    Verification

    Frontend Implementation (Correct):

    1. src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx - Implements the toggle UI (lines 368-375)
    2. The toggle state (shouldUpdateMatchingTransactions) is correctly passed to setPolicyCodingRule() function (line 196)
    3. src/libs/actions/Policy/Rules.ts - The setPolicyCodingRule() function correctly passes the parameter to the API (line 213)
    4. src/libs/API/parameters/SetPolicyCodingRuleParams.ts - Parameter is properly defined in the API types

    Backend Implementation (Incorrect):
    The API command SetPolicyCodingRule receives the shouldUpdateMatchingTransactions parameter but does not apply the rule to existing unsubmitted expenses.

    Root Cause

    The frontend sends the correct parameter to the backend API:

    const parameters: SetPolicyCodingRuleParams = {
        policyID,
        codingRuleID: targetRuleID,
        codingRuleValue: JSON.stringify(ruleForAPI),
        shouldUpdateMatchingTransactions,  // ✅ Correctly sent
    };

    However, the backend SetPolicyCodingRule API command is not implementing the logic to:

    1. Find existing unsubmitted transactions matching the rule criteria
    2. Apply the rule updates to those transactions

    This is purely a backend implementation gap. The App repository code is working as designed.

    cc @luacmartins @brianlee-expensify @stitesExpensify

  9. removed
    DeployBlockerCash
    on Jan 31, 2026
  10. JS00001 commented on Feb 2, 2026

    @JS00001
    Contributor

    Feature is on a beta, and the BE is not deployed for this feature yet

  11. self-assigned this
    on Feb 2, 2026
  12. removed
    Hourly
    DeployBlocker
    on Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions