[$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.4.66-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/71924520/folder/52723565/41236712/1717128096?sort=%2Bidentifier Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Windows 10/Chrome App Component: Chat Report View
Action Performed:
Preconditions 4 accounts are needed for this TC:
- Account A: Workspace owner
- Account B: Workspace approver
- Account C: Vacation delegate of user B
- Account D: Workspace submitter As workspace owner, invite all members to the WS, add an approver (Account B) to the workspace Steps:
- As Account D (submitter), submit an expense to the workspace chat
- Log in as Account C (vacation delegate)
- Go to any report that needs to be approved by Account B
- Click on the Report to view the details
- Click on the "More"
- Click on the "Split" option
- Click on the "Save" button
- Click on one of the split expenses and mark it as "Reject" expense
- Click on another split - Edit split - Click on amount - Remove split
Expected Result:
No error after remove split
Actual Result:
A Raw JSON {"comment":""} is displayed in the expense report preview on LHN And error appears after Vacation Delegate rejects one split and removes another
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/9ee33f37-40fb-4e58-b56d-f180510e3664
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7248612
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022108552439518103803
- Upwork Job ID: 2108552439518103803
- Last Price Increase: 2026-10-25
Issue Owner
Current Issue Owner: @apeyada
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/3a9799587830798483a9c189016a74d22aef133527785599b219544bb2cc2fd8
https://platform.applause.com/services/links/v1/external/5560c20cc6fb0bec4eecdb5d22085f8c13ebdac74171c76c00dc6f0fce0f9734
Proposal
Two separate defects produce what the tester saw. Both live in the split-expense flow in Expensify/App.
What is the root cause of that problem?
1. The error after "reject one split, remove the other" — the split flow doesn't know a split can be rejected.
Rejecting a split moves that child transaction onto a brand-new OPEN expense report, but it keeps comment.source === 'split' and comment.originalTransactionID, so getChildTransactions still returns it as a live sibling. It is rebuilt into the split draft with statusNum: 0 at SplitExpenseItems.ts:337.
That 0 flips the reverse-split flag at SplitTransactionUpdate.ts:300-301:
const hasEditableSplitExpensesLeft = splitExpenses.some((expense) => (expense.statusNum ?? 0) < CONST.REPORT.STATUS_NUM.SUBMITTED);
const isReverseSplitOperation = splitExpenses.length === 1 && allChildTransactions.length > 0 && hasEditableSplitExpensesLeft;
So removing the second split stops being "delete one split" and becomes a full un-split: the app fires REVERT_SPLIT_TRANSACTION targeting the rejected transaction, which now lives on a different report. It also optimistically deletes the surviving child and navigates away from the report it believes is about to be empty. The write fails, iou.error.genericEditFailureMessage is applied, and the user is left on the error/not-found screen.
Without the reject, both children are statusNum: 1 (SUBMITTED), the flag is false, and the save takes the normal UPDATE_SPLIT_TRANSACTION path — which is why the flow only breaks when a split was rejected first.
2. The raw {"comment":""} in the LHN — comment is sent as a serialized object.
The split payload builds comment as a nested object at SplitTransactionUpdate.ts:352-354, and every object-valued field is stringified into the API params at SplitTransactionUpdate.ts:2023-2027. With no description that sends literally splits[0][comment] = {"comment":""}. The sibling REVERT_SPLIT_TRANSACTION branch flattens it to a plain string; SPLIT_TRANSACTION / UPDATE_SPLIT_TRANSACTION do not — the two commands disagree on the shape of the same field. That string comes back as the expense description and is rendered verbatim by getDescription → getReportPreviewMessage, giving $X.XX for {"comment":""}.
This fires at the Split → Save step (step 7), not at remove — it is independent of the reject.
The vacation delegate is not causal. isDelegateAccessRestricted only applies to the submitter role, and the Split / Edit split / Remove split paths have no delegate guard at all. Connecting as a delegate makes the session act as the delegator, so account B acting directly should reproduce this identically.
What changes do you think we should make in order to solve the problem?
- Exclude rejected children from the split set. Filter transactions that have been rejected off the original expense report out of
getChildTransactions(or out of the draft rebuild ininitSplitExpenseItemData), so a rejected split can no longer contributestatusNum: 0and no longer becomes the target of a revert. This is the fix that stops the error. - Harden the reverse-split guard.
hasEditableSplitExpensesLeftshould mean "this split is still editable on the report we're editing", so it should also require the remaining split to still be onexpenseReport.reportID— not merely have a lowstatusNum. - Send
commentin one consistent shape. Flattencommentto the description string in theSPLIT_TRANSACTION/UPDATE_SPLIT_TRANSACTIONbranch the same way the revert branch already does, so the raw JSON can never be stored as a description.
What alternative solutions did you explore? (Optional)
Escaping or sanitizing the description at render time would hide the {"comment":""} text but leaves the wrong value stored on the transaction, so it was rejected.
Supporting evidence and open questions
Repro-specific note: the reverse-split root cause requires exactly 2 splits, so removing one leaves 1. With 3+ splits the save instead sends UPDATE_SPLIT_TRANSACTION with the rejected, off-report split still in the payload and a silently redistributed amount — a different but equally wrong outcome from the same missing filter.
Amount redistribution side effect: removeSplitExpenseField unlocks the remaining splits and redistributes the full original amount onto the survivor — here, the rejected expense that is no longer on the report.
Not verified: the backend handlers for REVERT_SPLIT_TRANSACTION / UPDATE_SPLIT_TRANSACTION are not in this repo, so the exact server response and the hop that stores {"comment":""} as the description are inferred from the client payload, not observed. The client-side changes above are still correct regardless.
Not reproduced locally: this repro needs four accounts with an approver and a configured vacation delegate, which is out of reach of the automated test harness.
Related: [$250] Expense - Report in LHN shows "tracked x for {"comment"'''}" after deleting split track expense (Expensify/App#64239) is the same {"comment":""} defect class in a different split flow. It was closed without a fix, so change 3 above would close both.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/100120) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a split expense flow where a Vacation Delegate (or user):
- Rejects one split expense.
- Then edits and removes another split expense.
Two defects occur:
- An unexpected error appears when submitting the change.
- A raw JSON string
{"comment":""}is displayed in the expense report preview in the Left Hand Navigation (LHN) and chat.
What is the root cause of that problem?
There are two distinct root causes producing these symptoms:
1. Unexpected error on removing split: isReverseSplitOperation misidentifies rejected splits
When a split expense is rejected, the app moves that transaction onto a new report, but the transaction still retains comment.source === 'split' and comment.originalTransactionID.
Consequently, in SplitTransactionUpdate.ts:287:
const allChildTransactions = getChildTransactions(allTransactionsList, originalTransactionID);
getChildTransactions returns the rejected transaction as a live child because it searches solely by originalTransactionID without verifying whether the child belongs to the current report (expenseReport.reportID).
Then at SplitTransactionUpdate.ts:300-301:
const hasEditableSplitExpensesLeft = splitExpenses.some((expense) => (expense.statusNum ?? 0) < CONST.REPORT.STATUS_NUM.SUBMITTED);
const isReverseSplitOperation = splitExpenses.length === 1 && allChildTransactions.length > 0 && hasEditableSplitExpensesLeft;
Because allChildTransactions.length > 0 includes the off-report rejected transaction, reducing the active split count to 1 incorrectly trips isReverseSplitOperation = true. Instead of performing an UPDATE_SPLIT_TRANSACTION, the app triggers REVERT_SPLIT_TRANSACTION targeting the rejected transaction on another report. The API command fails on the server and applies iou.error.genericEditFailureMessage.
2. Raw JSON {"comment":""} in LHN: comment object stringified instead of flattened
In SplitTransactionUpdate.ts:352-354, the splits parameter structures comment as a nested object:
comment: {
comment: currentDescription,
},
When preparing parameters for SPLIT_TRANSACTION / UPDATE_SPLIT_TRANSACTION at SplitTransactionUpdate.ts:2024-2027:
const splitApiParams = {} as Record<string, string | number | boolean>;
for (const [i, split] of splits.entries()) {
for (const [key, value] of Object.entries(split)) {
splitApiParams[`splits[${i}][${key}]`] = value !== null && typeof value === 'object' ? JSON.stringify(value) : value;
}
}
Any value of type object is passed through JSON.stringify(value). Because split.comment is {comment: currentDescription}, JSON.stringify(split.comment) serializes to {"comment":""} (or {"comment":"..."}).
This stringified JSON is sent as splits[${i}][comment] = "{\"comment\":\"\"}". Unlike REVERT_SPLIT_TRANSACTION (which explicitly flattens comment: splits.at(0)?.comment?.comment), the update split loop sends the raw JSON object string, which the backend saves verbatim and getReportPreviewMessage displays in the LHN preview.
What changes do you think we should make in order to solve the problem?
Fix 1: Filter allChildTransactions to the current report
In src/libs/actions/IOU/SplitTransactionUpdate.ts:
Filter allChildTransactions so that transactions that have been rejected/moved off the current expenseReport.reportID are excluded from the reverse-split calculation:
- const allChildTransactions = getChildTransactions(allTransactionsList, originalTransactionID);
+ const allChildTransactions = getChildTransactions(allTransactionsList, originalTransactionID).filter(
+ (child) => child.reportID === expenseReport?.reportID,
+ );
And ensure hasEditableSplitExpensesLeft confirms the remaining split belongs to expenseReport?.reportID.
Fix 2: Flatten comment string in splitApiParams
In src/libs/actions/IOU/SplitTransactionUpdate.ts:2024-2028:
Explicitly extract the inner comment string rather than JSON-stringifying the {comment: ...} container:
for (const [i, split] of splits.entries()) {
for (const [key, value] of Object.entries(split)) {
- splitApiParams[`splits[${i}][${key}]`] = value !== null && typeof value === 'object' ? JSON.stringify(value) : value;
+ if (key === 'comment') {
+ splitApiParams[`splits[${i}][comment]`] = split.comment?.comment ?? '';
+ } else {
+ splitApiParams[`splits[${i}][${key}]`] = value !== null && typeof value === 'object' ? JSON.stringify(value) : value;
+ }
}
}
What specific scenarios should be covered in tests?
-
Rejected split removal test:
- Create a report with 2 split transactions.
- Reject split #1 (moves to a separate report).
- Edit split #2 and remove a split.
- Assert
isReverseSplitOperationis false andUPDATE_SPLIT_TRANSACTIONis invoked without throwing generic edit errors.
-
Comment serialization test:
- Trigger a split expense with empty description and with non-empty description.
- Inspect API parameters for
SPLIT_TRANSACTION/UPDATE_SPLIT_TRANSACTION. - Assert
splits[0][comment]is sent as a plain string (""or"my description"), never as'{"comment":""}'. - Assert LHN preview displays formatted currency without JSON artifact.
What alternative solutions did you explore? (Optional)
- Sanitizing
{"comment":""}ingetReportPreviewMessage/getDescription:- Rejected because treating the symptom at render time leaves corrupted JSON stored in the transaction's description field in the database.
- Modifying
getChildTransactionsglobally:- Rejected because other callers (like audit log or transaction history) may genuinely want to inspect all historical children across reports. Scoping the filter to
SplitTransactionUpdate.tsis more surgical and minimizes regression risk.
- Rejected because other callers (like audit log or transaction history) may genuinely want to inspect all historical children across reports. Scoping the filter to
@shubham1206agra Eep! 4 days overdue now. Issues have feelings too...
@shubham1206agra 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@shubham1206agra 10 days overdue. I'm getting more depressed than Marvin.
@shubham1206agra 12 days overdue now... This issue's end is nigh!
Current assignee @shubham1206agra is eligible for the External assigner, not assigning anyone new.
Job added to Upwork: https://www.upwork.com/jobs/~022108552321834358720
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (External)
Job added to Upwork: https://www.upwork.com/jobs/~022108552439518103803
Proposal
Please re-state the problem that we are trying to solve in this issue.
After one split is rejected, the LHN preview of the expense report shows raw JSON: <amount> for {"comment":""}.
What is the root cause of that problem?
After the reject, the report's last action is no longer an expense action, so the LHN builds the preview from the report's latest expense action (here).
That preview uses the transaction's description, and falls back to the action's originalMessage.comment when the description is empty. The split has no description, so it falls back. For split expenses, the server stores the action's comment as the raw split payload, {"comment":""}, so that's what the LHN shows. The Description field itself stays empty, because it reads the transaction.
This started in #86904, which switched this preview from the merchant to the description but kept the fallback. Before it, the merchant was shown, which hid the stored JSON.
What changes do you think we should make in order to solve the problem?
In getExpenseReportPreviewText, fall back to originalMessage.comment only when the linked transaction isn't loaded. When it is loaded, use its description even when it's empty, since the transaction is the source of truth.
The preview then reads <amount> with no description, and <amount> for <description> when there is one. This also covers expenses split before any fix, whose stored message can't be changed from the client.
const description = linkedTransaction ? getDescription(linkedTransaction) : originalMessage?.comment;
const comment = Parser.htmlToText(description ?? '').trim();
What alternative solutions did you explore? (Optional)
- Send the split description as plain text (here).
- Strip JSON-looking text when displaying it: it would also change a real description that happens to look like JSON.
Old proposal
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a vacation delegate (or any non-admin approver) rejects one split and removes the other, saving the splits fails with an error.
What is the root cause of that problem?
Rejecting one expense from a multi-expense report moves it to the submitter's open report (existing draft or new one). Only the submitter and admins can access that report, so the approver loses access to the rejected expense.
But the reject only changes the transaction's reportID and leaves it in the approver's Onyx. On a fresh load the server doesn't return it, so this stale copy lives until the cache is cleared.
The stale copy is still found by getChildTransactions as a sibling split:
- The More menu shows "Edit splits" instead of "Split" (here). After clearing the cache it shows "Split".
- Edit splits lists the rejected split as a locked row.
- Removing the other split leaves only the rejected one.
hasEditableSplitExpenseLeftonly checks that its report is still open, soisReverseSplitOperationis true and the app sendsREVERT_SPLIT_TRANSACTIONon a transaction the approver can't access. The server rejects it and the error shows.
What changes do you think we should make in order to solve the problem?
In the multi-expense branch of prepareRejectMoneyRequestData, check whether the current user can access the report the expense moves to (they are the submitter, or a workspace admin).
If they can't:
- Optimistic data: remove the transaction from Onyx instead of moving it. This also covers rejecting offline, where success data isn't applied until the request runs.
- Success data: skip the transaction update, so an empty transaction isn't left behind.
- Failure data: restore the full original transaction, along with the existing
reportIDrollback and reject error.
The approver then sees only the remaining split ("Split" instead of "Edit splits"), the same as after a cache clear, and step 9 no longer reverts onto the rejected expense.
What alternative solutions did you explore? (Optional)
- Treat locked splits as not editable in
hasEditableSplitExpenseLeft: stops the error, but the stale rejected split still shows in Edit splits until the cache is cleared. - Filter rejected children out of
getChildTransactionsor the split draft: changes how a rejected split counts toward the split total, and doesn't remove the stale data.
Note: the raw {"comment":""} text in the LHN comes from the backend, not the client. The Description field is empty, and the same text appears in the rejection email in #87523. That part needs a backend fix.
Note: I noticed that the bug also happens on normal splist reject flow by admin (without vacation delegate) Here's detailed analysis:
Please re-state the problem that we are trying to solve in this issue.
After an admin approver (or can be owner) rejects one split and removes the other, saving the splits fails with an error.
What is the root cause of that problem?
When only one split is left, the app reverts the split, merging it back into the original expense. It does this whenever the remaining split's report hasn't been submitted (here and here).
The backend checks every split, not just the remaining one. If any split is on a submitted or approved report, it refuses the revert with "Split transactions in submitted or approved reports cannot be reverted".
Normally all splits are on the same report, so the two rules agree. Rejecting a split moves it to the submitter's open report, while the split being removed stays on the original report, which is submitted. The app sees an open report, sends REVERT_SPLIT_TRANSACTION, and the backend refuses it.
This happens for any approver (admin, owner or vacation delegate).
What changes do you think we should make in order to solve the problem?
Match the backend's rule. Only revert when no split of the expense, including the ones being removed, is on a submitted report.
Add a helper that checks whether any child transaction is on a report with statusNum >= SUBMITTED. Add that check to the isReverseSplitOperation condition in both updateSplitTransactions and updateSplitTransactionsFromSplitExpensesFlow.
The save then uses UPDATE_SPLIT_TRANSACTION, which deletes the removed split and keeps the rejected one. This is already what happens when the remaining split is on a submitted report. Self DM splits are unaffected, because they are not on submitted reports.
What alternative solutions did you explore? (Optional)
- Hide "Remove split" when the other splits are on different reports: blocks a valid action instead of saving it correctly.
🚨 Edited by proposal-police: This proposal was edited at 2026-10-11 14:25:15 UTC.
Proposal
What is the root cause of that problem?
I found two problems in the split-expense state.
Rejecting one split moves its transaction to a new expense report, but keeps its split metadata. The optimistic rejection only changes reportID:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/actions/IOU/RejectMoneyRequest.ts#L675-L694
getChildTransactions() still treats that moved transaction as a child because it only checks originalTransactionID, source, and pending deletion:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/TransactionUtils/index.ts#L3484-L3496
When the edit flow rebuilds the split, the moved transaction receives the status of its new OPEN report:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/actions/IOU/SplitExpenseItems.ts#L330-L348
After the user removes the other split, that rejected transaction is the only item left. Its OPEN status makes hasEditableSplitExpensesLeft true, so isReverseSplitOperation is incorrectly enabled:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/actions/IOU/SplitTransactionUpdate.ts#L284-L308
The app consequently sends REVERT_SPLIT_TRANSACTION for a transaction which has already moved to another report:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/actions/IOU/SplitTransactionUpdate.ts#L2012-L2027
The raw description has a separate payload-shape cause. Split/update declares comment as a Comment object, while the revert command explicitly declares it as a plain string:
https://github.com/Expensify/App/blob/8c626a38b468c2cf87586924d7f8da25d5510327/src/libs/API/parameters/SplitTransactionParams.ts#L1-L47
The generic split parameter builder serializes every object, including {comment: ''}, so that JSON can be stored and later displayed as the expense description.
What changes do you think we should make in order to solve the problem?
I think we should exclude a split transaction that was rejected and moved away from the report being edited when constructing the editable split collection. The shared getChildTransactions() helper should retain its broad meaning because its other callers use it to find every related child; the report-specific filtering belongs in the split-edit initialization.
We should also require the sole remaining transaction to belong to the expense report being edited before treating the save as a reverse split. For example:
- const isReverseSplitOperation = splitExpenses.length === 1 && allChildTransactions.length > 0 && hasEditableSplitExpensesLeft;
+ const remainingSplit = splitExpenses.at(0);
+ const isReverseSplitOperation =
+ splitExpenses.length === 1 && allChildTransactions.length > 0 &&
+ hasEditableSplitExpensesLeft && remainingSplit?.reportID === expenseReport?.reportID;
For SPLIT_TRANSACTION and UPDATE_SPLIT_TRANSACTION, pass the parsed description as the comment field instead of serializing the surrounding Comment object. The revert branch already flattens that field before sending it.
This keeps ordinary two-way reverse splits working because their remaining transaction still belongs to the report being edited. It also covers splits with more than two children: the rejected, off-report transaction is omitted from both redistribution and the update payload instead of merely avoiding the reverse branch. I would add regression coverage for two and three children, with one rejected child, and verify that an ordinary two-child split still reverts successfully.
What alternative solutions did you explore? (Optional)
I considered changing getChildTransactions() globally. That has a wider effect on split indicators, deletion, bulk actions, and other callers, so filtering only the editable collection is safer.
Rendering JSON-shaped descriptions as blank would hide the preview symptom while leaving invalid data stored, so I would correct the outgoing payload instead.
https://github.com/user-attachments/assets/1793f85c-1309-4f7f-a721-d9710b0e99e3
https://github.com/user-attachments/assets/6cd160f8-82f0-4a2c-9555-b2012d3e6672
🚨 Edited by proposal-police: This proposal was edited at 2026-10-11 11:34:54 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After an approver (here acting as a vacation delegate) splits an expense, rejects one of the resulting splits, and then removes the other split from the split editor, the app ends up in a broken state: several red "Unexpected error…" messages appear (deleting this expense / creating this chat / submitting this expense), a phantom chat row appears in the LHN ("Unavailable workspace owes…"), and the expense report preview shows the raw JSON {"comment":""} instead of expense content.
What is the root cause of that problem?
Two things combine.
1. Rejecting a split moves its transaction out of the expense report, but the split set still contains it. When an expense is rejected, the reject flow detaches the transaction from the report — it merges reportID: null onto the transaction (or CONST.REPORT.UNREPORTED_REPORT_ID when it was the report's only expense), and the backend re-homes the expense back to the submitter:
https://github.com/Expensify/App/blob/83f856808d0a5d9713bebc62a021acc5a49a2406/src/libs/actions/IOU/RejectMoneyRequest.ts#L241-L248
The rejected transaction, however, keeps comment.originalTransactionID, so it is still a member of the split set that the split editor operates on, and it is still listed as one of the splits when the user re-opens the split editor.
2. The save flow classifies the operation as a "reverse split" without checking where the remaining split now lives. When the user removes the other split and saves, the split set is down to one entry, and the flow decides between a normal split update and a reverse split (collapsing the splits back into the original transaction) purely from the split count and a statusNum check:
https://github.com/Expensify/App/blob/83f856808d0a5d9713bebc62a021acc5a49a2406/src/libs/actions/IOU/SplitTransactionUpdate.ts#L2029-L2036
The same classification exists inside updateSplitTransactions itself:
https://github.com/Expensify/App/blob/83f856808d0a5d9713bebc62a021acc5a49a2406/src/libs/actions/IOU/SplitTransactionUpdate.ts#L296-L298
Both compute hasEditableSplitExpensesLeft through the shared hasEditableSplitExpenseLeft helper, which only asks whether the report the split's transaction currently lives on has a statusNum below "submitted" (a report that isn't found counts as open):
https://github.com/Expensify/App/blob/4d934cee7813ef2095ffb94e534df2d69e2112e3/src/libs/actions/IOU/SplitTransactionUpdate.ts#L170-L186
After a rejection the rejected expense sits in an open/unreported state, so its report's statusNum is 0 and it counts as an "editable remaining split". Nothing checks whether this surviving split was rejected out of the expense report being edited.
The save is therefore classified as a reverse split, with the rejected split as the survivor. The flow rebuilds the original transaction from the rejected split's report context — a context that no longer matches the workspace expense report, which is why the optimistic data manufactures an unresolvable chat ("Unavailable workspace owes…") and a phantom report for the restored original amount — and then fires RevertSplitTransaction for a split set whose survivor was already rejected out of the report:
https://github.com/Expensify/App/blob/83f856808d0a5d9713bebc62a021acc5a49a2406/src/libs/actions/IOU/SplitTransactionUpdate.ts#L1992-L1999
The server refuses the invalid revert, all the failure data lands at once (the "Unexpected error deleting / creating / submitting…" cascade), and the report preview is left rendering the split payload's serialized empty description object — the literal {"comment":""} from the bug report, since these test expenses have no description.
What changes do you think we should make in order to solve the problem?
Make hasEditableSplitExpenseLeft — the single helper both places use for the reverse-split classification (updateSplitTransactionsFromSplitExpensesFlow and updateSplitTransactions) — ignore any split that was rejected out of its report:
- A split counts as rejected out of its report when its live transaction no longer has a
reportID(the reject flow clears it optimistically), or when the transaction carries the rejected-expense violation (AUTO_REPORTED_REJECTED_EXPENSE, checked with the existinghasTransactionBeenRejectedutil) that marks the expense re-homed by a rejection. Both call sites already have thetransactionViolationscollection and pass it through to the helper. - Such a split can never be the "editable remaining split" that green-lights a revert, so when it is the only split left the save goes through the existing regular update path (
UpdateSplitTransaction) instead. That path simply deletes the removed split and leaves the rejected expense wherever the rejection put it — no revert of the original transaction, no invalid API call, no optimistic chat/report fabrication, and no error cascade.
This keeps every current behavior intact for normal splits (removing splits down to one still collapses back into the original expense when the survivor was not rejected), and only changes the previously-broken case where the survivor was rejected.
Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/100120-reverse-split-rejected-survivor?expand=1
What alternative solutions did you explore? (Optional)
- Block the removal instead of allowing it: when the only split that would remain has been rejected out of the report, show the existing "split needs at least two expenses" style validation message on the split editor rather than saving. This is a smaller change but worse UX — removing the still-active split is a legitimate request, and the user would be left with no way to undo the split.
- Drop rejected splits from the split editor's list when the draft is initialized, so a rejected split is never part of the edited set at all. This would also prevent the broken revert, but it changes what the editor displays for every split expense with a rejected member and has a wider blast radius than gating the reverse-split decision at save time.
🤖 ProposalPolice™ is tracking duplicate proposals for this issue using an OpenAI Conversation. This comment stores that Conversation's ID and can be safely ignored.
Proposal updated — added compare branch with implementation.
🚨 Edited by proposal-police: This proposal was edited at 2026-10-11 12:30:59 UTC.
Proposal
Update, 2026-10-11 — correction. The network trace posted below shows what the server actually does here, and it contradicts part of what I wrote. I'm leaving the original text in place and marking what no longer holds:
- My premise was wrong. I said both writes would be refused because they touch a split this user has no rights over. Per that trace,
RevertSplitTransactionis refused for a different reason (666 Split transactions in submitted or approved reports cannot be reverted), andUpdateSplitTransactionwith only the rejected split left is accepted.- The plain-delete branch (step 2) isn't needed, and I'd drop it. The existing update path already handles the removal, and I never verified that an approver may send
DeleteMoneyRequestfor an expense on a submitted report.- Gating on the frozen set (steps 1 and 3) is incomplete.
isSplitActionlets a workspace admin split on an open report, so for an admin approver the rejected split is not frozen and the same steps would still send the revert. A condition that follows the server rule covers that case; a permission-based one doesn't.What still stands is the Jest reproduction of the bad write on
09f662a. I think the revert decision should follow the server rule rather than my frozen-set gate, and that approach is already posted, so I'm not re-proposing it.
What is the root cause of that problem?
The split editor has no way to save "I only dropped my own split". Every save from DynamicSplitExpensePage ends in one of two writes, and both of them rewrite a split that is still in the set:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/SplitTransactionUpdate.ts#L2028-L2052
In this repro the only split left in the set is the rejected one. It sits on the submitter's report now, and the approver (or their vacation delegate) has no rights over it. So whichever of the two commands we pick, we're asking the server to modify a transaction this user can't touch. The picker happens to choose REVERT_SPLIT_TRANSACTION, because its idea of "editable" is only "the split's report is not submitted yet", and a rejected split lands on an open report:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/SplitTransactionUpdate.ts#L173-L186 https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/SplitTransactionUpdate.ts#L308-L309
What makes this a gap rather than a missing feature is that the app already has both halves of the answer, just not connected:
- Since #100281 the editor itself has a permission-based definition,
useFrozenSplitTransactionIDs: a split is frozen when the current user can't perform the split action on it. The draft actions respect it (a frozen split can't be removed or absorb an amount), but the set never reaches the save, so the save still trusts the status-only check. https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/hooks/useFrozenSplitTransactionIDs.ts#L55-L70 - Deleting a split directly already knows what to do when nothing editable is left: it skips the split update and does a plain
deleteMoneyRequeston that one child. https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/hooks/useDeleteTransactions.ts#L263-L271
The editor's save has no equivalent branch, and that's the hole this repro falls through.
I reproduced the bad write in Jest on 09f662a: two-way split, move split 2 to another open report (what reject does), save with only split 2 left. API.write receives RevertSplitTransaction for the rejected transaction.
What changes do you think we should make in order to solve the problem?
Give the save a third outcome, and choose it with the editor's own frozen set.
- Pass
frozenSplitTransactionIDsfromDynamicSplitExpensePageintoupdateSplitTransactionsFromSplitExpensesFlow/updateSplitTransactions(the page already computes it). - In
updateSplitTransactions, before the reverse/update decision:
const removedChildren = allChildTransactions.filter((child) => !remainingSplitIDs.has(child.transactionID));
const isEveryRemainingSplitFrozen = splitExpenses.length > 0 && splitExpenses.every((split) => frozenSplitTransactionIDs?.has(split.transactionID));
if (isEveryRemainingSplitFrozen && removedChildren.length > 0) {
// deleteMoneyRequest for each removed child, clear the draft, return
}
- Make
hasEditableSplitExpenseLeftignore frozen splits, so the navigation logic inupdateSplitTransactionsFromSplitExpensesFlowagrees with the write and takes its existing "this report is about to be empty" route.
The result for this repro: the removed split is deleted, the rejected expense stays exactly where the rejection put it, and no revert or update is sent. An ordinary two-way split still reverts, because its survivor isn't frozen.
I wrote this patch and ran it. New test in tests/actions/IOUTest/SplitTest.ts: fails on 09f662a (RevertSplitTransaction sent), passes with the patch (DeleteMoneyRequest for the removed split, rejected split untouched). Seven related suites (SplitTest, DynamicSplitExpensePageTest, SplitReportTotalsTest, useDeleteTransactions, useFrozenSplitTransactionIDs, DeleteMoneyRequestTest, SplitExpenseUtils): 265/265 passing, 264 existing + 1 new.
What I did not verify: the four-account flow in the running app, and the server's response to DeleteMoneyRequest on a split child whose sibling was rejected. My basis for the second is that the direct-delete path already sends exactly that when the siblings are approved. One thing I'd tighten in the PR: useFrozenSplitTransactionIDs falls back to the report being edited when the split's own report isn't in Onyx, which could make a moved split look editable; it shouldn't fall back when the split's live reportID differs.
What alternative solutions did you explore? (Optional)
- Block the save with a validation error when only frozen splits would remain. Rejected: removing your own split is a legitimate action and the user would have no way to do it from this screen.
- Align the direct-delete predicate in
useDeleteTransactionswith the frozen set too. I'd do it in the same PR for consistency, but it isn't on this repro's path: a single split delete is redirected into the editor first. - With three or more splits and one rejected, removing one still goes through
UPDATE_SPLIT_TRANSACTIONwith the rejected split in the payload. Its amount stays fixed since #100281, so I'd leave that for a follow-up rather than widen this change. - Narrowing which children count as part of the split set would also stop the revert, but it leaves the save with only its two rewrite commands.
- The raw
{"comment":""}text: I didn't change it. Without seeing what the server stores I can't say whether the client payload or the backend is at fault.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an approver (here via vacation delegate) rejects one split and then removes the other split in Edit splits, saving fails with an error and the user lands on a broken report.
What is the root cause of that problem?
The split editor and the save logic use two different answers to "can this user still edit this split?".
When the approver rejects a split, the transaction only gets a new reportID pointing to the submitter's open report, and it keeps its split metadata, so it's still returned as a child of the original expense:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/RejectMoneyRequest.ts#L685-L693
The split editor already handles this correctly. useFrozenSplitTransactionIDs runs isSplitAction against each split's own report, and on an open report only the submitter or an admin can split:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/ReportSecondaryActionUtils.ts#L190-L192
so the rejected split ends up in frozenSplitTransactionIDs, and DynamicSplitExpensePage shows it as a locked row and skips it in validation:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/hooks/useFrozenSplitTransactionIDs.ts#L47-L71
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/pages/iou/DynamicSplitExpensePage.tsx#L256-L261
But on Save that set is never passed down. The reverse-split decision uses hasEditableSplitExpenseLeft, which only checks whether the split's report status is below SUBMITTED:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/SplitTransactionUpdate.ts#L170-L186
The rejected split sits on an OPEN report, so it passes. After removing the other split it's the only one left, so isReverseSplitOperation becomes true in both places that compute it:
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/libs/actions/IOU/SplitTransactionUpdate.ts#L308-L309
https://github.com/Expensify/App/blob/09f662acc2306467fe3fbfb648ed90ae107863b1/src/pages/iou/updateSplitTransactionsFromSplitExpensesFlow.ts#L32-L36
and we send REVERT_SPLIT_TRANSACTION to collapse the original expense into a split that the editor itself had just shown as locked for this user. The server refuses it and all the failure data lands at once.
So the split the UI says "you can't touch" is the one the save picks as the survivor of a revert.
What changes do you think we should make in order to solve the problem?
Make the save path use the same frozen set the editor already computed, instead of re-deriving editability with a weaker rule.
DynamicSplitExpensePagepasses its existingfrozenSplitTransactionIDsintoupdateSplitTransactionsFromSplitExpensesFlow(new optional field onUpdateSplitTransactionsParams, it's spread intoupdateSplitTransactionsalready).hasEditableSplitExpenseLefttakes that set and skips frozen splits:
return splitExpenses.some((expense) => {
// A split the editor locked for this user (e.g. rejected back to the submitter) can't take the original back.
if (frozenSplitTransactionIDs?.has(expense.transactionID)) {
return false;
}
...existing statusNum check
});
- Both call sites (
updateSplitTransactionsandupdateSplitTransactionsFromSplitExpensesFlow) pass it, so the navigation decision and the API command stay in sync.
With this, removing the active split leaves only a frozen survivor, so the save goes through the normal UPDATE_SPLIT_TRANSACTION path: the removed split is deleted and the rejected expense stays where the rejection put it. A normal 2-way split with no frozen member still collapses via revert exactly like today.
This also covers other frozen cases the editor already knows about, not just rejection (e.g. a split the current user lost split rights on), because it reuses the single source of truth instead of adding another rejection-specific check.
I've implemented this with a unit test that fails on main and passes with the change: https://github.com/Expensify/App/compare/main...dilshodmackbook-sketch:App:fix/100120-reverse-split-frozen-survivor
About the {"comment":""} text in the LHN: the client sends the same comment shape on every split update and normal splits don't show it, so I don't think the save payload is what writes it. It shows on the report the rejection created, which is built server side. If a C+ wants it handled here I can dig into it separately.
What alternative solutions did you explore? (Optional)
- Add a rejection-specific check inside
hasEditableSplitExpenseLeft(missingreportID, rejected violation, or survivor not on the edited report). That works for this repro but adds a second definition of "editable" next to the one the editor already uses, so the two can drift again. - Filter rejected children out of
getChildTransactionsor the split draft. Wider impact since other callers rely on seeing every child, and it hides the rejected split from the editor. - Remove the rejected transaction from the approver's Onyx when rejecting. Fixes the stale row, but the save logic would still trust status alone for any other frozen split.