Skip to content

[Due for payment 2026-11-13] [$175] [Exploratory] Distance - Duplicating expense with alternate route doesn't duplicate the route #102946

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.1-9
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/57599980/test-cases/41237143
Email or phone of affected tester (no customers): gd868gd@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Desktop / Windows 11
App Component: Money Requests

Action Performed:

  1. Open the Workspace and log in
  2. Click on the global FAB and click on "Track distance"
  3. Set the start and end points on the map
  4. When the route is calculated, select an alternate route shown on the map
  5. Click on "Next" and click on "Create expense"
  6. Click on the created expense to open it
  7. Click on "More" and click on "Duplicate expense"
  8. Observe the distance and the map of the duplicated expense

Expected Result:

The alternate route should be duplicated as well as all other data from the original expense.

Actual Result:

The alternate route is not copied into the duplicate of the original expense.
It causes a difference in the distance between two expenses that should be the same and triggers an error.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7277274_1791142950540.Expensify_102818_Duplicate_Route.mp4
Image

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7277274

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 5, 2026
  2. melvin-bot commented on Oct 18, 2026

    @melvin-bot

    this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  3. m-natarajan commented on Oct 27, 2026

    @m-natarajan
  4. m-natarajan commented on Oct 27, 2026

    @m-natarajan

    @MelvinBot Please investigate this and assign accordingly

  5. MelvinBot commented on Oct 27, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When you duplicate a map distance expense that uses the alternate route, the duplicate gets the primary route. The distance changes, and the amount no longer matches the distance.

    What is the root cause of that problem?

    The backend learns which route you picked only from the selectedRouteDistance API param. Normal create and edit flows send it, for example useDistanceSubmission.ts:190. Without it, the backend uses the primary route. The param's own comment says this: Split.ts:125-126.

    The duplicate flow never sets selectedRouteDistance. buildDuplicateTransactionParams copies only the waypoints. It sets distance only for split, odometer, or manual expenses (L665-L668). So the duplicate sends the waypoints and the alternate route's amount (L755-L761). The backend then recalculates the distance using the primary route. That mismatch between amount and distance explains the error in the video.

    What changes do you think we should make in order to solve the problem?

    1. In buildDuplicateTransactionParams, for map distance expenses only, set selectedRouteDistance from the source expense. Use getSelectedRouteDistance(transaction) and fall back to transaction.comment.customUnit.routeDistanceMeters. A saved expense often has no routes, so the saved meters value is the reliable source (TransactionUtils/index.ts:1795-1803).
    2. No other wiring is needed. createDistanceRequest (Split.ts:2116) and trackExpense (TrackExpense.ts:2580) already read it from transactionParams. This covers both the workspace and the self-DM duplicate paths.
    3. Optional: copy routes into the duplicate's optimistic transaction so the map shows the alternate route right away.
    4. Add a test in tests/actions/IOUTest/DuplicateTest.ts that checks selectedRouteDistance is sent when you duplicate an alternate-route expense.

    What alternative solutions did you explore? (Optional)

    Sending distance for map expenses as well. We rejected this because map expenses rely on waypoints plus the selected route. selectedRouteDistance is the field built for this case.

    Notes
    • The fix is App-only. The backend already accepts selectedRouteDistance on create. We have not confirmed the exact backend error text.
    • No duplicate issue found. I added External so a C+ can review this.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/102946) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 27, 2026
  7. 27 remaining items

  8. melvin-bot commented on Nov 12, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  9. melvin-bot commented on Nov 12, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  10. mallenexpensify commented on Nov 16, 2026

    @mallenexpensify
    Contributor

    Claude posting on behalf of Matt:

    Ready. Job price: $175 (title).

    • hoangzinh (C+): 100%, via NewDot

    No deploy blockers or regressions on the issue or the PR.

    Next: press Caps+Y, then pay.

    Evidence
    • C+ checklist, 8 test steps: comment
    • TestRail case: none yet.
    • Resolving PR #105414: by MelvinBot, merged 2026-11-04, approved by garrettmknight, hoangzinh and stitesExpensify. No revert.
    • Offending PR Add alternate route for map-based mileage expenses #96169 by GCyganek, reviewed by dmkt9: production 2026-08-14, bug filed 2026-10-04. Outside the window, no cut.
    • Videos: C+ 3/5.

    PAYPREP v1

  11. mallenexpensify commented on Nov 16, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @hoangzinh due $175 via NewDot

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions