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
[$250] Distance - Split Expense shows “Amount differs from calculated distance” for long distances #83570
Version Number: V9.3.26-4 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#82257 Email or phone of affected tester (no customers):dreamnitethedragon+yydyd373@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redminote 10S Android 13 App Component: Money Requests
Action Performed:
Launch app
Go to workspace chat
Create a distance manual expense with maximum distance digits allowed eg: 4444444444
Open the expense
Tap more - split the expense
Expected Result:
Amount differs from calculated distance error must not be shown in expense preview when splitting with long distance.
Actual Result:
Amount differs from calculated distance error is shown in expense preview when splitting with long distance.
👋 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: #82257 - "feat: handle the Distance and Rate fields for splits" by @ZhenjaHorbach (High confidence) Related Issues: #78891
Recommendation: REVERT
PR #82257 introduced functionality to handle distance and rate fields for split expenses. However, when splitting a distance expense with large distance values (e.g., 4444444444 meters), the split transactions incorrectly show the "Amount differs from calculated distance" violation in the expense preview.
Labels: No label changes made. Keeping DeployBlockerCash as this is a Frontend (App) bug that is reproducible on staging but not production.
src/pages/iou/SplitExpenseEditPage.tsx - Added distance/rate editing for splits
src/libs/TransactionPreviewUtils.ts - Lines 252-260 show the modifiedAmount violation for distance requests
Root Cause
When splitting a distance expense with large distance values, the code in TransactionUtils/index.ts (lines 899-904) sets the modifiedAmount field on each split transaction:
if(isSplitTransaction&&isDistanceRequest(transaction)&&transactionChanges.amount){constamount=transactionChanges.amount??Number(transaction.modifiedAmount)??transaction.amount??0;constupdatedAmount=(isFromExpenseReport||isUnReportedExpense)&&transactionChanges.amount ? -amount : amount;updatedTransaction.amount=updatedAmount;updatedTransaction.modifiedAmount=updatedAmount;// This triggers the violationupdatedTransaction.modifiedMerchant=transactionChanges.merchant;}
The presence of modifiedAmount on a distance transaction causes TransactionPreviewUtils.ts (lines 252-260) to display the "Amount differs from calculated distance" violation, even though this is expected behavior for split transactions with custom amounts. The violation check does not account for split transactions being allowed to have amounts that differ from the calculated distance.
Please re-state the problem that we are trying to solve in this issue.
When a user creates a manual distance expense with a very large distance (e.g., 4444444444) and then splits the expense, the "Amount differs from calculated distance" error (a modifiedAmount violation with type: 'distance') appears on the split child transaction previews. This error should not appear for legitimate splits of distance expenses.
What is the root cause of that problem?
The root cause is in src/libs/actions/IOU/Split.ts at line 1168. When building the transactionParams for split child transactions in updateSplitTransactions(), the amount field is set to the full original parent transaction amount, while modifiedAmount is set to the split portion amount:
amount: Math.abs(originalTransaction?.amount ?? 0), // ← full parent total
modifiedAmount: splitExpense.amount ?? 0, // ← split share
This means every split child of a distance expense is created with amount ≠ modifiedAmount. The backend interprets this as the user having manually modified the amount away from the calculated distance, and generates a modifiedAmount violation with data.type = 'distance'.
There is a compounding issue: updateSplitExpenseDistanceFromAmount() at line 1904-1905 reverse-calculates the distance from the split amount using .toFixed(2) truncation, which is lossy. Even if amount were corrected, the truncated quantity * rate may not equal the original split amount for large values, further triggering the backend validation.
What changes do you think we should make in order to solve the problem?
Primary fix in src/libs/actions/IOU/Split.ts line 1168: Change the amount field in transactionParams from the full original transaction amount to the split portion amount (same as modifiedAmount), so the child transaction doesn't appear to have a modified amount:
amount: splitExpense.amount ?? 0, // ← use split portion, not full parent total
modifiedAmount: splitExpense.amount ?? 0, // ← split share (unchanged)
Secondary fix in updateSplitExpenseDistanceFromAmount() (line 1904-1905): After truncating the distance to 2 decimal places, recalculate the amount from the truncated distance to ensure consistency:
Then use consistentAmount as the split child's amount. This ensures the quantity * rate calculation the backend performs will always match the amount sent.
What alternative solutions did you explore? (Optional)
Suppress the violation client-side for split children — This would hide the symptom in TransactionPreviewUtils.ts (lines 252-260) but wouldn't fix the underlying data inconsistency being sent to the backend.
Remove modifiedAmount entirely for split children — This could work but may break other features that rely on modifiedAmount to track the split share vs original amount.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Activity
melvin-bot commentedon Feb 26, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #82257
melvin-bot commentedon Feb 26, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 26, 2026
Triggered auto assignment to @NicMendonca (
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 26, 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 26, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #82257 - "feat: handle the Distance and Rate fields for splits" by @ZhenjaHorbach (High confidence)
Related Issues: #78891
Recommendation: REVERT
PR #82257 introduced functionality to handle distance and rate fields for split expenses. However, when splitting a distance expense with large distance values (e.g., 4444444444 meters), the split transactions incorrectly show the "Amount differs from calculated distance" violation in the expense preview.
Labels: No label changes made. Keeping
DeployBlockerCashas this is a Frontend (App) bug that is reproducible on staging but not production.Detailed Analysis
Evidence
Verification
PR #82257 modified the following key files related to this bug:
src/libs/actions/IOU/Split.ts- Added extensive split transaction handling for distance requestssrc/libs/TransactionUtils/index.ts- Lines 899-904 setmodifiedAmounton split distance transactionssrc/components/ReportActionItem/MoneyRequestView.tsx- Modified split expense initializationsrc/pages/iou/SplitExpenseEditPage.tsx- Added distance/rate editing for splitssrc/libs/TransactionPreviewUtils.ts- Lines 252-260 show the modifiedAmount violation for distance requestsRoot Cause
When splitting a distance expense with large distance values, the code in
TransactionUtils/index.ts(lines 899-904) sets themodifiedAmountfield on each split transaction:The presence of
modifiedAmounton a distance transaction causesTransactionPreviewUtils.ts(lines 252-260) to display the "Amount differs from calculated distance" violation, even though this is expected behavior for split transactions with custom amounts. The violation check does not account for split transactions being allowed to have amounts that differ from the calculated distance.MelvinBot commentedon Feb 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a manual distance expense with a very large distance (e.g., 4444444444) and then splits the expense, the "Amount differs from calculated distance" error (a
modifiedAmountviolation withtype: 'distance') appears on the split child transaction previews. This error should not appear for legitimate splits of distance expenses.What is the root cause of that problem?
The root cause is in
src/libs/actions/IOU/Split.tsat line 1168. When building thetransactionParamsfor split child transactions inupdateSplitTransactions(), theamountfield is set to the full original parent transaction amount, whilemodifiedAmountis set to the split portion amount:This means every split child of a distance expense is created with
amount ≠ modifiedAmount. The backend interprets this as the user having manually modified the amount away from the calculated distance, and generates amodifiedAmountviolation withdata.type = 'distance'.There is a compounding issue:
updateSplitExpenseDistanceFromAmount()at line 1904-1905 reverse-calculates the distance from the split amount using.toFixed(2)truncation, which is lossy. Even ifamountwere corrected, the truncatedquantity * ratemay not equal the original split amount for large values, further triggering the backend validation.What changes do you think we should make in order to solve the problem?
Primary fix in
src/libs/actions/IOU/Split.tsline 1168: Change theamountfield intransactionParamsfrom the full original transaction amount to the split portion amount (same asmodifiedAmount), so the child transaction doesn't appear to have a modified amount:Secondary fix in
updateSplitExpenseDistanceFromAmount()(line 1904-1905): After truncating the distance to 2 decimal places, recalculate the amount from the truncated distance to ensure consistency:Then use
consistentAmountas the split child's amount. This ensures thequantity * ratecalculation the backend performs will always match the amount sent.What alternative solutions did you explore? (Optional)
TransactionPreviewUtils.ts(lines 252-260) but wouldn't fix the underlying data inconsistency being sent to the backend.modifiedAmountentirely for split children — This could work but may break other features that rely onmodifiedAmountto track the split share vs original amount.Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
12 remaining items
lakchote commentedon Feb 26, 2026
Demoting as it's an edge case. Needs BE changes.
melvin-bot commentedon Feb 26, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
ikevin127 commentedon Feb 26, 2026
Please tag me if I'm needed here 🙌
melvin-bot commentedon Mar 5, 2026
@suneox, @lakchote, @NicMendonca, @ZhenjaHorbach Still overdue 6 days?! Let's take care of this!
suneox commentedon Mar 6, 2026
We're still waiting for BE update
lakchote commentedon Mar 9, 2026
Not overdue - blocked on the backend update needed for the distance split fix.
lakchote commentedon Mar 11, 2026
This has been fixed by #83170