Repository navigation
Description
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.31.0
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: #83005
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 11 / Chrome
App Component: Money Requests
Action Performed:
Prerequisite: Account has a workspace with "Rules" enabled.
Prerequisite 2: Account has Self DM.
- Open the staging.new.expensify.com website.
- Navigate to "Workspaces" > "Rules"
- Scroll down to "Merchant" section.
- Click on "Add Merchant Rule"
- In "For expenses with" add any merchant name. (For example: Test)
- In "Apply these updates", add any category, any description, and set reimbursable field to "No".
- Save the just created rule.
- Navigate to Self DM.
- Create a manual expense.
- Click on "Submit it to someone"
- Add the merchant used for the created rule and submit the expense to the workspace where rule was created.
- Open the expense report.
- Note that all updates were correclty applied, but expense is still displayed as "Reimbursable"
- Note that system message shows "Marked the expense as non-reimbursable" despite expense being displayed as reimbursable.
Expected Result:
After submitting a track expense to a workspace, with a merchant used for a rule, all the fields included on the rule should be automatically updated.
Actual Result:
Track expenses are always set to "Reimbursable" when submitted to workspace, despite a rule being created setting the expense to "Non-reimbursable". The rest of the fields are correctly updated.
Also, system message after expense creation, displays a "Marked the expense as non-reimbursable" despite expense being displayed as "Reimbursable".
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Bug7094168_1772666692582.Reimbursable.mp4
Issue Owner
Current Issue Owner: @JS00001Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Mar 5, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83005
melvin-bot commentedon Mar 5, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to @greg-schroeder (
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.github-actions commentedon Mar 5, 2026
👋 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:
OSBotify commentedon Mar 5, 2026
🔍 Investigation Summary
Classification: Backend bug
Causing PR: #83005 - "Enable merchant rules v3" by @luacmartins (High confidence)
Related Issues: None found
Recommendation: ROLL FORWARD
The fix needs to happen in the backend. PR #83005 only removed a frontend check that was hiding merchant rules from production - it did not introduce the bug, it merely exposed an existing backend issue.
Reverting #83005 would only hide the merchant rules feature again from users, it would not fix the underlying backend bug. The backend needs to be fixed to correctly apply the reimbursable field from rules when processing track expenses.
Labels: Removing
DeployBlockerCashlabel as this requires a backend fix, keepingDeployBlockerlabel.📋 Detailed Analysis
Evidence
PR #83005 merged on 2026-03-03 and only made one change: removed the production environment check that was hiding merchant rules. The PR diff shows:
This change simply enabled visibility of an existing feature - it did not modify any business logic for applying rules.
Verification
I traced the code path for track expenses being submitted to workspaces:
Frontend (App) -
src/libs/actions/IOU/index.ts:categorizeTrackedExpense()functionreimbursablefield is correctly passed intransactionParams(lines 7555-7573)CATEGORIZE_TRACKED_EXPENSEAPI commandBackend responsibility:
Root Cause
The issue description states:
This proves the backend IS processing the rule (hence the correct system message) but has a bug where it's not persisting the reimbursable field update to the transaction itself. This is a backend data consistency issue.
The bug was always present in the backend code but was not visible until PR #83005 enabled the feature for production users. This is analogous to turning on a light switch and discovering a pre-existing wiring issue - the switch didn't cause the problem, it revealed it.
MelvinBot commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a track expense is submitted to a workspace that has a merchant rule with reimbursable set to "No", the expense still displays as "Reimbursable". The system message correctly shows "Marked the expense as non-reimbursable", indicating the rule is being processed, but the actual transaction field is not updated. Other rule fields (category, description) are applied correctly.
What is the root cause of that problem?
There are two contributing issues, both on the frontend:
1. Early return skips policy default reimbursable (
IOURequestStepConfirmation.tsx:392-393)When submitting a tracked expense to a workspace (
isMovingTransactionFromTrackExpense = true), an early return preventssetMoneyRequestReimbursablefrom being called with the target workspace'sdefaultReimbursablevalue. The tracked expense keepsreimbursable: truefrom its original self-DM context:2. Hardcoded
reimbursable: truein API params (IOU/index.ts:6156)In
convertTrackedExpenseToRequest, the params forADD_TRACKED_EXPENSE_TO_POLICYhardcodereimbursable: true. While...workspaceParamsis spread after (line 6164),workspaceParams.reimbursable(line 6719) also comes from the tracked transaction which is alwaystrue:The backend then applies the merchant rule and generates the system message ("Marked the expense as non-reimbursable") via a
MODIFIED_EXPENSEaction withpolicyRulesModifiedFields.reimbursable = false. However, the success data (line 2932-2938) only clearspendingActionandpendingFields— it does NOT update the transaction'sreimbursablefield. The optimisticreimbursable: truepersists on the client.The fact that category and description are applied correctly suggests the backend does push those fields back, but the
reimbursablefield update from the backend either isn't included in the Onyx push or gets lost.What changes do you think we should make in order to solve the problem?
Fix the early return in
IOURequestStepConfirmation.tsx:392-393— Remove or modify the early return so thatsetMoneyRequestReimbursableis still called withcalculateDefaultReimbursable()even whenisMovingTransactionFromTrackExpenseis true. This ensures the target workspace'sdefaultReimbursablepolicy setting is applied to the draft transaction before submission.This is consistent with how
defaultBillableis handled in theuseEffectjust above (lines 380-389), which also has an early return forisMovingTransactionFromTrackExpense— that early return should similarly be removed for consistency, but the reimbursable one is the critical fix.Additionally, the backend should be investigated to confirm that when a merchant rule applies
reimbursable: false, the updated transaction value is included in the Onyx push response (since the system message proves the rule is matched and processed).What alternative solutions did you explore? (Optional)
Only fix the backend: Since the backend generates the MODIFIED_EXPENSE action correctly, one could argue the backend should just include the updated
reimbursablefield in the transaction push. However, the frontend early return is still a bug — it means the optimistic UI always shows "Reimbursable" even momentarily, which is incorrect when the policy's default is non-reimbursable.Frontend rule matching: The frontend could try to match merchant rules optimistically and set
reimbursableaccordingly before sending to the backend. However, rule application is currently entirely backend-driven (no rule matching code exists in the IOU action module), and adding frontend rule matching would be over-engineering. The policy default is sufficient for the optimistic state.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.JS00001 commentedon Mar 5, 2026
Working on this one
JS00001 commentedon Mar 5, 2026
Demoting, but PR up
luacmartins commentedon Mar 5, 2026
PR merged. Requested a CP
luacmartins commentedon Mar 6, 2026
This is fixed