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
Distance - Amount and Distance of the duplicated odometer expense change to zero #84275
Version Number: 9.3.31-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:#82005 Email or phone of affected tester (no customers):applausetester+sjddjois2jd@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Log in with Expensifail account.
Go to staging.new.expensify.com
Go to workspace chat.
Create an odometer distance expense.
Open the expense.
Click More > Duplicate expense.
Open the duplicated expense.
Expected Result:
Amount and Distance of the duplicated odometer expense will keep the original value.
Actual Result:
Amount and Distance of the duplicated odometer expense change to zero.
👋 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.
Please re-state the problem that we are trying to solve in this issue.
When duplicating an odometer distance expense (via More > Duplicate), the duplicated expense has its amount and distance set to zero instead of preserving the original values.
What is the root cause of that problem?
There are two gaps in duplicateExpenseTransaction that cause odometer-specific data to be lost during duplication:
1. odometerStart/odometerEnd are not passed as top-level fields in transactionParams
In src/libs/actions/IOU/Duplicate.ts:564-582, transactionParams is constructed by spreading transactionWithoutLinkedAction and transactionDetails. Odometer readings are stored nested in transaction.comment.odometerStart / transaction.comment.odometerEnd, but TransactionParams expects them as top-level fields. The spread of the original transaction brings comment as a full Comment object, but then line 568 overwrites comment with a plain text string (Parser.htmlToMarkdown(transactionDetails?.comment ?? '')), losing the nested odometer data.
Downstream, buildOptimisticTransaction (src/libs/TransactionUtils/index.ts:468-472) only adds odometerStart/odometerEnd to the new transaction's comment when they are provided as top-level params — which they are not, so the duplicated transaction has no odometer readings.
2. distance is not included for odometer expenses
getTransactionDetails in src/libs/ReportUtils.ts:4611 only includes the distance field when isManualDistanceRequest is true. Odometer expenses return false for isManualDistanceRequest (they are a distinct type that explicitly requires odometerStart/odometerEnd to be present — see src/libs/TransactionUtils/index.ts:207-221). As a result, transactionDetails.distance is undefined, and buildOptimisticTransaction sets customUnit.quantity (the distance) to undefined.
Without a valid distance, the amount calculation produces zero.
What changes do you think we should make in order to solve the problem?
In duplicateExpenseTransaction in src/libs/actions/IOU/Duplicate.ts:
Add odometerStart and odometerEnd as top-level fields in transactionParams (around line 564-582):
Add the distance field for odometer expenses. There is already a similar pattern at lines 598-601 that adds distance for split distance expenses. Add a similar condition for odometer expenses:
If the transaction is an odometer distance request, set params.transactionParams.distance = transaction.comment?.customUnit?.quantity ?? undefined
What alternative solutions did you explore? (Optional)
An alternative would be to modify getTransactionDetails in ReportUtils.ts:4611 to also include distance for odometer requests (changing the condition from isManualDistanceRequest to isManualDistanceRequest || isOdometerDistanceRequest). However, getTransactionDetails is used widely across the codebase, so changing it could have unintended side effects. The more targeted fix in duplicateExpenseTransaction is safer and follows the existing pattern used for split distance expenses at lines 598-601.
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 Mar 5, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #82005
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 @jliexpensify (
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:
MelvinBot commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When duplicating an odometer distance expense (via More > Duplicate), the duplicated expense has its amount and distance set to zero instead of preserving the original values.
What is the root cause of that problem?
There are two gaps in
duplicateExpenseTransactionthat cause odometer-specific data to be lost during duplication:1.
odometerStart/odometerEndare not passed as top-level fields intransactionParamsIn
src/libs/actions/IOU/Duplicate.ts:564-582,transactionParamsis constructed by spreadingtransactionWithoutLinkedActionandtransactionDetails. Odometer readings are stored nested intransaction.comment.odometerStart/transaction.comment.odometerEnd, butTransactionParamsexpects them as top-level fields. The spread of the original transaction bringscommentas a fullCommentobject, but then line 568 overwritescommentwith a plain text string (Parser.htmlToMarkdown(transactionDetails?.comment ?? '')), losing the nested odometer data.Downstream,
buildOptimisticTransaction(src/libs/TransactionUtils/index.ts:468-472) only addsodometerStart/odometerEndto the new transaction's comment when they are provided as top-level params — which they are not, so the duplicated transaction has no odometer readings.2.
distanceis not included for odometer expensesgetTransactionDetailsinsrc/libs/ReportUtils.ts:4611only includes thedistancefield whenisManualDistanceRequestis true. Odometer expenses returnfalseforisManualDistanceRequest(they are a distinct type that explicitly requiresodometerStart/odometerEndto be present — seesrc/libs/TransactionUtils/index.ts:207-221). As a result,transactionDetails.distanceisundefined, andbuildOptimisticTransactionsetscustomUnit.quantity(the distance) toundefined.Without a valid distance, the amount calculation produces zero.
What changes do you think we should make in order to solve the problem?
In
duplicateExpenseTransactioninsrc/libs/actions/IOU/Duplicate.ts:Add
odometerStartandodometerEndas top-level fields intransactionParams(around line 564-582):odometerStart: transaction?.comment?.odometerStartodometerEnd: transaction?.comment?.odometerEndAdd the
distancefield for odometer expenses. There is already a similar pattern at lines 598-601 that addsdistancefor split distance expenses. Add a similar condition for odometer expenses:params.transactionParams.distance = transaction.comment?.customUnit?.quantity ?? undefinedWhat alternative solutions did you explore? (Optional)
An alternative would be to modify
getTransactionDetailsinReportUtils.ts:4611to also includedistancefor odometer requests (changing the condition fromisManualDistanceRequesttoisManualDistanceRequest || isOdometerDistanceRequest). However,getTransactionDetailsis used widely across the codebase, so changing it could have unintended side effects. The more targeted fix induplicateExpenseTransactionis safer and follows the existing pattern used for split distance expenses at lines 598-601.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
Demoting, odometer is behind a beta
JS00001 commentedon Mar 5, 2026
Closing out in favor of #84280, so there's less noise