Skip to content

Expense - Original split remains after splitting undeleted split #91875

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.3.84-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: #84382
Email or phone of affected tester (no customers): sdjoisjndiosdjiodnsjio@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 self DM.
  3. Create a manual expense.
  4. Open the expense.
  5. Click More > Split > Save.
  6. Go to Spend > Expenses.
  7. Select both splits via checkbox.
  8. Click dropdown button > Delete > Delete.
  9. Enter status:deleted on search field and search.
  10. Select one of the deleted splits via checkbox.
  11. Click dropdown button > Undelete.
  12. Go to self DM.
  13. Open the undeleted split.
  14. Click Amount.
  15. Click Save.

Expected Result:

The original split will disappear after splitting undeleted split.

Actual Result:

The original split remains after splitting undeleted split.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7164517_1779905213082.5.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Activity

  1. applause-bot commented on May 27, 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/926668a2f1c5edb554d1e598aa73b08940061a1f2b790ad89309d565e7f1a830

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 27, 2026
  3. melvin-bot commented on May 27, 2026

    @melvin-bot

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

  4. melvin-bot commented on May 27, 2026

    @melvin-bot

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

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

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a split child transaction is deleted and then undeleted, its split metadata (comment.originalTransactionID and comment.source = 'split') is preserved. The undelete flow in changeTransactionsReport only clears comment.hold but keeps these split-related fields intact.

    When the user then re-splits this undeleted transaction, initSplitExpense reads comment.originalTransactionID, detects it as an existing split child, and enters the split-edit flow rather than creating a fresh split.

    Meanwhile, getChildTransactions only filters out transactions with pendingAction === DELETE — it does not filter out transactions with reportID === TRASH_REPORT_ID (deleted). So any deleted sibling transactions still loaded in Onyx (from the earlier search) are counted as valid split children. This causes the split update logic to create new children without properly cleaning up the stale original split structure, leaving the original split visible.

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

    Option A (Recommended): When undeleting a transaction, clear the split metadata. In changeTransactionsReport (src/libs/actions/Transaction.ts), when moving a transaction out of TRASH_REPORT_ID, also clear comment.originalTransactionID and comment.source so the transaction becomes an independent expense that can be freshly split.

    Option B: Update getChildTransactions in src/libs/TransactionUtils/index.ts to also filter out deleted transactions (reportID === TRASH_REPORT_ID), preventing deleted siblings from being counted as valid split children. This is a narrower fix that addresses the symptom but doesn't fully clean up stale split metadata on undelete.

    What alternative solutions did you explore?

    Option B above. It would prevent the immediate bug but leaves the undeleted transaction in a conceptually inconsistent state — it still thinks it's a split child (via comment.originalTransactionID) even though its parent split no longer exists in a meaningful way. Option A is cleaner because it ensures undeleted transactions start fresh.

    Investigation details

    Key code locations:

    Repro flow explained:

    1. Split creates children with comment.originalTransactionID → parent and comment.source → 'split'
    2. Delete sets reportID = '-1' (TRASH_REPORT_ID); deleteMoneyRequest nulls transaction in Onyx
    3. status:deleted search reloads deleted transactions into Onyx with all comment fields intact
    4. Undelete changes reportID from '-1' to '0' (UNREPORTED_REPORT_ID) but preserves split comment fields
    5. Re-splitting enters wrong code path due to stale originalTransactionID, causing incomplete cleanup

    Confidence: Medium-High — code evidence strongly supports this hypothesis. The stale metadata path is clearly traceable. Ideally production logs would confirm the exact Onyx state post-undelete.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. lakchote commented on May 28, 2026

    @lakchote
    Contributor

    Since we've added the guard to hide the selfDM splits feature in production in the PR #91932, I'm going to remove the deploy blocker label @mountiny

  8. 9 remaining items

  9. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    @lakchote @ZhenjaHorbach this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  10. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    @ZhenjaHorbach 12 days overdue now... This issue's end is nigh!

  11. lakchote commented on Jun 11, 2026

    @lakchote
    Contributor

    Not overdue - App #91932 is merged, the production guard is in place, and QA no longer reproduces the self-DM split blocker path.

  12. lakchote commented on Jun 15, 2026

    @lakchote
    Contributor

    Not overdue - the production guard is already merged and QA no longer reproduces the self-DM split blocker path.

  13. melvin-bot commented on Jun 15, 2026

    @melvin-bot

    This issue has not been updated in over 14 days. @lakchote, @ZhenjaHorbach eroding to Weekly issue.

  14. m-natarajan commented on Jul 1, 2026

    @m-natarajan

    Chrome / v9.4.25-1
    Passed

    REC-20260701173704.mp4
  15. lakchote commented on Jul 1, 2026

    @lakchote
    Contributor

    Not overdue ^ we can close this one.

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.EngineeringWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions