Skip to content

[Due for payment 2026-06-19] [Due for payment 2026-06-18] [$250] Expense - Error when splitting distance expense in 1:1 DM #93238

Closed

Description

@applause-bot

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.4.5-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #92052
Email or phone of affected tester (no customers): jsodinjosdjsoinjsiojs@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. Open 1:1 DM with any user.
  3. Click + > Split expense > Distance.
  4. Enter waypoints > Next.
  5. Click Split.

Expected Result:

Distance expense will be split in 1:1 DM without issue.

Actual Result:

Error shows up after splitting distance expense in 1:1 DM.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7177430_1781135556679.9.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7177430

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

Activity

  1. applause-bot commented on Jun 11, 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/7ac97aa2ca8c6e140d2e9aa5eaff0e93e173630cc1319e3faab40f066d1c8fec

  2. added
    DeployBlockerCash
    Bug
    on Jun 11, 2026
  3. melvin-bot commented on Jun 11, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 11, 2026

    @melvin-bot

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

  5. github-actions commented on Jun 11, 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 Jun 11, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    ⚠️ Medium confidence. Strong leading suspect identified, but one gap remains unexplained (see "Open question"). I couldn't view the Applause video to confirm the exact on-screen error, so please verify before merging a fix.

    Leading suspect: PR #92052 migrated SPLIT_BILL_DETAILS from a static route that carried reportID in the path (r/:reportID/split/:reportActionID) to a dynamic-suffix route that drops it (split/:reportActionID). The split-details page now relies on inheriting reportID from the active route instead of reading it from its own path segment — a more fragile resolution that can land you on a not-found / "Failed to parse the path" state when the split preview is tapped.

    Why this PR: It's the only change to the split-details flow in this deploy, it's the regression reference on the issue, and "reproducible in staging, not production" matches a freshly-merged routing change (production still uses the old r/:reportID/split/:reportActionID route).

    Recommended action (deploy blocker): Revert the SPLIT_BILL_DETAILS portion of #92052 (the room-members migration in the same PR is a separate flow and can stay). A forward-fix would be to re-add reportID to the path (split/:reportID/:reportActionID) and pass it at the two call sites, restoring the old guarantee that reportID is always in the URL.

    Mechanism & evidence
    • Navigation to split details now builds the URL by appending split/<actionID> to the current active route via createDynamicRoute (createDynamicRoute.ts:64-72), called from MoneyRequestAction.tsx:89 and ChatTransactionPreview.tsx:59.
    • The page resolves the report via withReportAndReportActionOrNotFound, which reads route.params.reportID (withReportAndReportActionOrNotFound.tsx:41). Since the new path no longer contains :reportID, this value must be inherited from the parent REPORT screen's params during path parsing — if that inheritance fails, reportID is undefined and the page renders FullPageNotFoundView (DynamicSplitBillDetailsPage.tsx:106).
    • The split preview's onPreviewPressed is the trigger; nothing auto-navigates to split details after pressing "Split", so the error surfaces when the freshly-created split preview is tapped (which matches the PR's own QA step "Tap the split preview in chat").
    Open question — distance-specificity not fully explained

    The PR's QA steps tested a regular amount split in a 1:1 DM and reported it working. The split-details page renders identically for distance and regular splits (the distance branch only flips isMapDistanceRequest/scanning UI — DynamicSplitBillDetailsPage.tsx:79-127). So if the route fully broke reportID resolution, a regular split would fail too — which contradicts the PR QA. That leaves two possibilities I could not disambiguate without the video:

    1. Navigation timing/param-resolution edge case that only manifests for the distance flow (e.g. the screen the user lands on after a distance split differs from a regular split, so createDynamicRoute appends to a route not in the SPLIT_BILL_DETAILS entryScreens list).
    2. A separate distance-specific error unrelated to 83856 migrate room v2 #92052 — e.g. a backend rejection on the distance split itself surfacing as a red error indicator on the transaction, not a navigation error.

    To verify: reproduce on staging, tap the distance split preview, and capture (a) a screenshot of the exact error and (b) the JS console output. A "Failed to parse the path to a navigation state" or a not-found page confirms the routing hypothesis → revert. A red error dot on the transaction with a backend message points to possibility #2 → not this PR.


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

  7. mjasikowski commented on Jun 11, 2026

    @mjasikowski
    Contributor

    Caused by #84791

  8. mjasikowski commented on Jun 11, 2026

    @mjasikowski
    Contributor

    @MelvinBot this is caused by #84791, can you suggest a solution?

  9. MelvinBot commented on Jun 11, 2026

    @MelvinBot
    Contributor

    Proposal

    Confirming mjasikowski's call — the root cause is PR #84791, and my earlier route-migration hypothesis (#92052) was wrong. High confidence.

    Root cause

    PR #84791 replaced the hardcoded CONST.CURRENCY_TO_DEFAULT_MILEAGE_RATE map with a P2P rate fetched from Auth into Onyx (DEFAULT_P2P_MILEAGE_RATE), read synchronously via getStoredDefaultP2PMileageRate(). The fetch trigger, getDefaultP2PMileageRate(), is wired into exactly one place — startDistanceRequest (MoneyRequest.ts:451) — and every caller of that passes SUBMIT/TRACK/CREATE.

    The Split flow never goes through startDistanceRequest. The + → Split expense button calls startMoneyRequest(CONST.IOU.TYPE.SPLIT, …), and startMoneyRequest does not prefetch the rate. So for a split-distance the Onyx value stays undefined, and getRateForP2P (DistanceRequestUtils.ts:294) hits its fallback branch — a flat 67¢/mile, with unit/currency derived from the draft transaction instead of the user's outputCurrency. That inconsistent optimistic transaction is sent to CREATE_DISTANCE_REQUEST and gets rejected, surfacing as the error after Split. (Pre-#84791 this couldn't happen — the rate was a synchronous CONST lookup.)

    Recommended fix (deploy-blocker-safe)

    Add the prefetch to startMoneyRequest, mirroring what startDistanceRequest already does — one line:

    function startMoneyRequest(...) {
        const sourceRoute = Navigation.getActiveRoute();
        getDefaultP2PMileageRate();   // ← add this
        startSpan(...)

    This covers every Split/Submit/Track launch that goes through startMoneyRequest, and is a cheap no-op API.read for non-distance flows. getDefaultP2PMileageRate is already exported and imported in this file.

    Secondary hardening (follow-up, not deploy-blocking) + caveats
    • The prefetch is fire-and-forget (no await). For the split flow the user manually enters waypoints + taps Next, so the API.read realistically lands first — but to fully close the latent race, make the fallback in getRateForP2P return a currency matching the currency argument the caller passed (not getCurrency(transaction)), so a missed prefetch never produces a mis-currency'd transaction. Note the fallback rate is still a flat USD-per-mile constant, so a non-USD user would get a wrong amount even then — prefetching is the real fix.
    • One unconfirmed detail: I could not view the Applause video, so the exact on-screen error string isn't verified. The mechanism (bad optimistic unit/currency → CREATE_DISTANCE_REQUEST rejection → red error on the split action) is High confidence from code; the precise backend message is Medium. Staging logs for failed CREATE_DISTANCE_REQUEST around v9.4.5-0 (non-USD personal outputCurrency) would confirm.

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

  10. mjasikowski commented on Jun 11, 2026

    @mjasikowski
    Contributor

    @MelvinBot implement this

  11. 30 remaining items

  12. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    @situchan Eep! 4 days overdue now. Issues have feelings too...

  13. added
    Awaiting Payment
    on Jun 18, 2026
  14. melvin-bot commented on Jun 18, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Jun 18, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2065098537702017702/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. situchan commented on Jun 18, 2026

    @situchan
    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/84791/changes#r3439084115

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

    • [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: https://github.com/Expensify/Expensify/issues/650700

    Regression Test Proposal

    Test:

    1. Open 1:1 DM with any user.
    2. Click + > Split expense > Distance.
    3. Enter waypoints > Next.
    4. Click Split.
    5. Verify that distance expense is split in 1:1 DM without issue.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-bbea-aecc-1654-062f151d8ee4
  17. mallenexpensify commented on Jun 20, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @situchan due $250 via NewDot

    ^ Test case created. Thx

  18. MelvinBot commented on Jul 3, 2026

    @MelvinBot
    Contributor

    ✅ Verified — splitting a distance expense in a 1:1 DM completes without an error

    Tested on web (dev NewDot) by walking the exact repro steps: opened a 1:1 DM, went + > Split expense > Distance, entered two waypoints (New York → Los Angeles), pressed Next, then Split.

    The split completed cleanly — no error dialog appeared, and the result posted to the chat (split of $2,024.71 for 2792.71 miles, with the other party owing $1,012.36). The accessibility tree contained no Error text and there were no console errors.

    Confirm details (before Split) After Split (result in chat)
    Confirm details screen before clicking Split, showing $2,024.71 for 2792.71 miles Chat after Split completed showing the split message with no error
  19. laurenreidexpensify commented on Jul 7, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @situchan

  20. MelvinBot commented on Jul 9, 2026

    @MelvinBot
    Contributor

    ⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.

    Run details

  21. MelvinBot commented on Jul 9, 2026

    @MelvinBot
    Contributor

    🤖 Recording-pipeline smoke test — could not reach the target flow (blocked at sign-in).

    I could not verify splitting a distance expense in a 1:1 DM because sign-in was blocked twice, so per the run instructions I stopped rather than retrying in a loop. The dev server started and the app rendered fine — the blocker is authentication, not the feature under test. Recordings were still captured and are linked below.

    What blocked sign-in (two attempts, two different accounts):

    • melvinbottestuser@gmail.com (and its +alias variants): the backend returns an "email provider has temporarily suspended emails … due to delivery issues" screen — no magic-code entry appears.
    • @expensify.com address: the magic-code screen appeared, but the staging backend rejected the dev code 000000 (SigninUser → x-jsoncode: 666, invalid code). Staging requires the real emailed code, not the local-dev shortcut.
    Verification checklist
    Check Status Evidence
    Dev server starts & serves app ✅ pass Webpack compiled, sign-in page renders
    Sign-in via throwaway gmail alias ❌ fail "email provider temporarily suspended" error, no magic-code screen
    Sign-in via @expensify.com + code 000000 ❌ fail SigninUser returned x-jsoncode: 666 on two attempts
    Split distance expense in 1:1 DM (no error) ⚠️ not reached Never got past sign-in

    Attachments (all recordings included):

    Email delivery suspended error for melvinbottestuser gmail alias
    Magic code 000000 rejected on staging backend (error 666)

    ▶ Web session recordings (2)

    To unblock a future run: seed the browser session with a pre-authenticated token, or use a test account/backend where the 000000 magic code is accepted.

  22. MelvinBot commented on Jul 22, 2026

    @MelvinBot
    Contributor

    🤖 Verified — the fix works. No error on splitting a distance expense in a 1:1 DM.

    I ran the "Action Performed" steps on web (dev NewDot):

    1. Opened a 1:1 DM.
      • → Split expense → Distance.
    2. Entered waypoints (New York, NY → Boston, MA, 222.31 mi) → Next.
    3. Tapped Split.

    Result: The split expense was created successfully in the DM with no error. The total ($161.17) was split evenly and the DM now shows the expense card (a@a.com owes $80.58 · Distance · 111.14 mi @ $0.725/mi). No error alert or toast appeared. ✅

    Final state: 1:1 DM showing the successfully created distance split expense with no errors

  23. MelvinBot commented on Jul 22, 2026

    @MelvinBot
    Contributor

    ✅ Verified — no error, the fix holds

    I ran the reproduction steps from the Action Performed section on the current build (NewDot) and the distance expense split completed successfully in the 1:1 DM with no error.

    Steps run:

    1. Opened a 1:1 DM.
    2. + → Split expense → Distance tab.
    3. Added Start (1 Apple Park Way, Cupertino) and Stop (Googleplex, Mountain View) waypoints → Next.
    4. On the confirm page (10.46 mi, $7.58 split evenly) → clicked Split.

    Result: The split posted cleanly — the DM shows split $7.58 for 10.46 miles, owes $3.79, and the distance expense card (Distance, 5.23 mi @ $0.725/mi — $3.79). No red error banner, no "Unexpected error"/"Something went wrong" toast, and no console errors.

    This matches the Expected Result ("Distance expense will be split in 1:1 DM without issue"), so the shipped fix is confirmed working.

    Evidence

    Split submitted — split expense card in the DM, no error

    DM chat after split submitted showing split expense card with distance and amount - no error

    Final state — outstanding distance expense, View button, no error

    Final DM state showing outstanding expense 5.23 mi @ $0.725/mi = $3.79 with View button - no error

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions