You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expense - Original split remains after splitting undeleted split #91875
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:
Go to staging.new.expensify.com
Go to self DM.
Create a manual expense.
Open the expense.
Click More > Split > Save.
Go to Spend > Expenses.
Select both splits via checkbox.
Click dropdown button > Delete > Delete.
Enter status:deleted on search field and search.
Select one of the deleted splits via checkbox.
Click dropdown button > Undelete.
Go to self DM.
Open the undeleted split.
Click Amount.
Click Save.
Expected Result:
The original split will disappear after splitting undeleted split.
Actual Result:
The original split remains after splitting undeleted split.
👋 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:
Identify the pull request that introduced this issue and revert it.
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:
Transaction.ts:1090-1104 — changeTransactionsReport preserves comment.originalTransactionID during undelete
status:deleted search reloads deleted transactions into Onyx with all comment fields intact
Undelete changes reportID from '-1' to '0' (UNREPORTED_REPORT_ID) but preserves split comment fields
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.
@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!
Activity
applause-bot commentedon May 27, 2026
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
melvin-bot commentedon May 27, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #84382
melvin-bot commentedon May 27, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 27, 2026
👋 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:
MelvinBot commentedon May 27, 2026
Proposal
What is the root cause of that problem?
When a split child transaction is deleted and then undeleted, its split metadata (
comment.originalTransactionIDandcomment.source = 'split') is preserved. The undelete flow inchangeTransactionsReportonly clearscomment.holdbut keeps these split-related fields intact.When the user then re-splits this undeleted transaction,
initSplitExpensereadscomment.originalTransactionID, detects it as an existing split child, and enters the split-edit flow rather than creating a fresh split.Meanwhile,
getChildTransactionsonly filters out transactions withpendingAction === DELETE— it does not filter out transactions withreportID === 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 ofTRASH_REPORT_ID, also clearcomment.originalTransactionIDandcomment.sourceso the transaction becomes an independent expense that can be freshly split.Option B: Update
getChildTransactionsinsrc/libs/TransactionUtils/index.tsto 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:
Transaction.ts:1090-1104—changeTransactionsReportpreservescomment.originalTransactionIDduring undeleteSplitExpenses.ts:105-108—initSplitExpensedetects stale split metadataTransactionUtils/index.ts:2793-2801—getChildTransactionsdoesn't filter deleted transactionsSplitTransactionUpdate.ts:202—isCreationOfSplitsdepends on child countSplitTransactionUpdate.ts:1450-1459— original transaction hidden viaSPLIT_REPORT_IDRepro flow explained:
comment.originalTransactionID→ parent andcomment.source→'split'reportID = '-1'(TRASH_REPORT_ID);deleteMoneyRequestnulls transaction in Onyxstatus:deletedsearch reloads deleted transactions into Onyx with all comment fields intactreportIDfrom'-1'to'0'(UNREPORTED_REPORT_ID) but preserves split comment fieldsoriginalTransactionID, causing incomplete cleanupConfidence: 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 thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.lakchote commentedon May 28, 2026
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
9 remaining items
melvin-bot commentedon Jun 10, 2026
@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!
melvin-bot commentedon Jun 10, 2026
@ZhenjaHorbach 12 days overdue now... This issue's end is nigh!
lakchote commentedon Jun 11, 2026
Not overdue - App #91932 is merged, the production guard is in place, and QA no longer reproduces the self-DM split blocker path.
lakchote commentedon Jun 15, 2026
Not overdue - the production guard is already merged and QA no longer reproduces the self-DM split blocker path.
melvin-bot commentedon Jun 15, 2026
This issue has not been updated in over 14 days. @lakchote, @ZhenjaHorbach eroding to Weekly issue.
m-natarajan commentedon Jul 1, 2026
Chrome / v9.4.25-1
Passed
REC-20260701173704.mp4
lakchote commentedon Jul 1, 2026
Not overdue ^ we can close this one.