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
[Due for payment 2026-09-04] Distance - Distance field shows wrong expense when merging distance expense with exclusion #98343
Version Number: 9.4.52-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:#93848 Email or phone of affected tester (no customers):applausetester+sddd1jsods@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Log in with Expensifail account.
Create two workspaces - A and B.
Enable Distance rates in workspace A, then enable "Exclude a fixed distance per claim" in distance settings with 1 miles.
Go to staging.new.expensify.com
Create a distance expense with different waypoints in workspace A and B.
Go to workspace chat A.
Open the distance expense.
Click More > Merge.
Select distance expense from workspace chat B.
Select first merchant and second report > Continue.
→ Distance field shows the selected distance on confirm page.
Click back button.
Select second merchant and second report > Continue.
Expected Result:
Distance field will show the selected distance (second merchant) on confirm page.
Actual Result:
Distance field shows the wrong distance (first merchant) on confirm page when second merchant is selected.
👋 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.
Offending PR:#93848 — "Implement workspace commuter exclusion" (the Exclude a fixed distance per claim feature from the repro). It's in the current staging deploy, merged 2026-08-10, staging-only / N/A in prod — timeline matches. Confidence: High.
Root cause: The merge flow copies the selected transaction's customUnit by reference and writes it via Onyx.merge, which deep-merges. PR #93848 added four optional exclusion fields to customUnit (commuterExclusion, reimbursableDistance, commuterExclusionType, commuterExclusionMethod). When you first select a merchant whose transaction has those fields, then go back and select a merchant whose transaction doesn't, the deep merge leaves the stale fields in place — so the confirm page keeps showing the first merchant's reimbursableDistance.
Recommended fix: Roll forward with a targeted fix (a revert of the ~70-file feature PR is disproportionate for this narrow merge edge case). In MergeTransactionUtils.ts:677, write customUnit with the four exclusion keys explicitly defaulted to null (then spread the selected transaction's customUnit over them) so Onyx.merge clears any stale values — mirroring the null-clearing pattern PR #93848 already established at MoneyRequest.ts:847-858.
Investigation details & evidence chain
Display path (why the stale value surfaces): When an exclusion is present, the confirm page renders customUnit.reimbursableDistance rather than the route distance:
MergeTransactionUtils.ts:677: updatedValues.customUnit = transaction?.comment?.customUnit; — copied wholesale by reference. Notably, the very next lines explicitly clear receipt/waypoints/routes to null when absent — customUnit is the one field that isn't cleared.
MergeTransaction.ts:75-77: setMergeTransactionKey uses Onyx.merge (deep, recursive merge), so absent nested keys are not removed.
Before #93848 these fields didn't exist, so deep-merging customUnit was harmless (route quantity/waypoints were always overwritten). The feature introduced fields that need explicit clearing, but the merge-selection path was missed.
A regression test that selects merchant A (with exclusion), goes back, re-selects merchant B (without exclusion), and asserts the merged customUnit.reimbursableDistance is cleared would lock this in.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/blob/1b2656d631510c8650a3c9878f7335dbc3e01fcc/src/libs/MergeTransactionUtils.ts#L677) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR:
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Use an account with the beta enabled and two workspaces: Workspace A and Workspace B.
Enable Distance Rates in both Workspace A and Workspace B.
In Workspace A, enable Commuter Deductions and set the deduction to 1 mile.
Create a Map Distance Expense in Workspace A (Expense A) and another in Workspace B (Expense B).
Ensure Expense A and Expense B have different mileage values.
Test:
Open Expense A and click Merge.
Select Expense B as the expense to merge.
Verify the following merchant and report combinations produce the expected commuter deduction exclusion behavior:
Expense A Merchant + Expense A Report: Exclusion is applied.
Expense A Merchant + Expense B Report: Exclusion is not applied.
Expense B Merchant + Expense A Report: Exclusion is applied.
Expense B Merchant + Expense B Report: Exclusion is not applied.
Activity
applause-bot commentedon Aug 11, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/ca5d5661f2cb7baf1bbf57a55f61a4e8bc2d973f9677a5726933aaf400e4698c
melvin-bot commentedon Aug 11, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #93848
melvin-bot commentedon Aug 11, 2026
@Gonals @marufsharifi you have been assigned to this deploy blocker because you reviewed the offending PR: #93848
melvin-bot commentedon Aug 11, 2026
@fedirjh you have been assigned to this deploy blocker because you authored the offending PR: #93848
melvin-bot commentedon Aug 11, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Aug 11, 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:
MelvinBot commentedon Aug 11, 2026
Deploy Blocker Analysis
Offending PR: #93848 — "Implement workspace commuter exclusion" (the
Exclude a fixed distance per claimfeature from the repro). It's in the current staging deploy, merged 2026-08-10, staging-only / N/A in prod — timeline matches. Confidence: High.Root cause: The merge flow copies the selected transaction's
customUnitby reference and writes it viaOnyx.merge, which deep-merges. PR #93848 added four optional exclusion fields tocustomUnit(commuterExclusion,reimbursableDistance,commuterExclusionType,commuterExclusionMethod). When you first select a merchant whose transaction has those fields, then go back and select a merchant whose transaction doesn't, the deep merge leaves the stale fields in place — so the confirm page keeps showing the first merchant'sreimbursableDistance.Recommended fix: Roll forward with a targeted fix (a revert of the ~70-file feature PR is disproportionate for this narrow merge edge case). In
MergeTransactionUtils.ts:677, writecustomUnitwith the four exclusion keys explicitly defaulted tonull(then spread the selected transaction'scustomUnitover them) soOnyx.mergeclears any stale values — mirroring the null-clearing pattern PR #93848 already established atMoneyRequest.ts:847-858.Investigation details & evidence chain
Display path (why the stale value surfaces): When an exclusion is present, the confirm page renders
customUnit.reimbursableDistancerather than the route distance:MoneyRequestView.tsx:613-618→getCommuterExclusionDisplayData→getDistanceForDisplay(returnsreimbursableDistance, ignoring the route distance).The leak (verified at HEAD
1b2656d):MergeTransactionUtils.ts:677:updatedValues.customUnit = transaction?.comment?.customUnit;— copied wholesale by reference. Notably, the very next lines explicitly clearreceipt/waypoints/routestonullwhen absent —customUnitis the one field that isn't cleared.MergeTransaction.ts:75-77:setMergeTransactionKeyusesOnyx.merge(deep, recursive merge), so absent nested keys are not removed.Transaction.ts:216-227.Before #93848 these fields didn't exist, so deep-merging
customUnitwas harmless (routequantity/waypointswere always overwritten). The feature introduced fields that need explicit clearing, but the merge-selection path was missed.Suggested fix shape:
A regression test that selects merchant A (with exclusion), goes back, re-selects merchant B (without exclusion), and asserts the merged
customUnit.reimbursableDistanceis cleared would lock this in.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/blob/1b2656d631510c8650a3c9878f7335dbc3e01fcc/src/libs/MergeTransactionUtils.ts#L677)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
17 remaining items
marufsharifi commentedon Sep 2, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR:
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Test:
Open Expense A and click Merge.
Select Expense B as the expense to merge.
Verify the following merchant and report combinations produce the expected commuter deduction exclusion behavior:
Do we agree 👍 or 👎
melvin-bot commentedon Sep 3, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 3, 2026
Payment Summary
Resolving PRs:
Properly apply commuter exclusions when merging expenses #98427
Contributor: @fedirjh does not require payment (Contractor)
Assignee: @marufsharifi requires payment (Needs manual offer from BZ)
BugZero Checklist (@mallenexpensify)
marufsharifi commentedon Sep 4, 2026
@mallenexpensify, I think we can close this for now, since the PR has been deployed to production since last week. Thanks!