Skip to content

[$175] [Exploratory] Split - Report of Employee appears in Admin workspace chat after revert split #103833

Open

Description

@applause-bot

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


Version Number: v9.5.7-3
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/77992157/folder/57600017/41237175/1844841065?sort=%2Bidentifier
Email or phone of affected tester (no customers): leungbratt6+121013@gmail.com
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:
Create a new workspace with Delay submission manual and Add approvals enabled
Invite an Employee to the workspace
Steps:

  1. Open the New Dot app as the submitter
  2. Create an expense and submit the report to the workspace
  3. As the Admin, open the Employee's expense
  4. Click on More > Split > Save the split
  5. Click the split expense - More - Edit Splits - Remove split - Save
  6. Open the Admin workspace chat

Expected Result:

The report should be in the Employee Workspace chat only

Actual Result:

Report of Employee appears in Admin workspace chat after revert split

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7285039_1791872927368.revert.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7285039

Upwork Automation - Do Not Edit

Activity

  1. applause-bot commented on Oct 13, 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/0b44aa7aa44c142b52c3d76cc894fac985fa094656f730c37edccb8772678bd4

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 19, 2026
  3. MelvinBot commented on Oct 19, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When the admin saves the edited splits, App looks up the workspace chat using the current user's account ID (the admin) instead of the report owner's (the employee). It then builds an optimistic report preview of the employee's report inside the admin's own workspace chat.

    • The employee's report is already submitted. Because of that, removing the split does not take the "revert split" path. It takes the normal edit-splits path (UpdateSplitTransaction). See SplitTransactionUpdate.ts:175-188 and L395.
    • On that path, the remaining split already lives in a workspace report, so isConfirmedWorkspaceTransaction is true. That triggers an override at SplitTransactionUpdate.ts:930-942. It calls getPolicyExpenseChat(currentUserPersonalDetails.accountID, ...), which returns the admin's chat. That chat replaces the correct employee chat that was already resolved from expenseReport.chatReportID (L348-L374).
    • getMoneyRequestInformation finds no preview for the employee's report in the admin's chat, so it creates one (MoneyRequestBuilder.ts:1706-1725). Removing a split changes the remaining split's amount, so this optimistic data is pushed. successData then clears its pending state, so the preview stays.

    The override was added for the self DM case, where the current user is always the owner. It came in with Add splits for unreported expenses. The API params contain no chat ID, so this is a frontend-only bug.

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

    In the override at SplitTransactionUpdate.ts:930-932, resolve the chat of the transaction's own report:

    1. Use the chat at existingTransactionReport.chatReportID.
    2. If that chat is not in Onyx, fall back to getPolicyExpenseChat(existingTransactionReport.ownerAccountID, policyID).
    3. If neither exists, skip the override so the existing expenseReport.chatReportID fallback applies.

    Optionally, set payeeAccountID and payeeEmail (L807-L809) to the report owner instead of the current user.

    Add a unit test in which an admin edits splits on another member's submitted report. It should assert that no reportActions update targets the admin's workspace chat.

    What alternative solutions did you explore? (Optional)

    Limit the override to the self DM context only (when chatReport is the self DM). This is narrower, but the owner-based lookup also fixes delegate and admin edits from any screen.

    Notes and open questions
    • This also likely affects normal edits (two or more splits, amount changed) on another member's report. The code takes the same override path. I have not reproduced this.
    • If the original split transaction ever has its real reportID in the admin's Onyx (instead of -2), the revert path would hit the same override. The fix above covers both paths.
    • I did not reproduce this in the browser, because the repro needs two accounts (employee and admin). The stray preview should disappear after a cache clear if it is local-only.

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


    view run

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 19, 2026
  5. melvin-bot commented on Oct 19, 2026

    @melvin-bot

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

  6. changed the title [-][Exploratory] Split - Report of Employee appears in Admin workspace chat after revert split[/-] [+][$175] [Exploratory] Split - Report of Employee appears in Admin workspace chat after revert split[/+] on Oct 19, 2026
  7. melvin-bot commented on Oct 19, 2026

    @melvin-bot
  8. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    @FitseTLT Whoops! This issue is 2 days overdue. Let's get this updated quick!

  9. 11 remaining items

  10. jeffrey-graham commented on Nov 7, 2026

    @jeffrey-graham
  11. melvin-bot commented on Nov 7, 2026

    @melvin-bot
  12. FitseTLT commented on Nov 9, 2026

    @FitseTLT
    Contributor

    Reviewing this week

  13. melvin-bot commented on Nov 10, 2026

    @melvin-bot

    @FitseTLT this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  14. melvin-bot commented on Nov 12, 2026

    @melvin-bot

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

  15. FitseTLT commented on Nov 13, 2026

    @FitseTLT
    Contributor

    Not overdue

  16. cocvn157 commented on Nov 14, 2026

    @cocvn157

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When an employee splits an expense on a workspace, submits the report, and a workspace admin opens Split expense on one of the splits, deletes one split row (leaving one remaining split), and saves, an optimistic report preview of the employee's expense report is erroneously created inside the admin's own workspace expense chat instead of staying solely in the employee's workspace expense chat.

    What is the root cause of that problem?

    1. Why saving one remaining split on a submitted report takes the UPDATE_SPLIT_TRANSACTION path:
      • In src/libs/actions/IOU/SplitTransactionUpdate.ts:441-442, hasEditableSplitExpensesLeft checks whether the remaining split's report is in an editable (unsubmitted) state, so for a submitted report isReverseSplitOperation is false and updateSplitTransactions executes the UPDATE_SPLIT_TRANSACTION loop across splitExpenses.
    2. The confirmed-workspace override in src/libs/actions/IOU/SplitTransactionUpdate.ts:971-983 looks up the workspace expense chat using the current user's accountID (the admin) instead of the report owner's accountID (the employee):
      • For the surviving split, existingTransactionReport is the employee's workspace expense report, so isConfirmedWorkspaceTransaction (line 787) is true.
      • At lines 971–973:
        const workspaceChatReport = isConfirmedWorkspaceTransaction
            ? getPolicyExpenseChat(currentUserPersonalDetails.accountID, existingTransactionReport?.policyID, allReportsList)
            : undefined;
        Because getPolicyExpenseChat matches report.ownerAccountID === accountID, passing currentUserPersonalDetails.accountID resolves the admin's own policy expense chat rather than the employee's policy expense chat (existingTransactionReport.chatReportID).
      • Lines 974–983 then overwrite both requestMoneyInformation.participantParams.participant.reportID and requestMoneyInformation.parentChatReport with the admin's workspace chat while keeping moneyRequestReportIDForSplit = splitTransaction?.reportID (the employee's expense report at line 1002).
      • Additionally, at lines 849–850, payeeEmail and payeeAccountID are unconditionally set to currentUserPersonalDetails instead of the report owner when existingTransactionReport belongs to another member.
    3. Why getMoneyRequestInformation creates a stray report preview in the admin's workspace chat:
      • Inside getMoneyRequestInformation (src/libs/actions/IOU/MoneyRequestBuilder.ts), it searches parentChatReport (the admin's workspace chat) for an existing REPORT_PREVIEW action for moneyRequestReportID (the employee's expense report). Finding none in the admin's chat, it calls buildOptimisticReportPreview(parentChatReport, iouReport, ...) and pushes a brand-new optimistic REPORT_PREVIEW action into reportActions_<adminWorkspaceChatReportID>.
      • Because deleting one split changes the surviving split's amount (hasChanges = true at line 1217), lines 1615–1618 push moneyRequestInformationOnyxData.optimisticData (and successData, which clears pendingAction) into Onyx, leaving the employee's report preview permanently visible inside the admin's workspace chat.

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

    In src/libs/actions/IOU/SplitTransactionUpdate.ts:971-983, resolve workspaceChatReport from the split's own existingTransactionReport (chatReportID first, then ownerAccountID), never from currentUserPersonalDetails.accountID:

    1. Resolve the report owner's workspace chat at lines 971–983:

      const workspaceChatReport = isConfirmedWorkspaceTransaction
          ? (
                (existingTransactionReport?.chatReportID
                    ? getReportOrDraftReport({
                          reportID: existingTransactionReport.chatReportID,
                          reportDraft: reportDrafts?.[`${ONYXKEYS.COLLECTION.REPORT_DRAFT}${existingTransactionReport.chatReportID}`] ?? {},
                      })
                    : undefined) ??
                (existingTransactionReport?.ownerAccountID
                    ? getPolicyExpenseChat(existingTransactionReport.ownerAccountID, existingTransactionReport?.policyID, allReportsList)
                    : undefined)
            )
          : undefined;
      • If existingTransactionReport.chatReportID exists in allReportsList or reportDrafts, use it directly.
      • Otherwise, if existingTransactionReport.ownerAccountID is defined, look up getPolicyExpenseChat(existingTransactionReport.ownerAccountID, existingTransactionReport.policyID, allReportsList).
      • If neither resolves in Onyx, do not override participant / parentChatReport with the current user's chat; let the already-resolved fallbackPolicyParentChatReport / fallbackPolicyParticipant (lines 397-421, which already use expenseReport.chatReportID and expenseReport.ownerAccountID) remain in effect.
    2. Add a regression test in tests/actions/IOUTest/SplitTest.ts:

      • Set up an employee-owned submitted workspace expense report (ownerAccountID: employeeAccountID, chatReportID: employeeChatReportID) with two split child transactions, and a separate admin policy expense chat (ownerAccountID: adminAccountID).
      • Call updateSplitTransactions as the admin with one remaining split and verify that reportActions_<adminChatReportID> receives no REPORT_PREVIEW action while the update targets employeeChatReportID and expenseReport.reportID.

    What alternative solutions did you explore? (Optional)

    • Falling back to existingTransactionReport?.ownerAccountID ?? currentUserPersonalDetails.accountID: Rejected because if ownerAccountID is temporarily absent on a partial report object while chatReportID is present, falling back to currentUserPersonalDetails.accountID would re-introduce the exact same bug.
    • Only running the override when opened from Self DM: Rejected because an admin or copilot delegate can also edit splits from Search or directly from the report thread; resolving workspaceChatReport via existingTransactionReport.chatReportID / existingTransactionReport.ownerAccountID works consistently across all entry points.
  17. expensify-chore-bot commented on Nov 18, 2026

    @expensify-chore-bot

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

  18. FitseTLT commented on Nov 18, 2026

    @FitseTLT
    Contributor

    not overdue

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions