Skip to content

[Awaiting checklist] [$250] Distance - System message shows "changed the expense" after editing distance split #83500

Closed

Description

@vincdargento

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.26-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: #82257
Email or phone of affected tester (no customers): sdjoisnjdosnjdosjoi@gmail.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:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a map distance expense.
  4. Open the expense.
  5. Click More > Split > Save.
  6. Open any split.
  7. Click Amount.
  8. Click on the highlighted row.
  9. Click Distance > edit waypoints > Save > Save.
  10. Open the edited split.

Expected Result:

System message will show "changed the distance to y mi @ RM0.725 / mi (previously x mi @ RM0.725 / mi), which updated the amount to q (previously p)".

Actual Result:

System message shows "changed the expense".

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @garrettmknight
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022026789585435847655
  • Upwork Job ID: 2026789585435847655
  • Last Price Increase: 2026-02-25

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    on Feb 25, 2026
  2. melvin-bot commented on Feb 25, 2026

    @melvin-bot

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

  3. melvin-bot commented on Feb 25, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 25, 2026

    @melvin-bot

    Triggered auto assignment to @sonialiap (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 Feb 25, 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. OSBotify commented on Feb 25, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #82257 - "feat: handle the Distance and Rate fields for splits" by @ZhenjaHorbach (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #82257 introduced a regression in system messages for distance split expenses. While the PR successfully added distance and rate field handling for splits, it did not properly set the required fields (modifiedMerchant, modifiedAmount, modifiedCurrency) needed to generate detailed system messages when editing distance splits. This causes the generic "changed the expense" message instead of the expected detailed distance change message.

    Labels: Keeping DeployBlockerCash (App deploy is blocked), removed DeployBlocker (not a backend issue)


    Evidence

    • PR feat: handle the Distance and Rate fields for splits #82257 was merged on 2026-02-24 and is in the StagingDeployCash list for version 9.3.26-4
    • Bug only appears on staging (9.3.26-0), not production (new feature)
    • Bug is specific to distance split expenses after editing distance
    • melvin-bot correctly identified and assigned this to the PR author

    Root Cause

    When updating distance split expenses, the system message generation code expects modifiedMerchant to be in distance format (e.g., "10 mi @ $0.725 / mi"). However, PR #82257 did not properly set this field during the split transaction update flow, causing the fallback to the generic "changed the expense" message instead of the detailed distance change message.

  7. MelvinBot commented on Feb 25, 2026

    @MelvinBot
    Contributor

    Proposal

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

    After editing waypoints on a distance split expense, the system message shows a generic "changed the expense" instead of the expected detailed message like "changed the distance to y mi @ RM0.725 / mi (previously x mi @ RM0.725 / mi), which updated the amount to q (previously p)".

    What is the root cause of that problem?

    When a split child transaction's waypoints are edited, the code flow through Split.ts → getUpdateMoneyRequestParams (IOU/index.ts) deliberately skips creating the optimistic MODIFIED_EXPENSE report action when waypoints are present in transactionChanges.

    The evidence chain:

    1. Split.ts:1308 calls getUpdateMoneyRequestParams with transactionChanges containing waypoints, merchant, amount, etc.
    2. IOU/index.ts:4557 sets hasPendingWaypoints = true because 'waypoints' in transactionChanges
    3. IOU/index.ts:4591-4592 builds the optimistic MODIFIED_EXPENSE report action
    4. IOU/index.ts:4594: The condition if (!hasPendingWaypoints && ...) evaluates to false, so the built report action is discarded — it is not pushed to optimisticData and reportActionID is not set in apiParams

    The comment at lines 4584-4590 explains the design intent:

    We don't create a modified report action if we're updating the waypoints... there isn't valid optimistic mileage data we can use, and the report action is created on the server with the distance-related response from the MapBox API

    This makes sense for non-split distance edits, where the server receives the UPDATE_MONEY_REQUEST_DISTANCE command, calls MapBox, computes the route, and generates the MODIFIED_EXPENSE action server-side. However, for split child transactions processed via the SplitTransaction API command, the server does not generate the distance-specific MODIFIED_EXPENSE action the same way, resulting in the generic fallback message.

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

    In src/libs/actions/IOU/index.ts:4594, the condition should be relaxed for split transactions to allow the optimistic MODIFIED_EXPENSE to be created even when waypoints are pending:

    The check !hasPendingWaypoints should become (!hasPendingWaypoints || isSplitTransaction).

    For split transactions, this is safe because the transactionChanges from the split flow already includes the recalculated merchant (the distance string like "10.00 mi @ $0.70 / mi") and amount from the split data. The existing message generation code in getModifiedExpenseOriginalMessage (ReportUtils.ts:5455-5471) will properly set originalMessage.merchant and originalMessage.amount from transactionChanges, and ModifiedExpenseMessage.ts:307 will detect the distance merchant format (contains @) and call getForDistanceRequest to produce the correct detailed message.

    What alternative solutions did you explore? (Optional)

    An alternative would be to fix the server-side SplitTransaction handler to generate the distance-specific MODIFIED_EXPENSE action for split child waypoint changes (similar to how UPDATE_MONEY_REQUEST_DISTANCE works). However, the frontend fix is simpler, more immediate, and consistent with how the split flow already handles other field changes optimistically.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  8. 24 remaining items

  9. changed the title [-][$250] Distance - System message shows "changed the expense" after editing distance split[/-] [+][Awaiting checklist] [$250] Distance - System message shows "changed the expense" after editing distance split[/+] on Mar 17, 2026
  10. removed
    Reviewing
    Help Wanted
    on Mar 17, 2026
  11. ShridharGoel commented on Mar 20, 2026

    @ShridharGoel
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/82257/changes#r2966112260

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Go to staging.new.expensify.com
    2. Go to a workspace chat
    3. Create a map distance expense
    4. Open the expense
    5. Click More > Split > Save
    6. Open any split
    7. Click Amount
    8. Click on the highlighted row
    9. Click Distance > edit waypoints > Save > Save
    10. Open the edited split
    11. Verify the system message shows "changed the distance to y mi @ 0.725 / mi (previously x mi @ 0.725 / mi), which updated the amount to q (previously p)" instead of the generic "changed the expense"
    12. Also verify that editing a non-split distance expense still works correctly

    Do we agree 👍 or 👎

  12. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    @garrettmknight Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  13. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    @garrettmknight Whoops! This issue is 2 days overdue. Let's get this updated quick!

  14. added
    Daily
    and removed
    Daily
    on Mar 22, 2026
  15. garrettmknight commented on Mar 24, 2026

    @garrettmknight
    Contributor

    Payment summary:

  16. JmillsExpensify commented on Apr 6, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @ShridharGoel

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions