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
[Due for payment 2026-10-08] [$175] [Exploratory] Expense-Total amount displays negative on the table after change IOU to the workspace #97759
Create 2 expenses to a 1:1 conversation with any other user
Navigate to the IOU Report details
Click on More
Click on "Change Workspace"
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.
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.
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.
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.
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.
✅
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).
✅
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.
Activity
applause-bot commentedon Aug 4, 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/233d9468f7ce4fc73729bd3d7df95c9701ae55ef789cde739c1e616b7ea5c47c
MelvinBot commentedon Sep 5, 2026
Proposal
What is the root cause of that problem?
The optimistic data for "Change Workspace" on an IOU report flips the sign of
totalbut forgets the four sibling total columns, and the display code reads one of those instead oftotal.IOU reports store totals positive; expense reports store them negative (
ReportUtils.ts:7230-7235). When you pick a workspace,DynamicReportChangeWorkspacePage.tsx:147-165routes IOU reports intoconvertIOUReportToExpenseReport, whose optimistic report object atReport/index.ts:7449-7457setstype: EXPENSEandtotal: -(iouReport.total)— butreimbursableTotal,unheldTotal,unheldReimbursableTotal,nonReimbursableTotalandunheldNonReimbursableTotalride along unchanged from the spread, still positive.Every Total on screen comes from
getMoneyRequestSpendBreakdown(ReportUtils.ts:4805-4844), which prefers the stalereimbursableTotalovertotal(getReimbursableTotal, ReportUtils.ts:4779-4783) and then negates it because the report is now an expense report. For a $100 IOU:totalbecomes-10000(correct),reimbursableTotalstays+10000, so the breakdown returns10000 * -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 justtotal:reimbursableTotal,nonReimbursableTotal,unheldTotal,unheldReimbursableTotal,unheldNonReimbursableTotal. This matches what the sibling expense-report flows already do (buildOptimisticChangePolicyData, Report/index.ts:8136-8151) and whatIOUUtils.ts:272-280does 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).totalDisplaySpendis positive.Investigation details, blast radius, and what I could not verify
Why native only flashes: there is no
successDataentry 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.
convertIOUReportToExpenseReportpushes noSNAPSHOToptimistic update (unlikebuildOptimisticChangePolicyData), and the page callsrefreshSearch()instead. If theMoveIOUReportToExistingPolicyresponse omitsreimbursableTotal, the OnyxMERGEkeeps 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:
SearchUIUtils.ts:3276MoneyRequestReportTransactionList.tsx:296ReportPreviewTotal.tsx:26unheldTotal—ReportUtils.ts:11713-11733SearchUIUtils.ts:4574-4577Alternative explanations ruled out:
convertToDisplayStringdoes no sign work (CurrencyUtils.ts:142-170);getMoneyRequestSpendBreakdownis the single negation site and it keys only offreport.type, notpolicyIDorchatType. The child transactions are correctly negated (Report/index.ts:7497), which is why only the report-level Total is wrong. Note that the pre-reimbursableTotalfallback path would have rendered correctly, so this surfaced whengetReimbursableTotalstarted 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
melvin-bot commentedon Sep 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abzokhattab (
External)melvin-bot commentedon Sep 5, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
abzokhattab commentedon Sep 7, 2026
@MelvinBot implement this
41 remaining items
melvin-bot commentedon Oct 7, 2026
Current assignee @abzokhattab is eligible for the External assigner, not assigning anyone new.
MelvinBot commentedon Oct 7, 2026
🤖 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

mainnegates every total column throughgetNegatedReportTotalsat 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.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.Right after selecting a workspace in Change Workspace, the Total is positive ($30.00), not -$30.00
The 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).After the server response settles, the Total and each expense amount are still positive
After a 5-second wait, the report still showed $10.00, $20.00, and Total $30.00, all positive.view run · view recording
melvin-bot commentedon Oct 7, 2026
Payment Summary
Resolving PRs:
Fix negative Total after moving an IOU report to a workspace #100535
Reviewer: @abzokhattab owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 13, 2026
Payment Summary
Contributor+: @abzokhattab due $250 via NewDot
@abzokhattab , @ikevin127 is the above correct? @ikevin127 it doesn't look like you reviewed the PR.
abzokhattab commentedon Oct 13, 2026
@mallenexpensify i think its not true. i reviewed the PR #100535
ikevin127 commentedon Oct 13, 2026
☝️ That checks out, I did not have any involvement in this issue / PR.
mallenexpensify commentedon Oct 14, 2026
Apologies @abzokhattab , I got it backwards. Payment summary updated above