Skip to content

[Due for payment 2026-10-21] Split - Approved, Paid and/or Done expense amounts are changed if the last split is in Draft and removed #99190

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.58-0
Reproducible in staging?: Y
Reproducible in production?: Y
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/70169278/folder/53991772/41237173/1681867248?sort=-identifier
Email or phone of affected tester (no customers): lekima20+619408@gmail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation (hyperlinked to channel name):

Action Performed:

Precondition:

  • Admin create a manual expense to the workspace chat then split it to 2 expenses
  • Admin create a new report in the same workspace chat
  • Admin remove a split expense to the new report then approved, mark as paid (Or only approved)
  1. Open https://staging.new.expensify.com/
  2. Admin navigate to the workspace chat
  3. Open the split expense in draft status
  4. Click on More > Edit splits
  5. Click on arrow of the split allows editing > Remove split > Save

Expected Result:

Cash expenses

  • Removing a split should succeed, including when another split is already approved or paid.
  • Approved/paid splits are frozen: their amounts must not change, and the removed amount is not redistributed onto them.
  • Instead, the original (parent) expense amount drops to match the remaining split total.
  • This should also work when the actor is the submitter, not just an admin.

Company card expenses

  • The Remove Split button shouldn't show when all other splits have been approved, paid or marked as done.
  • No new backend work needed: once the frontend stops redistributing, the existing exact-sum check rejects the removal on its own.

Actual Result:

After removing split expense, the paid split expense is reverted. The message "change amount to new amount (previously amount)" is displayed under the mark as paid message

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

Recording.2423.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 21, 2026
  2. MelvinBot commented on Aug 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The "Edit splits → Remove split → Save" flow has no guard against removing a split whose counterpart expense is already approved/paid — the only thing stopping it is a UI permission gate that admins bypass.

    Whether a split row exposes the edit/remove arrow is decided by isSplitAction(). When the split's counterpart report is no longer open (i.e. already approved/paid), it returns:

    src/libs/ReportSecondaryActionUtils.ts:190

    return (isSubmitter && isAwaitingFirstLevelApproval(report)) || isAdmin || isManager;
    
    • An employee/submitter fails both submitter conditions (isAwaitingFirstLevelApproval is false once approved/paid), so the arrow is hidden and they get the "cannot be edited" modal → removal is blocked.
    • A policy admin passes via the || isAdmin short-circuit → the destructive "Remove split" action is exposed.

    Once the admin reaches Save, nothing else stops them: removeSplitExpenseField, onSaveSplitExpense and its computeSplitSaveErrorMessage validate only split count / amounts — none of them check isReportApproved / isSettled. So the app fires the revert and the already-paid expense reverts, producing the "changed amount to X (previously Y)" message under the mark-as-paid message.

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

    Add an approved/paid guard on the removal itself, independent of the admin role, so a split cannot be removed (or absorbed into) when its counterpart expense is approved or settled.

    Concretely: in isSplitExpenseEditable (DynamicSplitExpensePage.tsx:161-179) — and/or the Save path in onSaveSplitExpense — treat a split whose report is isReportApproved / isSettled as non-removable regardless of isAdmin, and surface the same blocking error the employee already sees. isReportApproved/isSettled are already imported and computed in this file (used only for the header label today at lines 479-497), so the state is readily available.

    This makes the admin path behave like the employee path (error shown, no revert), matching the Expected Result.

    Investigation details & evidence

    Data flow (admin repro):

    1. Expense split into 2 children; one child is moved to a new report and approved/paid.
    2. Admin opens the draft → More > Edit splits (DynamicSplitExpensePage). Each row's isEditable = isSplitExpenseEditable(item) → isSplitAction(...) evaluated against that split's own (approved/paid) report.
    3. isSplitAction reaches the non-open branch and returns true for the admin via || isAdmin → arrow shown (SplitListItem.tsx:221-235).
    4. Remove split → removeSplitExpenseField filters the split out and redistributes the total — no approved/paid check.
    5. Save → onSaveSplitExpense → reverse-split path in SplitTransactionUpdate.ts (isReverseSplitOperation keys off statusNum, not approved/paid state) → API revert fires → paid expense reverts.

    Why the employee correctly errors: the employee never gets past step 3 (arrow hidden, "cannot be edited" modal). The blocking error footer they'd otherwise see is surfaced from the backend onto draftTransaction.errors (DynamicSplitExpensePage.tsx:288-294) via iou.error.genericEditFailureMessage.

    Alternative explanation considered: a backend authorization difference (admins allowed to modify settled expenses) likely also contributes — this would need an internal investigation of the split/revert backend command, which lives outside the App repo. Regardless of the backend, the App should not expose or execute the removal of an approved/paid split, so the frontend guard above is the right fix within App.

    Confidence: High for the App-side root cause (frontend gate + missing approved/paid guard, both verified in code). Two independent code investigations converged on the same mechanism.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/99190) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 21, 2026
  4. melvin-bot commented on Aug 21, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

  5. melvin-bot commented on Aug 21, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  6. melvin-bot commented on Aug 24, 2026

    @melvin-bot

    @shubham1206agra Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  7. shubham1206agra commented on Aug 26, 2026

    @shubham1206agra
    Contributor

    I need clarity about what should happen here. https://expensify.slack.com/archives/C01GTK53T8Q/p1787750088310699

  8. melvin-bot commented on Aug 31, 2026

    @melvin-bot

    @shubham1206agra Eep! 4 days overdue now. Issues have feelings too...

  9. 31 remaining items

  10. mallenexpensify commented on Oct 20, 2026

    @mallenexpensify
    Contributor

    Please comment and tag me if/when payment is due, thx

  11. dmkt9 commented on Oct 21, 2026

    @dmkt9
    Contributor

    Deploy Blocker #103791 was identified to be related to the PR #100281 that attempted to fix this issue.

    Not caused by #100281. Also occurs in production: #103791 (comment)

  12. lakchote commented on Oct 21, 2026

    @lakchote
    Contributor

    @mallenexpensify this one's due now, #100281 hit production on Oct 13. The deploy blocker #103791 wasn't caused by it, the same bug happens on production without it.

  13. mallenexpensify commented on Oct 21, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @ZhenjaHorbach due $250 via NewDot
    Contributor+: @dmkt9 paid $250 via Upwork

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.

    https://www.upwork.com/jobs/~022113035647953503693

  14. changed the title [-]Split - Approved, Paid and/or Done expense amounts are changed if the last split is in Draft and removed[/-] [+][Due for payment 2026-10-21] Split - Approved, Paid and/or Done expense amounts are changed if the last split is in Draft and removed[/+] on Oct 21, 2026
  15. melvin-bot commented on Oct 21, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. dmkt9 commented on Oct 22, 2026

    @dmkt9
    Contributor

    25. @dmkt9 can you please accept the job below? Please reply here and tag me once you have.

    @mallenexpensify I noticed that the job details are just a template. Could you resend the offer?

  17. mallenexpensify commented on Oct 22, 2026

    @mallenexpensify
    Contributor

    @dmkt9 apologies, there's been a Chrome +TextExpander bug recently. can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022113380053525892208

  18. dmkt9 commented on Oct 23, 2026

    @dmkt9
    Contributor

    53. @dmkt9 apologies, there's been a Chrome +TextExpander bug recently. can you please accept the job below? Please reply here and tag me once you have.

    @mallenexpensify Thanks. I've accepted the offer

  19. mallenexpensify commented on Oct 23, 2026

    @mallenexpensify
    Contributor

    @dmkt9 paid, summary updated above. Thx.

  20. garrettmknight commented on Nov 5, 2026

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions