Skip to content

Distance - Amount and Distance of the duplicated odometer expense change to zero #84275

Closed

Description

@lanitochka17

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.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.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an odometer distance expense.
  4. Open the expense.
  5. Click More > Duplicate expense.
  6. 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.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7094110_1772662039853.18.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 5, 2026
  2. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #82005

  3. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    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.

  5. github-actions commented on Mar 5, 2026

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Mar 5, 2026

    @MelvinBot
    Contributor

    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 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:

    1. Add odometerStart and odometerEnd as top-level fields in transactionParams (around line 564-582):

      • odometerStart: transaction?.comment?.odometerStart
      • odometerEnd: transaction?.comment?.odometerEnd
    2. 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.

  7. JS00001 commented on Mar 5, 2026

    @JS00001
    Contributor

    Demoting, odometer is behind a beta

  8. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Mar 5, 2026
  9. JS00001 commented on Mar 5, 2026

    @JS00001
    Contributor

    Closing out in favor of #84280, so there's less noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions