Skip to content

[Due for payment 2026-10-08] [$175] [Exploratory] Expense-Total amount displays negative on the table after change IOU to the workspace #97759

Closed

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.4.49-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/67509885/folder/13176670/41237100/1627270431?sort=-identifier
Email or phone of affected tester (no customers): lekima20+60408@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Win 11/Chrome
App Component: Money Requests

Action Performed:

  1. Open https://staging.new.expensify.com
  2. Create 2 expenses to a 1:1 conversation with any other user
  3. Navigate to the IOU Report details
  4. Click on More
  5. Click on "Change Workspace"
  6. Select any workspace

Expected Result:

Total amount should display correctly on the table

Actual Result:

Total amount is displayed negative on the table. On android and iOS, negative amount briefly displays then changing to correct amount
In the Android and iOS apps, a negative amount is briefly displayed and then changes to the correct amount.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7225235_1785817738080.Recording__2365.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit

Activity

  1. applause-bot commented on Aug 4, 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/233d9468f7ce4fc73729bd3d7df95c9701ae55ef789cde739c1e616b7ea5c47c

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

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The optimistic data for "Change Workspace" on an IOU report flips the sign of total but forgets the four sibling total columns, and the display code reads one of those instead of total.

    IOU reports store totals positive; expense reports store them negative (ReportUtils.ts:7230-7235). When you pick a workspace, DynamicReportChangeWorkspacePage.tsx:147-165 routes IOU reports into convertIOUReportToExpenseReport, whose optimistic report object at Report/index.ts:7449-7457 sets type: EXPENSE and total: -(iouReport.total) — but reimbursableTotal, unheldTotal, unheldReimbursableTotal, nonReimbursableTotal and unheldNonReimbursableTotal ride along unchanged from the spread, still positive.

    Every Total on screen comes from getMoneyRequestSpendBreakdown (ReportUtils.ts:4805-4844), which prefers the stale reimbursableTotal over total (getReimbursableTotal, ReportUtils.ts:4779-4783) and then negates it because the report is now an expense report. For a $100 IOU: total becomes -10000 (correct), reimbursableTotal stays +10000, so the breakdown returns 10000 * -1 = -10000 → -$100.00.

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

    In convertIOUReportToExpenseReport (Report/index.ts:7449-7457), negate the whole family of total columns, not just total: reimbursableTotal, nonReimbursableTotal, unheldTotal, unheldReimbursableTotal, unheldNonReimbursableTotal. This matches what the sibling expense-report flows already do (buildOptimisticChangePolicyData, Report/index.ts:8136-8151) and what IOUUtils.ts:272-280 does when an IOU flips owner.

    Apply the same change to the duplicated block in Policy.ts:4687-4696 (create-workspace-from-IOU), which has the identical omission.

    Add a unit test asserting that after convertIOUReportToExpenseReport, getMoneyRequestSpendBreakdown(report).totalDisplaySpend is positive.

    Investigation details, blast radius, and what I could not verify

    Why native only flashes: there is no successData entry for the report key — only the server response repairs the totals, so the bad value is visible for exactly one round trip.

    Why web appears to persist: medium confidence only. convertIOUReportToExpenseReport pushes no SNAPSHOT optimistic update (unlike buildOptimisticChangePolicyData), and the page calls refreshSearch() instead. If the MoveIOUReportToExistingPolicy response omits reimbursableTotal, the Onyx MERGE keeps the stale positive value indefinitely — that would make the negative Total stick rather than flash. Confirming that needs a look at the backend response, which is outside this repo. The client-side fix above is correct either way.

    Other surfaces reading the same stale fields:

    Alternative explanations ruled out: convertToDisplayString does no sign work (CurrencyUtils.ts:142-170); getMoneyRequestSpendBreakdown is the single negation site and it keys only off report.type, not policyID or chatType. The child transactions are correctly negated (Report/index.ts:7497), which is why only the report-level Total is wrong. Note that the pre-reimbursableTotal fallback path would have rendered correctly, so this surfaced when getReimbursableTotal started preferring the backend field.

    Not reproduced live. The web test session failed to load past a blank page, so this analysis is from code only. It explains every reported symptom, including the platform difference.

    Possibly related: #98715 — also a negative amount from optimistic money-request data, but a different flow (Submit-to-someone from Self DM while offline), so likely a separate fix.


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


    view run · no recording available

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

    @melvin-bot

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

  6. melvin-bot commented on Sep 5, 2026

    @melvin-bot

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

  7. abzokhattab commented on Sep 7, 2026

    @abzokhattab
    Contributor

    @MelvinBot implement this

  8. 41 remaining items

  9. added
    BugSomething is broken. Auto assigns a BugZero manager.
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 7, 2026
  10. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    Current assignee @abzokhattab is eligible for the External assigner, not assigning anyone new.

  11. MelvinBot commented on Oct 7, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ✅ pass

    This issue is already fixed: Fix negative Total after moving an IOU report to a workspace merged on 2026-09-30, and current main negates every total column through getNegatedReportTotals at both conversion sites (Report/index.ts:7679, Policy.ts:4591). On dev web, moving a $30.00 IOU report ($10 + $20) to a workspace through More > Change Workspace showed a positive $30.00 Total, both right after the change and after the server response. No further change is needed.
    Report after settling showing positive $30.00 total

    Step Status
    Before changing workspace, the IOU report shows a positive Total ($30.00)The IOU report table showed Test Merchant $10.00, Test Merchant 2 $20.00, and Total $30.00, all positive.
    IOU report before workspace change showing positive $30.00 Total
    ✅
    Right after selecting a workspace in Change Workspace, the Total is positive ($30.00), not -$30.00The report (now "Expense Report 2026-10-07") showed the "Uncategorized · $30.00" group and Total $30.00 right away. Each expense stayed positive ($10.00 and $20.00).
    Report immediately after workspace change showing positive $30.00 total
    ✅
    After the server response settles, the Total and each expense amount are still positiveAfter a 5-second wait, the report still showed $10.00, $20.00, and Total $30.00, all positive.
    Report after settling showing positive $30.00 total
    ✅

    view run · view recording

  12. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  13. mallenexpensify commented on Oct 13, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @abzokhattab due $250 via NewDot

    @abzokhattab , @ikevin127 is the above correct? @ikevin127 it doesn't look like you reviewed the PR.

  14. abzokhattab commented on Oct 13, 2026

    @abzokhattab
    Contributor

    @mallenexpensify i think its not true. i reviewed the PR #100535

    Image
  15. ikevin127 commented on Oct 13, 2026

    @ikevin127
    Contributor

    ☝️ That checks out, I did not have any involvement in this issue / PR.

  16. mallenexpensify commented on Oct 14, 2026

    @mallenexpensify
    Contributor

    Apologies @abzokhattab , I got it backwards. Payment summary updated above

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions