Skip to content

Split expense- Error appears when split distance expense in self dm #97436

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: 9.4.46-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: #92055
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Exploratory - Critical User Impact
Device used: Windows 11 Home/Chrome
App Component: Money Requests

Action Performed:

Preconditions:

  • Create new account, Create 2 workspaces
  • In OD, make personal workspace as default
  1. Open https://staging.new.expensify.com/
  2. Go to Self DM
  3. Create a distance expense
  4. Open the expense
  5. Tap on More
  6. Tap on Split
  7. Tap on Save

Expected Result:

Expense can be splitted

Actual Result:

Error appears when split expense.
Tap on any splitted expense, error appears on Rate field

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7221496_1785383356960.error_appears.mp4

View all open jobs on GitHub

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

Activity

  1. added
    DeployBlockerCash
    Bug
    on Jul 30, 2026
  2. applause-bot commented on Jul 30, 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/897bb5eb139473b601ef55a8e3add5226d44179b2c9aa866480b88b272e66124

  3. melvin-bot commented on Jul 30, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jul 30, 2026

    @melvin-bot

    @lakchote @dmkt9 you have been assigned to this deploy blocker because you reviewed the offending PR: #92055

  5. melvin-bot commented on Jul 30, 2026

    @melvin-bot

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

  6. melvin-bot commented on Jul 30, 2026

    @melvin-bot

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

  7. github-actions commented on Jul 30, 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. MelvinBot commented on Jul 30, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #92055 - "Fix bugs for selfDM splits feature" by @ZhenjaHorbach (High confidence)
    Related Issues: This PR is part of the unreleased self-DM splits feature (fixes #91874, #91876, #91879, #91907, #91913, #91917, #91918, #91920)

    Recommendation: ROLL FORWARD

    The failing behavior lives entirely in a small, well-isolated block that #92055 changed, and a targeted fix is far safer than reverting a 2,100+ line PR that fixes eight other self-DM split bugs (a revert would reintroduce those). Recommend a follow-up that corrects the isCustomUnitOutOfPolicy logic for self-DM P2P distance splits.

    Assigned: @ZhenjaHorbach (PR author), @lakchote and @dmkt9 (approving reviewers) — all already auto-assigned to this blocker.
    Labels: No change. Kept DeployBlockerCash (App deploy is blocked — this is a frontend bug fixed in Expensify/App). DeployBlocker was not present, so nothing to remove.

    📋 Detailed Analysis

    Evidence

    • Fix bugs for selfDM splits feature #92055 is on the current StagingDeployCash checklist for release 9.4.46, and merged 2026-07-29, one day before this blocker was reported (2026-07-30).
    • Its title — "Fix bugs for selfDM splits feature" — and its changed files map directly to this bug's area: src/pages/iou/SplitExpenseEditPage.tsx, src/libs/actions/IOU/SplitExpenseItems.ts, src/libs/actions/IOU/Split.ts, src/libs/DistanceRequestUtils.ts, and IOURequestStepDistanceRate.tsx.
    • The reported symptom — "Tap on any splitted expense, error appears on Rate field" — is the violation string violations.customUnitOutOfPolicy = "Rate not valid for this workspace" (src/languages/en.ts#L9772).
    • The whole self-DM split feature is new and not in production, so this is App-side (frontend). Reproducible on staging only, which is consistent.

    Verification

    • Affected file/line: src/pages/iou/SplitExpenseEditPage.tsx#L207-L218 — isCustomUnitOutOfPolicy feeds getErrorForField('customUnitRateID'), which is what renders the error text and brick-road indicator on the Rate row (L262-L269).
    • Confirmed Fix bugs for selfDM splits feature #92055 modifies this exact block. The PR diff rewrites the self-DM branch of isCustomUnitOutOfPolicy:
      • Before: const isCustomUnitOutOfPolicy = isSelfDMSplit ? isRateBroken : !rates[currentRateID] || (isDistance && !rate);
      • After: isSelfDMSplit ? isRateBroken || (isDistance && isP2PRate && (hasAvailableEnabledRates || shouldSelectPolicy)) : ...
    • The current checkout (staging 9.4.46-3) already contains this change, confirming it landed.

    Root Cause

    A self-DM distance expense uses the P2P/personal rate (CONST.CUSTOM_UNITS.FAKE_P2P_ID), so isP2PRate === true. Before #92055, a self-DM split with a P2P rate was not flagged out of policy (isRateBroken is false for a P2P rate, since isRateBroken requires !isP2PRate).

    After #92055, the new clause (isDistance && isP2PRate && (hasAvailableEnabledRates || shouldSelectPolicy)) flips isCustomUnitOutOfPolicy to true whenever the user has any other enabled distance rate available or shouldSelectPolicy is set. The bug's preconditions — two workspaces created, with the personal workspace set as default in OD — guarantee exactly that state (hasAvailableEnabledRates/shouldSelectPolicy are true, and no workspace policy is resolved for the self-DM context). As a result, getErrorForField('customUnitRateID') returns "Rate not valid for this workspace" and paints the Rate field red on every split item, even though a valid P2P rate exists — so the split cannot complete as expected.

    The intent of the new clause appears to be nudging the user to pick a real workspace rate, but for a valid self-DM P2P distance split it produces a false error state and blocks the flow (expected result per QA: "Expense can be splitted"). The fix should scope this clause so a valid self-DM P2P rate is not reported as out-of-policy. The companion rate-resolution change in SplitExpenseItems.ts#L672-L688 (which deliberately falls back to the original transaction's rate for the P2P case) should be reconciled with the edit-page's out-of-policy check so the two agree on P2P handling.

  9. added
    Daily
    and removed
    DeployBlockerCash
    Hourly
    on Jul 30, 2026
  10. lakchote commented on Jul 30, 2026

    @lakchote
    Contributor

    This is expected, see https://expensify.slack.com/archives/C01GTK53T8Q/p1785417436218129?thread_ts=1785399819.129099&cid=C01GTK53T8Q

    We can fix the error by selecting a group workspace as default instead of a personal one.

    Closing.

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions