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
[$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split #100120
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
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.
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 in initSplitExpenseItemData), so a rejected split can no longer contribute statusNum: 0 and no longer becomes the target of a revert. This is the fix that stops the error.
Harden the reverse-split guard.hasEditableSplitExpensesLeft should mean "this split is still editable on the report we're editing", so it should also require the remaining split to still be on expenseReport.reportID — not merely have a low statusNum.
Send comment in one consistent shape. Flatten comment to the description string in the SPLIT_TRANSACTION / UPDATE_SPLIT_TRANSACTION branch 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.
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.
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.
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).
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:
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:
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?
Assert isReverseSplitOperation is false and UPDATE_SPLIT_TRANSACTION is 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":""} in getReportPreviewMessage / getDescription:
Rejected because treating the symptom at render time leaves corrupted JSON stored in the transaction's description field in the database.
Modifying getChildTransactions globally:
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.ts is more surgical and minimizes regression risk.
changed the title [-][Due for payment 2026-11-14] [$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split[/-][+][$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split[/+]on Nov 20, 2026
Activity
applause-bot commentedon Sep 2, 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/3a9799587830798483a9c189016a74d22aef133527785599b219544bb2cc2fd8
https://platform.applause.com/services/links/v1/external/5560c20cc6fb0bec4eecdb5d22085f8c13ebdac74171c76c00dc6f0fce0f9734
MelvinBot commentedon Sep 24, 2026
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'andcomment.originalTransactionID, sogetChildTransactionsstill returns it as a live sibling. It is rebuilt into the split draft withstatusNum: 0atSplitExpenseItems.ts:337.That
0flips the reverse-split flag atSplitTransactionUpdate.ts:300-301:So removing the second split stops being "delete one split" and becomes a full un-split: the app fires
REVERT_SPLIT_TRANSACTIONtargeting 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.genericEditFailureMessageis applied, and the user is left on the error/not-found screen.Without the reject, both children are
statusNum: 1(SUBMITTED), the flag isfalse, and the save takes the normalUPDATE_SPLIT_TRANSACTIONpath — which is why the flow only breaks when a split was rejected first.2. The raw
{"comment":""}in the LHN —commentis sent as a serialized object.The split payload builds
commentas a nested object atSplitTransactionUpdate.ts:352-354, and every object-valued field is stringified into the API params atSplitTransactionUpdate.ts:2023-2027. With no description that sends literallysplits[0][comment] = {"comment":""}. The siblingREVERT_SPLIT_TRANSACTIONbranch flattens it to a plain string;SPLIT_TRANSACTION/UPDATE_SPLIT_TRANSACTIONdo not — the two commands disagree on the shape of the same field. That string comes back as the expense description and is rendered verbatim bygetDescription→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.
isDelegateAccessRestrictedonly applies to thesubmitterrole, 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?
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.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.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_TRANSACTIONwith 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:
removeSplitExpenseFieldunlocks 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_TRANSACTIONare 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.
view run
melvin-bot commentedon Sep 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)melvin-bot commentedon Sep 24, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
ashusatyarthi-wq commentedon Sep 26, 2026
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):
Two defects occur:
{"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:
isReverseSplitOperationmisidentifies rejected splitsWhen a split expense is rejected, the app moves that transaction onto a new report, but the transaction still retains
comment.source === 'split'andcomment.originalTransactionID.Consequently, in
SplitTransactionUpdate.ts:287:getChildTransactionsreturns the rejected transaction as a live child because it searches solely byoriginalTransactionIDwithout verifying whether the child belongs to the current report (expenseReport.reportID).Then at
SplitTransactionUpdate.ts:300-301:Because
allChildTransactions.length > 0includes the off-report rejected transaction, reducing the active split count to 1 incorrectly tripsisReverseSplitOperation = true. Instead of performing anUPDATE_SPLIT_TRANSACTION, the app triggersREVERT_SPLIT_TRANSACTIONtargeting the rejected transaction on another report. The API command fails on the server and appliesiou.error.genericEditFailureMessage.2. Raw JSON
{"comment":""}in LHN:commentobject stringified instead of flattenedIn
SplitTransactionUpdate.ts:352-354, the splits parameter structurescommentas a nested object:When preparing parameters for
SPLIT_TRANSACTION/UPDATE_SPLIT_TRANSACTIONatSplitTransactionUpdate.ts:2024-2027:Any
valueof typeobjectis passed throughJSON.stringify(value). Becausesplit.commentis{comment: currentDescription},JSON.stringify(split.comment)serializes to{"comment":""}(or{"comment":"..."}).This stringified JSON is sent as
splits[${i}][comment] = "{\"comment\":\"\"}". UnlikeREVERT_SPLIT_TRANSACTION(which explicitly flattenscomment: splits.at(0)?.comment?.comment), the update split loop sends the raw JSON object string, which the backend saves verbatim andgetReportPreviewMessagedisplays in the LHN preview.What changes do you think we should make in order to solve the problem?
Fix 1: Filter
allChildTransactionsto the current reportIn
src/libs/actions/IOU/SplitTransactionUpdate.ts:Filter
allChildTransactionsso that transactions that have been rejected/moved off the currentexpenseReport.reportIDare excluded from the reverse-split calculation:And ensure
hasEditableSplitExpensesLeftconfirms the remaining split belongs toexpenseReport?.reportID.Fix 2: Flatten
commentstring insplitApiParamsIn
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:
isReverseSplitOperationis false andUPDATE_SPLIT_TRANSACTIONis invoked without throwing generic edit errors.Comment serialization test:
SPLIT_TRANSACTION/UPDATE_SPLIT_TRANSACTION.splits[0][comment]is sent as a plain string (""or"my description"), never as'{"comment":""}'.What alternative solutions did you explore? (Optional)
{"comment":""}ingetReportPreviewMessage/getDescription:getChildTransactionsglobally:SplitTransactionUpdate.tsis more surgical and minimizes regression risk.melvin-bot commentedon Sep 29, 2026
@shubham1206agra Eep! 4 days overdue now. Issues have feelings too...
136 remaining items
mallenexpensify commentedon Nov 16, 2026
Payment Summary
Contributor: @apeyada paid $250 via Upwork
Contributor+: @mkhutornyi due $250 via NewDot
@apeyada can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022108552439518103803
apeyada commentedon Nov 19, 2026
@mallenexpensify I accepted. Thanks
trjExpensify commentedon Nov 20, 2026
approved $250 for @mkhutornyi
[-][Due for payment 2026-11-14] [$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split[/-][+][$250] [Exploratory] Vacation Delegate - Error loading after reject 1 split then remove another split[/+]mallenexpensify commentedon Nov 20, 2026
@apeyada paid, summary updated above. Thx.