You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expense - Tax amount does not update after merging expenses #85179
Version Number: 9.3.37-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:#83587 Email or phone of affected tester (no customers):sodinjsoijnisojodj@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
After merging expenses, Tax amount will update to 9.09 as shown on confirm page in Step 10.
Actual Result:
After merging expenses, Tax amount remains as 10.00, which is not the same as confirm page in Step 10.
Tax amount 10.00 exceeds the tax limit which is 9.09.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #83587 - "[Merge] Merge tax rates v2" by @dominictb (High confidence) Related Issues: None
Recommendation: REVERT
This PR introduces a bug in the tax amount calculation when merging expenses. The fix would be straightforward but given the complexity of the merge tax logic, reverting is the safer approach to unblock the deploy.
Labels: Removed DeployBlocker (this is a frontend bug, not a backend bug). Kept DeployBlockerCash as this blocks the App deploy.
Detailed Analysis
Evidence
PR #83587 was identified by melvin-bot as the causing PR and adds tax rate merging functionality. The bug occurs specifically when:
Two expenses are merged with different amounts and tax rates
User selects an amount during the merge process
The tax amount should be recalculated based on the selected amount and tax rate
Instead, the tax amount is calculated incorrectly
Verification
The PR modifies the following key files related to tax calculation during merges:
src/pages/TransactionMerge/DetailsReviewPage.tsx - UI for reviewing merge details
Confirmed that PR #83587 modifies src/libs/MergeTransactionUtils.ts where the tax calculation logic resides.
Root Cause
In src/libs/MergeTransactionUtils.ts, the getMergeFieldUpdatedValues function has a bug when handling the amount field selection (around line 606-610 in the PR diff):
The issue is that it uses transaction.amount (the amount from the specific transaction object being processed) instead of using the actual selected amount value (fieldValue) that will be applied to the merged transaction. This causes the tax amount to be calculated based on the wrong base amount.
In the reproduction scenario:
Expense 1: 100.00 with 5% tax
Expense 2: 200.00 with 10% tax (manually set to 10.00)
When merging and selecting 100.00 amount + 10% tax rate
Expected: Tax should be recalculated to 9.09 (100.00 * 10%)
Actual: Tax uses 200.00 (from transaction.amount) instead of 100.00 (the selected amount)
When the user then clicks on the Tax field and clicks Save without making changes, the UI displays the old incorrect tax amount (10.00). Since it matches what is stored in the transaction, no update occurs even though the correct calculated tax amount should be 9.09.
The same pattern is handled correctly in the taxValue field handler, where it uses mergeTransaction.amount for the calculation, showing the inconsistency in the implementation.
Please re-state the problem that we are trying to solve in this issue.
When merging two expenses with different tax rates, the merge confirmation page correctly shows the recalculated tax amount (e.g., 9.09 for $100.00 at 10% tax-inclusive), but after confirming the merge, the tax amount reverts to the old value (10.00) from the source expense rather than updating to the recalculated value.
What is the root cause of that problem?
The mergeTransactionRequest function in src/libs/actions/MergeTransaction.ts:341-364 builds the API params sent to the backend but omits both taxAmount and taxValue from the params object. It sends taxCode and taxPolicyID but not the recalculated tax amount.
The full data flow:
When the user selects a tax rate or amount during the merge flow, getMergeFieldUpdatedValues in src/libs/MergeTransactionUtils.ts:636-642 correctly recalculates taxAmount using calculateTaxAmount() and stores it in the mergeTransaction Onyx store.
The confirmation page reads mergeTransaction.taxAmount via buildMergedTransactionData() and correctly displays 9.09.
The optimistic update also correctly sets the recalculated taxAmount on the transaction temporarily.
However, the API params object at MergeTransaction.ts:341-364 never includes taxAmount or taxValue — so the backend never receives the recalculated tax amount.
When the server processes the merge and responds, it overwrites the optimistic data, reverting the tax amount to the old value (10.00).
What changes do you think we should make in order to solve the problem?
Add taxAmount and taxValue to the API params in mergeTransactionRequest() at src/libs/actions/MergeTransaction.ts:341-364:
Add taxAmount: mergeTransaction.taxAmount to the params object
Add taxValue: mergeTransaction.taxValue to the params object
Also update MergeTransactionParams at src/libs/API/parameters/MergeTransactionParams.ts to include taxAmount and taxValue in the type definition (and ideally also the other fields that are sent at runtime but missing from the type: amount, currency, taxCode, taxPolicyID, reportID).
What alternative solutions did you explore? (Optional)
An alternative would be to have the backend recalculate taxAmount from the taxCode + amount it already receives, but this is riskier because:
The backend calculation might differ from the frontend's calculateTaxAmount() (tax-inclusive extraction)
Sending the explicit value from the frontend ensures consistency with what was shown on the confirmation page
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
@dominictb is there a FE PR that's exposing this option in App? It seems like we have quite a few blockers related to tax and merged expenses, so we might need to revert that to continue with App deploy
Activity
melvin-bot commentedon Mar 13, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83587
melvin-bot commentedon Mar 13, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 13, 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 13, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #83587 - "[Merge] Merge tax rates v2" by @dominictb (High confidence)
Related Issues: None
Recommendation: REVERT
This PR introduces a bug in the tax amount calculation when merging expenses. The fix would be straightforward but given the complexity of the merge tax logic, reverting is the safer approach to unblock the deploy.
Labels: Removed
DeployBlocker(this is a frontend bug, not a backend bug). KeptDeployBlockerCashas this blocks the App deploy.Detailed Analysis
Evidence
PR #83587 was identified by melvin-bot as the causing PR and adds tax rate merging functionality. The bug occurs specifically when:
Verification
The PR modifies the following key files related to tax calculation during merges:
src/libs/MergeTransactionUtils.ts- Core merge logicsrc/libs/actions/MergeTransaction.ts- Merge action handlersrc/pages/TransactionMerge/DetailsReviewPage.tsx- UI for reviewing merge detailsConfirmed that PR #83587 modifies
src/libs/MergeTransactionUtils.tswhere the tax calculation logic resides.Root Cause
In
src/libs/MergeTransactionUtils.ts, thegetMergeFieldUpdatedValuesfunction has a bug when handling theamountfield selection (around line 606-610 in the PR diff):The issue is that it uses
transaction.amount(the amount from the specific transaction object being processed) instead of using the actual selected amount value (fieldValue) that will be applied to the merged transaction. This causes the tax amount to be calculated based on the wrong base amount.In the reproduction scenario:
When the user then clicks on the Tax field and clicks Save without making changes, the UI displays the old incorrect tax amount (10.00). Since it matches what is stored in the transaction, no update occurs even though the correct calculated tax amount should be 9.09.
The same pattern is handled correctly in the
taxValuefield handler, where it usesmergeTransaction.amountfor the calculation, showing the inconsistency in the implementation.MelvinBot commentedon Mar 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When merging two expenses with different tax rates, the merge confirmation page correctly shows the recalculated tax amount (e.g., 9.09 for $100.00 at 10% tax-inclusive), but after confirming the merge, the tax amount reverts to the old value (10.00) from the source expense rather than updating to the recalculated value.
What is the root cause of that problem?
The
mergeTransactionRequestfunction insrc/libs/actions/MergeTransaction.ts:341-364builds the API params sent to the backend but omits bothtaxAmountandtaxValuefrom the params object. It sendstaxCodeandtaxPolicyIDbut not the recalculated tax amount.The full data flow:
getMergeFieldUpdatedValuesinsrc/libs/MergeTransactionUtils.ts:636-642correctly recalculatestaxAmountusingcalculateTaxAmount()and stores it in themergeTransactionOnyx store.mergeTransaction.taxAmountviabuildMergedTransactionData()and correctly displays 9.09.taxAmounton the transaction temporarily.MergeTransaction.ts:341-364never includestaxAmountortaxValue— so the backend never receives the recalculated tax amount.What changes do you think we should make in order to solve the problem?
Add
taxAmountandtaxValueto the API params inmergeTransactionRequest()atsrc/libs/actions/MergeTransaction.ts:341-364:taxAmount: mergeTransaction.taxAmountto the params objecttaxValue: mergeTransaction.taxValueto the params objectAlso update
MergeTransactionParamsatsrc/libs/API/parameters/MergeTransactionParams.tsto includetaxAmountandtaxValuein the type definition (and ideally also the other fields that are sent at runtime but missing from the type:amount,currency,taxCode,taxPolicyID,reportID).What alternative solutions did you explore? (Optional)
An alternative would be to have the backend recalculate
taxAmountfrom thetaxCode+amountit already receives, but this is riskier because:calculateTaxAmount()(tax-inclusive extraction)Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.3 remaining items
dominictb commentedon Mar 13, 2026
I think the culprit is here
dominictb commentedon Mar 13, 2026
Backend PR created https://github.com/Expensify/Auth/pull/20435
luacmartins commentedon Mar 13, 2026
@dominictb is there a FE PR that's exposing this option in App? It seems like we have quite a few blockers related to tax and merged expenses, so we might need to revert that to continue with App deploy
luacmartins commentedon Mar 13, 2026
We can demote this. The user can refresh the page to get the updated result and the fix is in Auth
luacmartins commentedon Mar 17, 2026
BE PR is merged
luacmartins commentedon Mar 18, 2026
@dominictb can you retest this one to confirm the fix please?
dominictb commentedon Mar 19, 2026
Fixed on prod:
Screen.Recording.2026-03-19.at.10.31.12-compressed.mov