Skip to content

Split - Error when editing expense to higher amount after removing split from report #91481

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.80-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #91104
Email or phone of affected tester (no customers): isjdosdjoijosdjosnj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with amount 10.00.
  4. Open the expense.
  5. Click More > Split > Save.
  6. Open any split.
  7. Click Report > Remove from report.
  8. Click Amount.
  9. Change the amount to 10.00.
  10. Click Amount again.
  11. Change the amount to 11.00.

Expected Result:

User can edit the expense to higher amount because the split is reverted (no more split label on the amount title).

Actual Result:

Error shows up when editing expense to higher amount after removing split from report.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7161011_1779491924657.2.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @lakchote

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2026
  2. applause-bot commented on May 22, 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/2008d033bf1365bffbaa96c733f79924e3286d1499d1cc1f02baf840816ee27d

  3. melvin-bot commented on May 22, 2026

    @melvin-bot

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

  4. melvin-bot commented on May 22, 2026

    @melvin-bot

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

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

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #91104 introduced useHasMultipleSplitChildren, which counts all child transactions matching originalTransactionID — including orphaned ones (reportID = '0', i.e. removed from report). The old code excluded unreported children from this count.

    When you "Remove from report" on a split child, changeTransactionsReport sets the child's reportID to '0' but preserves comment.originalTransactionID and comment.source = 'split'. Because the new hook still counts this orphaned child (via child.isSplitSource being true), hasMultipleSplitChildren remains true. This keeps the split indicator visible and routes amount edits through the SplitExpensePage, where computeSplitSaveErrorMessage rejects any amount exceeding the parent's original $10.

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

    Filter out unreported (orphaned) children in selectChildTransactionInfo at useHasMultipleSplitChildren.ts:18. Add a check that t?.reportID !== CONST.REPORT.UNREPORTED_REPORT_ID to the filter condition, so removed-from-report children are no longer counted toward hasMultipleSplitChildren. This restores the pre-PR behavior where removing a split child effectively "unsplits" the remaining transaction from the UI's perspective.

    This is the minimal fix that addresses the regression without affecting PR #91104's original goal (allowing re-split after sibling deletion), because the re-split flow uses getChildTransactions with includeOrphaned=true separately.

    What alternative solutions did you explore? (Optional)

    Clearing split metadata (comment.originalTransactionID, comment.source) in changeTransactionsReport when moving to unreported was considered, but that would affect backend state and could break the re-split flow that PR #91104 was fixing.

    Investigation details

    Data flow:

    1. User creates $10 expense → splits into 2 children ($5 each)
    2. "Remove from report" on one child → changeTransactionsReport sets reportID = '0' but preserves split metadata
    3. useHasMultipleSplitChildren still counts the orphaned child (via isSplitSource = true) → hasMultipleSplitChildren = true
    4. Split indicator stays visible → amount edit routes to SplitExpensePage
    5. computeSplitSaveErrorMessage compares child amount ($11) against parent amount ($10) → error 'iou.totalAmountGreaterThanOriginal'

    Key code locations:

    Possibly related: #91105 (unable to split a reverted split transaction after deleting the unreported split transaction) — same area of code affected by PR #91104.


    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. mountiny commented on May 24, 2026

    @mountiny
    Contributor

    @MelvinBot poease raise a straight revert of the offending #91104

  8. MelvinBot commented on May 24, 2026

    @MelvinBot
    Contributor

    🤖 Draft revert PR created: #91549

    This is a straight revert of #91104. Please mark it as "Ready for review" when it is ready for review.

  9. 5 remaining items

  10. added and removed on May 25, 2026
  11. mountiny commented on May 25, 2026

    @mountiny
    Contributor

    Thanks @lakchote

  12. removed their assignment
    on May 25, 2026
  13. lakchote commented on May 25, 2026

    @lakchote
    Contributor

    @trjExpensify I'd like your product perspective on this, to see if you confirm or not my reasoning

    Imagine we have a report with 2 expenses (Expense A, Expense B).
    Expense A is split into two (split A, split B).
    Split B is removed from the workspace's report and moved back to selfDM -> hence, in theory, a revert split scenario. However, since it isn't the Edit Splits menu that is shown when we move an expense to another report, the RevertSplitTransaction API isn't called; instead, the ChangeTransactionsReport flow is.

    The result: the link between the two expenses remains intact.
    As a result, we can't give the split expense A in the workspace chat an amount higher than the original split (as it still thinks it must equal split A + split B).

    Here is my suggested fix:
    When a split child is moved to selfDM via the report transactions flow, and 1 reported split child remains, we clear the split markers. If two or more reported splits are present, we keep the split markers so the remaining reported splits can still be managed normally.

    --

    If you agree, I have a backend PR to fix this

  14. trjExpensify commented on May 26, 2026

    @trjExpensify
    Contributor

    Split B is removed from the workspace's report and moved back to selfDM -> hence, in theory, a revert split scenario.

    Is this the intended product behaviour from inception? In other words, if you unreport an expense the "split link" is removed and the amount is reverted to whatever it was originally?

    CC: @garrettmknight on this as well btw.

  15. lakchote commented on May 26, 2026

    @lakchote
    Contributor

    Is this the intended product behaviour from inception? In other words, if you unreport an expense the "split link" is removed and the amount is reverted to whatever it was originally?

    It's not technically when you unreport any expense that the split link would be removed, but only if we have 2 expenses and we unreport one of them.

  16. garrettmknight commented on May 26, 2026

    @garrettmknight
    Contributor

    I think the split should still remain after one of the expenses is unreported. Think this falls under the umbrella of updating Splits for unreported expenses, though. So the bug here imo is that we revert the split when you move one of the splits off the report. So far as I can tell, that will get fixed in #84382

  17. trjExpensify commented on May 26, 2026

    @trjExpensify
    Contributor

    I agree with Garrett. 👍

  18. lakchote commented on May 26, 2026

    @lakchote
    Contributor

    Alright, then the present issue "Error when editing expense to higher amount after removing split from report" will still remain, even after #84382.

    Are we good to close this then if it's the expected result? cc @trjExpensify @garrettmknight:
    "Error shows up when editing expense to higher amount after removing split from report to selfDM".

  19. trjExpensify commented on May 26, 2026

    @trjExpensify
    Contributor

    Alright, then the present issue "Error when editing expense to higher amount after removing split from report" will still remain, even after #84382.

    In the OP the error is "Unexpected error editing this expense. Please try again later.” - that should be more pointed if it does truly remain after #84382. But why would it? Wouldn't going to edit the amount re-open the edit split dialogue?

  20. lakchote commented on May 26, 2026

    @lakchote
    Contributor

    My bad, I explained myself poorly, you're right @trjExpensify. Instead of an unexpected error, we'll see this (with one split reported, one split unreported and an amount higher than the 2 splits):

    Image

    I guess this is fine, as there are no API errors anymore and the Edit Splits section is opened. Closing the issue since it'll be solved by #84382

    Thank you both for your input Garrett and Tom!

  21. trjExpensify commented on May 26, 2026

    @trjExpensify
    Contributor

    Sounds good, thanks for the ping!

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions