Skip to content

Distance on confirm page and actual expense is different when route has edited manual distance #103271

Closed as not planned

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: 9.5.4-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: #102258
Email or phone of affected tester (no customers): jsoidjndoiniodnsjojd@gmail.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:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a map distance expense.
  4. Open the expense.
  5. Click Distance > Manual.
  6. Edit the distance and save it.
  7. Click + > Track distance > Map.
  8. Click Reuse route.
  9. Select the previous route.
  10. Click Create expense.
  11. Open the expense.

Expected Result:

The distance on confirm page (Step 9) and actual expense (Step 11) should match after selecting previous route with edited manual distance.

Actual Result:

The distance on confirm page (Step 9) and actual expense (Step 11) is different after selecting previous route with edited manual distance.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7279466_1791327623977.10.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Vincenzo Godoy
Bug ID: 7279466

Activity

  1. applause-bot commented on Oct 7, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/4eb42d8952ff9fb7ddf4f66e0e7d7c0167b6baa19440ebd9a8c790e6c6f1123d

  2. added
    DeployBlockerCash
    Bug
    on Oct 7, 2026
  3. melvin-bot commented on Oct 7, 2026

    @melvin-bot

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

  4. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    @Gonals @Pujan92 you have been assigned to this deploy blocker because you reviewed the offending PR: #102258

  5. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    @ShridharGoel you have been assigned to this deploy blocker because you authored the offending PR: #102258

  6. melvin-bot commented on Oct 7, 2026

    @melvin-bot

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

  7. github-actions commented on Oct 7, 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.
  8. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    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.

  9. MelvinBot commented on Oct 7, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR: [Payment due @Pujan92] Add Reuse route to the distance creation flow (high confidence). This is a frontend bug in App.

    Recommendation: Revert. Reuse route is a new feature that only appears in the create flow, so a revert is low risk. It also clears the related blocker, Mismatch between Distance on confirm page & actual distance when reuse route from p2p expense, which has the same root cause. If ShridharGoel can land the fix below within the deploy window, rolling forward is fine instead.

    Root cause: The confirm page shows the reused route's stored distance. That distance is never sent when the expense is created, so the server calculates a new distance from the waypoints.

    Investigation details
    1. selectReusableRoute in ReusableDistanceRoutes.ts:46-55 copies route.distance into comment.customUnit.quantity and sets isReusedRoute: true. It does not fill routes.route0. If the source expense's distance was edited manually, route.distance is that edited value.
    2. useFetchRoute.ts:44 skips fetching the route when isReusedRoute is set, so routes stays empty.
    3. The confirm page calls getDistanceInMeters (useDistanceRequestState.ts:101). That function reads quantity first (getDistanceInMeters.ts:16-18), so the confirm page shows the edited distance.
    4. When the expense is created, useDistanceDraftData.ts:22 uses quantity only for manual, odometer, and GPS expenses. For a map expense, distance is undefined. selectedRouteDistance (useDistanceSubmission.ts:188) is also undefined, because routes is empty. As a result, only the waypoints are sent (Split.ts:2319).
    5. When the request has no distance, the server calculates the map distance from the waypoints. That map distance replaces the manually edited value.

    Other candidates ruled out: The investigator checked the distance, waypoint, route, and confirmation changes among the 64 PRs in Deploy Checklist: New Expensify 2026-10-06. Split useExpenseSubmission hook only moves distance logic into new files. Fix - DEV: Rate not valid error is displayed when submitting a distance expense, but the Rate field is not editable only deals with rate validity.

    Fix if rolling forward:

    • In selectReusableRoute, also store the route distance in meters, for example in routes.route0.distance. The reused route should return meters, or include its unit, so the App can convert the value correctly. Today it returns a number with no unit, which also causes 103270.
    • At submit time, fall back to the reused distance when no route was fetched:
      selectedRouteDistance: getSelectedRouteDistance(transaction)
          ?? (transaction.isReusedRoute ? getDistanceInMeters(transaction, unit) : undefined),
    • Confirm that the backend uses selectedRouteDistance even when the App didn't fetch the route itself.
    • Product question: when the source distance was edited manually, should Reuse route keep the edit or use the map distance? Either way, the confirm page and the saved expense must match.

    view run

  10. ShridharGoel commented on Oct 7, 2026

    @ShridharGoel
    Contributor

    @JmillsExpensify What would be the expectation here?

  11. JmillsExpensify commented on Oct 7, 2026

    @JmillsExpensify
    Contributor

    Good question. We should use the map calculation, not the user overrides, because the feature is re-using the route, not duplicating an expense (which is a distinct flow).

  12. ShridharGoel commented on Oct 7, 2026

    @ShridharGoel
    Contributor

    Thanks, closing

  13. added
    Reviewing
    on Oct 7, 2026
  14. removed
    DeployBlockerCash
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourlyReviewing

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions