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.24-1
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: #81514
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: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Money Requests
Action Performed:
Prerequisite: Account has at least one workspace with rules enabled.
Prerequisite 2: "Taxes" enabled and at least two taxes different from default available.
- Open the Expensify app.
- Navigate to "Workspaces" > "Rules" > "Add Merchant Rule"
- In "For expenses with", add any merchant.
- In "Apply these updates", add any category, a description and a tax that is different from the default one.
- Save the rule.
- Navigate to workspace chat.
- Start a manual expense creation flow.
- Add an amount and tap on "Next"
- Add the same merchant from step 3.
- Select a category different from the one on created rule and also a different description.
- Navigate to "Tax" field and select a rate that is different as the one selected on the created rule, and also different from the default one.
- Finish the expense creation flow.
- Open the report of the just created expense.
- Note that "Category" and "Description" fields, show the information added manually while creating expense.
- Note that tax rate selected manually, was not retained.
Expected Result:
Created rules should not override the fields that were selected manually by the user while creating expense.
Actual Result:
Tax rate selected manually while creating an expense, is not retained if a rule was created before.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
1.mp4
Issue Owner
Current Issue Owner: @ChavdaSachinUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022025806224289136176
- Upwork Job ID: 2025806224289136176
- Last Price Increase: 2026-02-23
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Feb 23, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #81514
melvin-bot commentedon Feb 23, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 23, 2026
Triggered auto assignment to @sonialiap (
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 Feb 23, 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 Feb 23, 2026
Investigation Summary
Classification: Backend bug
Causing PR: Cannot be determined - this appears to be a backend issue, not a frontend (App) bug
Related Feature: Merchant Rules (enabled via #82438)
Recommendation: REMOVE DeployBlockerCash LABEL
The tax rate override issue is caused by backend logic applying merchant coding rules incorrectly, not by any App PR.
Labels: Removing
DeployBlockerCashlabel. This does NOT block the App deploy. KeepingDeployBlockerlabel as this blocks the backend/Web deploy.Detailed Analysis
Evidence
What happens:
Why this indicates a backend bug:
Verification
Frontend code checked:
src/libs/actions/IOU/index.ts- No merchant rule application logicsrc/libs/ExpenseRuleUtils.ts- Only formatting utilities, no application logicsrc/pages/iou/request/step/IOURequestStepConfirmation.tsx- Uses transaction tax values as-issetMoneyRequestTaxRate()function - Simple setter, no rule checkingMerchant Rules PRs:
None of these App PRs contain logic for APPLYING merchant rules to expenses during creation.
Root Cause
Merchant coding rules are a backend feature. The backend applies these rules when processing expense submissions. The bug is that the backend is:
This inconsistency in the backend rule application logic cannot be fixed in the App repository.
Why This Doesnt Block App Deploy
MelvinBot commentedon Feb 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace has a merchant rule configured with a specific tax rate, and a user manually creates an expense with that merchant but selects a different tax rate, the manually selected tax rate is not retained on the report. The merchant rule's tax rate overrides the user's manual selection. Category and description fields that are manually set by the user are correctly preserved.
What is the root cause of that problem?
Merchant rules (both personal expense rules from
NVP_EXPENSE_RULESand workspace coding rules frompolicy.rules.codingRules) are applied server-side after theREQUEST_MONEYAPI call. The front-end sends all transaction fields (includingtaxCodeandtaxAmount) to the backend, but there is no mechanism to indicate which fields were manually set by the user.Key evidence from the codebase:
setMoneyRequestMerchant()atsrc/libs/actions/IOU/index.ts:1445simply writes the merchant to the draft with zero rule matching — unlikesetMoneyRequestCategory()(line 1476) which applies category-based tax rules client-side.setMoneyRequestTaxRate()atsrc/libs/actions/IOU/index.ts:12338just merges{taxCode}into the draft — no "user-modified" flag is set.RequestMoneyParamsatsrc/libs/API/parameters/RequestMoneyParams.ts:24-26sendstaxCodeandtaxAmountas plain values with no provenance metadata.Transactiontype atsrc/types/onyx/Transaction.tshas no field likeuserModifiedFieldsormanuallySetTax.When the backend receives the request, it matches the merchant against coding rules (
policy.rules.codingRulesfilters, defined atsrc/types/onyx/Policy.ts:1720-1756) and/or personal expense rules (NVP_EXPENSE_RULES, defined atsrc/types/onyx/ExpenseRule.ts). Because the backend cannot distinguish between a user-selected tax and a default tax, it unconditionally applies the rule's tax rate, overwriting the user's manual selection. The server then pushes the updated transaction data back via Onyx updates, replacing the optimistic values.Category and description appear to be preserved because the backend likely has selective override logic for those fields (checking whether the user-provided value differs from the default), but applies the tax override unconditionally. This selective behavior cannot be confirmed without backend code access, but the front-end evidence rules out a client-side cause.
What changes do you think we should make in order to solve the problem?
There are two approaches, depending on whether we fix this client-side or server-side:
Option A (Recommended — Client-side): Add a
userModifiedFieldsproperty to the transaction draft (or a specificisTaxManuallySetflag). When the user explicitly selects a tax rate viaIOURequestStepTaxRatePage, set this flag on the draft. Pass it through to theRequestMoneyParamsAPI call so the backend can skip the rule's tax override when the user made a manual selection.Option B (Server-side): Modify the backend rule application logic to compare the incoming
taxCodeagainst the policy's default tax. If they differ, assume the user manually chose it and skip the rule override for tax. This is simpler but less reliable (what if the user intentionally chose the default?).The fix should ensure that:
What alternative solutions did you explore? (Optional)
A purely front-end solution was considered where the merchant rule is applied client-side (similar to how
setMoneyRequestCategoryapplies category-based tax rules), with logic to skip application if the user already manually set the tax. However, since merchant rule application involves matching against server-side data (coding rules and personal expense rules), this would require duplicating backend logic and is less maintainable.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Feb 23, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)[-]Report - Tax rate selected manually is not retained on report if a rule was created before.[/-][+][$250] Report - Tax rate selected manually is not retained on report if a rule was created before.[/+]melvin-bot commentedon Feb 23, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022025806224289136176
himal250692 commentedon Feb 23, 2026
What problem are we trying to solve?
When a workspace merchant rule includes a tax rate, and a user manually selects a different tax rate while creating an expense for that same merchant, the user’s manual tax selection is not retained.
Merchant rules should not override fields explicitly chosen by the user during expense creation.
Why is this happening?
The frontend currently sends taxCode/taxAmount as plain values in RequestMoney, but does not send whether tax was manually edited by the user.
When the backend applies merchant/coding rules after REQUEST_MONEY, it cannot distinguish:
“default tax still untouched” vs
“user intentionally selected this tax”
So tax can be overwritten by rule application.
Proposed solution (recommended)
Add explicit “user-modified” provenance for tax and honor it during rule application.
Track tax manual edit in the draft transaction (e.g. userModifiedFields.taxCode = true, or isTaxManuallySet = true) when user changes tax in IOURequestStepTaxRatePage.
Include that flag in RequestMoneyParams.
On backend rule application, skip tax override if manual-tax flag is true.
Keep current behavior (rule may apply tax) when user did not manually edit tax.
This aligns tax behavior with the expectation already seen for other manually-entered fields like category/description.
Why this is the best option
Deterministic and explicit; no inference from value comparisons.
Avoids false assumptions (e.g., user intentionally choosing default tax).
Scales to other fields if we later need similar “manual override wins” behavior.
kgshriramm commentedon Feb 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace has a merchant rule configured with a specific tax rate, and a user manually creates an expense with that merchant but selects a different tax rate, the manually selected tax rate is not retained. Instead, the merchant rule’s tax rate overrides the user’s selection
Although category and description fields respect manual changes, tax does not. This leads to incorrect tax values being applied even when the user explicitly selects a different rate.
What is the root cause of that problem?
The frontend always sends taxCode and taxAmount to the backend in RequestMoney, TrackExpense, and related API calls. However there is no way to indicate whether the tax was
Automatically populated from policy defaults, or
Explicitly selected by the user in the Tax Rate step
Because there is no provenance tracking, the backend applies merchant rule logic unconditionally and overrides the tax value
The core issue is that user intent is not explicitly encoded in the transaction data
What changes do you think we should make in order to solve the problem?
The most scalable and explicit solution is to introduce a
taxCodeManuallySetflag to track whether the tax was explicitly chosen by the userThis allows the backend to preserve manual selections while continuing to apply merchant rules when the tax was not modified by the user.
Add a new optional boolean property to track whether the tax was manually selected.
This ensures the transaction object and API payload can carry user intent explicitly.
[MODIFY] src/types/onyx/Transaction.ts taxCodeManuallySet?: boolean;[MODIFY] src/libs/API/parameters/TrackExpenseParams.ts taxCodeManuallySet?: boolean;[MODIFY] src/libs/API/parameters/RequestMoneyParams.ts taxCodeManuallySet?: boolean;[MODIFY] src/libs/API/parameters/CreateDistanceRequestParams.ts taxCodeManuallySet?: boolean;Explanation:
Making this field optional preserves backward compatibility and ensures existing flows are not impacted.
We update the tax selection flow so that whenever a user explicitly chooses a tax rate, the draft transaction records that action
[MODIFY] src/libs/actions/IOU/index.tsUpdate
setMoneyRequestTaxRateto accept a new argument:Explanation:
This ensures that when tax is explicitly selected, we persist that user intent into the draft transaction stored in Onyx
[MODIFY] src/pages/iou/request/step/IOURequestStepTaxRatePage.tsxCall the updated function with isManuallySet = true:Explanation:
This ensures the flag is only set when the user actively selects a tax rate, not when tax is auto populated
When constructing API parameters for
RequestMoney,TrackExpense, andCreateDistanceRequest, propagate the flag to the backend.[MODIFY] src/libs/actions/IOU/index.tsInside
getTrackExpenseInformation()andgetMoneyRequestInformation():Explanation:
This ensures the backend receives explicit information about whether the tax was manually set
The backend can then skip merchant rule tax overrides when
taxCodeManuallySet is true, while preserving existing rule behavior for non modified taxes.What alternative solutions did you explore? (Optional)
An alternative approach would be to omit sending
taxCodeandtaxAmountwhen they match the policy default. This would allow the backend to infer user intent based on presence or absence of valuesHowever, this approach relies on implicit inference and may introduce ambiguity in cases where a user intentionally selects the default tax
The proposed
taxCodeManuallySetflag explicitly encodes user intent, making the behavior scalable, and easier to maintainnabi-ebrahimi commentedon Feb 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Report - Tax rate selected manually is not retained on report if a rule was created before.
What is the root cause of that problem?
The create flows submit taxCode/taxAmount as plain values, but there is no durable intent signal that the tax was manually selected by the user.
setMoneyRequestTaxRate() only merges {taxCode} (no user-intent metadata):
App/src/libs/actions/IOU/index.ts
Lines 12338 to 12339 in 337f2a5
RequestMoneyParams contains taxCode/taxAmount only:
App/src/libs/API/parameters/RequestMoneyParams.ts
Lines 24 to 25 in 337f2a5
TrackExpenseParams contains taxCode/taxAmount only:
App/src/libs/API/parameters/TrackExpenseParams.ts
Lines 27 to 28 in 337f2a5
CreateDistanceRequestParams contains taxCode/taxAmount only:
App/src/libs/API/parameters/CreateDistanceRequestParams.ts
Lines 18 to 19 in 337f2a5
What changes do you think we should make in order to solve the problem?
Mark tax as manually selected only from explicit user action in tax-rate step.
Carry this flag through create submissions.
After create command settles, compare server tax vs user-selected tax.
If mismatch, use existing update API (UPDATE_MONEY_REQUEST_TAX_RATE) to restore user-selected tax.
Keep retries bounded and delayed until optimistic data settles.
Code diffs (short description + related git diff) for every changed file:
src/libs/actions/IOU/index.tsAdds manual-tax reconciliation helper, threads manual-tax flag through create flows, and updates tax setter to persist manual flag.
src/pages/iou/request/step/IOURequestStepTaxRatePage.tsxMarks tax choice as manual only when user explicitly picks a tax.
src/pages/iou/request/step/IOURequestStepConfirmation.tsxPasses manual-tax marker into submission payload builders for request/track/distance.
src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.tsAdds local transaction field to store explicit manual tax intent.
src/libs/DebugUtils.ts b/src/libs/DebugUtils.tsUpdates debug validators/switch exhaustiveness for new transaction field.
Demo of the fix
1.mp4
What alternative solutions did you explore? (Optional)
Keep user-selected tax code in memory when picked manually, then run a delayed post-create tax patch (with retries) after expense creation APIs, so the final transaction tax code is re-applied once optimistic creation settles.
src/libs/actions/IOU/index.tsAdded manual-tax tracking, added enqueueManualTaxPatch() retry helper, hooked it into REQUEST_MONEY / TRACK_EXPENSE / CREATE_DISTANCE_REQUEST, and extended setMoneyRequestTaxRate() with a manual-selection flag.
src/pages/iou/request/step/IOURequestStepTaxRatePage.tsxWhen user selects tax, mark it as manual (isTaxCodeManuallySelected=true) so the post-create patch logic can re-apply it reliably.
github-actions commentedon Feb 23, 2026
JS00001 commentedon Feb 23, 2026
We decided we should override this