Skip to content

Per diem - No option to delete unreported per diem split expense #97397

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): iosjdnojsdoijdisojiso@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:

Precondition:

  • Workspace has per diem rates.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a per diem expense.
  4. Open the expense.
  5. Click More > Split > Save.
  6. Open any split.
  7. Click More.

Expected Result:

Delete option will be shown.

Actual Result:

Delete option is missing for unreported per diem split expense.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Recording.6118.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7221271

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 29, 2026
  2. applause-bot commented on Jul 29, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:

  3. melvin-bot commented on Jul 29, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jul 29, 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 29, 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 29, 2026

    @melvin-bot

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

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

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug (App)
    Causing PR: Not #92055. That PR ("Fix bugs for selfDM splits feature" by @ZhenjaHorbach) is part of the self-DM splits feature and was auto-assigned because it was recently merged, but it does not touch the code that decides whether the "More" menu shows Delete vs Edit splits (Low confidence it is the direct cause — see Evidence). The behavior comes from the self-DM per-diem split redirect logic in shouldRedirectDeleteToSplitExpenseEdit.
    Related Issues: none

    Recommendation: NEEDS INVESTIGATION

    For an unreported (self-DM) per-diem split with more than one split, the delete affordance is intentionally relabeled from Delete to Edit splits (icon changes from trashcan to split). When only one split remains it reverts to Delete. This looks like deliberate design for per-diem rebalancing, so the feature owners should confirm whether "Edit splits" replacing "Delete" for multi-split unreported per-diem is intended. Reverting #92055 would not fix this (it does not own the relevant code), so a revert is not appropriate; if the QA expectation is correct, a targeted one-line fix in shouldRedirectDeleteToSplitExpenseEdit is the resolution (see Root Cause).

    Assigned: @ZhenjaHorbach (PR #92055 author), @lakchote and @dmkt9 (reviewers) are already assigned by melvin-bot as the self-DM splits feature owners; no additional assignees added (low confidence in a single specific causing PR).
    Labels: No changes. DeployBlockerCash kept (Frontend/App feature bug, added via the deploy-blocker flow, not reproducible in production). No DeployBlocker (Web) label is present, so nothing to remove.

    📋 Detailed Analysis

    Evidence

    • The "More" menu on an opened split is rendered by MoneyRequestHeaderSecondaryActions.tsx. The DELETE entry's label/icon is swapped to Edit splits when shouldShowEditSplitOnDeleteAction is true:
    • shouldShowEditSplitOnDeleteAction → shouldOpenSplitExpenseEditFlowOnDelete → getSplitExpenseEditTransactionOnDelete (L106-L139), which for a self-DM per-diem split with multiple children returns the transaction (→ true) → the menu shows Edit splits, not Delete.
    • The core gate is shouldRedirectDeleteToSplitExpenseEdit (L2940-L2959): for a split whose source is a per-diem request, the non-production branch returns true for any self-DM split — L2952-L2957. Manual (non per-diem) splits fall through to return false at L2952-L2953, which is why manual splits show Delete but per-diem splits show Edit splits.
    • Why Fix bugs for selfDM splits feature #92055 is not the direct cause: its file list contains useDeleteTransactions.ts and TransactionUtils/index.ts, but the specific changes are unrelated to this menu decision. In useDeleteTransactions.ts it modified the deleteTransactions reduce (moved-expense split-child grouping) around L225 — not getSplitExpenseEditTransactionOnDelete. In TransactionUtils/index.ts it added distance-rate fallback and a new isSplitContainerTransaction helper — it did not modify shouldRedirectDeleteToSplitExpenseEdit. It did not touch MoneyRequestHeaderSecondaryActions.tsx or ReportSecondaryActionUtils.ts at all.
    • Production vs staging: shouldRedirectDeleteToSplitExpenseEdit has an isProduction branch; the "self-DM per-diem split → redirect to edit" behavior only applies in non-production, consistent with the report ("N/A - new feature, doesn't exist in prod"). This is a staging-only, in-development feature.

    Verification

    • Affected file that renders the menu label: src/components/MoneyRequestHeaderSecondaryActions.tsx (L222, L447-L449).
    • Decision helpers: src/hooks/useDeleteTransactions.ts (L106-L139) and src/libs/TransactionUtils/index.ts (L2940-L2959).
    • The DELETE action itself is still added to the options list via ReportSecondaryActionUtils.getSecondaryTransactionThreadActions → isDeleteAction (L1216-L1220) → canDeleteMoneyRequestReport (L3214-L3251), which has no per-diem branch. So the entry exists for both manual and per-diem splits — only the label differs. That is why testers perceive "Delete is missing" (they see Edit splits).
    • I could not git blame/bisect to pin the exact PR that introduced the isSelfDMSplit branch: the GitHub GraphQL blame endpoint returns HTTP 502 on these large files, and the local App checkout is a depth-1 shallow clone (single commit, no history). Permalinks above are pinned to current main HEAD 3db5c7574d8022a4b203aace8b4e08623bc17ed5.

    Root Cause

    The self-DM per-diem split feature deliberately routes deletion through the "Edit splits" flow when multiple splits exist (so the per-diem total can be redistributed via redistributeRemainingPerDiemSplitExpenses). The if (isSelfDMSplit) return true branch in shouldRedirectDeleteToSplitExpenseEdit (L2955-L2957) makes every self-DM per-diem split use this redirect in staging, so the menu reads Edit splits instead of Delete. If product intent is that unreported per-diem splits should be directly deletable (matching the QA expectation), the targeted fix is to stop returning true unconditionally for self-DM per-diem splits in that branch (e.g. only redirect when it is a reported/workspace per-diem split, mirroring the production branch), which restores the Delete label without reverting the broader feature PR.

  9. lakchote commented on Jul 30, 2026

    @lakchote
    Contributor

    Not a blocker, unreported splits are hidden on production #91932

  10. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jul 30, 2026
  11. lakchote commented on Jul 30, 2026

    @lakchote
    Contributor

    We hide the delete button because per diem splits should have the same amount as original transaction, and delete button can break this requirement.

    Closing this issue.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions