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-04-14] Reports - Deleted expense with negative amount is not shown negative #86783
Version Number: 9.3.51-0 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#85818 Email or phone of affected tester (no customers):soidnjsojdiosjiosdjo@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:
Go to staging.new.expensify.com
Go to workspace chat.
Create an expense with negative amount.
Delete the expense.
Go to Reports > Expenses.
Click Status, select Deleted and click Apply.
Expected Result:
The expense will show negative amount.
Actual Result:
Deleted expense with negative amount is not shown negative on Reports.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #85818 - "Deleted transactions on search" by @jnowakow (High confidence) Related Issues: None
Recommendation: ROLL FORWARD
PR #85818 added a significant new feature (deleted transactions support) and is likely a dependency for multiple subsequent PRs. The fix is straightforward: when calculating the amount for deleted transactions, the code needs to recognize them as expense-report-like transactions to preserve the negative sign.
The fix should add a check in src/libs/ReportUtils.ts in the getTransactionDetails function to treat deleted transactions (reportID === CONST.REPORT.TRASH_REPORT_ID) similarly to how unreported transactions or expense report transactions are handled, ensuring the allowNegative or isFromTrackedExpense parameter is set correctly when calling getTransactionAmount.
Labels: Keeping DeployBlockerCash (App PR caused the issue), removing DeployBlocker (not a backend issue)
📋 Detailed Analysis
Evidence
PR #85818 introduced support for deleted transactions in the search/reports view. The PR adds:
A new TRASH_REPORT_ID constant (-1) to identify deleted transactions
A new DELETED status filter for expenses
The isDeletedTransaction() helper function
UI changes to display deleted transactions with special styling
However, the PR did not account for how negative amounts should be displayed for deleted transactions.
Verification
I verified that PR #85818 modified the following key files:
src/libs/ReportUtils.ts - Added deleted status handling
src/libs/TransactionUtils/index.ts - Added isDeletedTransaction() function
src/libs/SearchUIUtils.ts - Added deleted expense status filtering
src/components/TransactionItemRow/index.tsx - Renders the amount via TotalCell
src/components/TransactionItemRow/DataCells/TotalCell.tsx - Uses getTransactionDetails() to get amount
Root Cause
The bug occurs in src/libs/ReportUtils.ts in the getTransactionDetails function (line 4650-4656):
Its reportID is set to CONST.REPORT.TRASH_REPORT_ID (-1)
getReportOrDraftReport() returns an empty/undefined report (because -1 is not a real report)
isFromExpenseReport becomes false
The third parameter isFromTrackedExpense is also false (because reportID is -1, not 0)
With both flags false, getTransactionAmount() takes the Math.abs() path (line 963-965 in TransactionUtils)
This strips the negative sign from the amount
For normal expense reports, isFromExpenseReport would be true, causing the amount to be negated (line 977-983), preserving negative amounts as negative.
Deleted transactions should be treated similarly to preserve their original sign.
The evidence chain: For workspace expenses, amounts are stored with the opposite sign (a -$5 expense is stored as +500). When displayed with isFromExpenseReport=true, the amount is correctly negated back to -500 (displaying as -$5). But after deletion, the report lookup fails → isFromExpenseReport=false → Math.abs(500) = 500 → displays as $5.00 instead of -$5.00.
The same issue affects the DataCells/TotalCell component at TransactionItemRow/DataCells/TotalCell.tsx:15, which calls getTransactionDetails(transactionItem) — this also loses the report context for deleted transactions since the report field on the transaction section is undefined.
What changes do you think we should make in order to solve the problem?
In SearchUIUtils.ts, when building transaction sections in getTransactionsSections, the policy is currently resolved from report?.policyID (line 1754). For deleted transactions, since report is undefined, policy is also undefined. The fix should resolve the policy independently of the report for deleted transactions.
One approach: when a transaction is detected as deleted (isDeletedTransaction(transactionItem)), try to resolve isExpenseReport using the policy from the transaction's own policyID if available, or fall through to the expense report negation logic. Since deleted transactions have already lost their report context, the getTransactionItemCommonFormattedProperties function should accept a flag (e.g., isDeletedTransaction) and when true, skip the Math.abs() and use the expense report sign convention (-amount), preserving the original amount sign. Alternatively, pass allowNegative = true to getAmount for deleted transactions to avoid the Math.abs() call.
The most targeted fix would be in getTransactionItemCommonFormattedProperties (around line 1133-1146 of SearchUIUtils.ts): detect if the transaction is deleted, and if so, call getTransactionAmount(transactionItem, isExpenseReport, false, true) (passing allowNegative = true as the 4th argument). This ensures Math.abs() is not applied, and the expense report sign convention is used instead, which correctly restores the negative sign for workspace expenses.
What alternative solutions did you explore? (Optional)
Preserving the original reportID on deleted transactions (backend change) — would be a more robust fix but requires backend coordination.
Using disableOppositeConversion = true — returns the raw stored amount, which doesn't work because expense report amounts are stored with opposite sign.
Embedding the report in the search data for deleted transactions — backend change that would allow the existing logic to work without modification.
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.
changed the title [-]Reports - Deleted expense with negative amount is not shown negative[/-][+][Due for payment 2026-04-14] Reports - Deleted expense with negative amount is not shown negative[/+]on Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.52-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@luacmartins The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Activity
melvin-bot commentedon Mar 31, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #85818
melvin-bot commentedon Mar 31, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 31, 2026
👋 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:
OSBotify commentedon Mar 31, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #85818 - "Deleted transactions on search" by @jnowakow (High confidence)
Related Issues: None
Recommendation: ROLL FORWARD
PR #85818 added a significant new feature (deleted transactions support) and is likely a dependency for multiple subsequent PRs. The fix is straightforward: when calculating the amount for deleted transactions, the code needs to recognize them as expense-report-like transactions to preserve the negative sign.
The fix should add a check in
src/libs/ReportUtils.tsin thegetTransactionDetailsfunction to treat deleted transactions (reportID === CONST.REPORT.TRASH_REPORT_ID) similarly to how unreported transactions or expense report transactions are handled, ensuring theallowNegativeorisFromTrackedExpenseparameter is set correctly when callinggetTransactionAmount.Labels: Keeping
DeployBlockerCash(App PR caused the issue), removingDeployBlocker(not a backend issue)📋 Detailed Analysis
Evidence
PR #85818 introduced support for deleted transactions in the search/reports view. The PR adds:
TRASH_REPORT_IDconstant (-1) to identify deleted transactionsDELETEDstatus filter for expensesisDeletedTransaction()helper functionHowever, the PR did not account for how negative amounts should be displayed for deleted transactions.
Verification
I verified that PR #85818 modified the following key files:
src/libs/ReportUtils.ts- Added deleted status handlingsrc/libs/TransactionUtils/index.ts- AddedisDeletedTransaction()functionsrc/libs/SearchUIUtils.ts- Added deleted expense status filteringsrc/components/TransactionItemRow/index.tsx- Renders the amount viaTotalCellsrc/components/TransactionItemRow/DataCells/TotalCell.tsx- UsesgetTransactionDetails()to get amountRoot Cause
The bug occurs in
src/libs/ReportUtils.tsin thegetTransactionDetailsfunction (line 4650-4656):When a transaction is deleted:
reportIDis set toCONST.REPORT.TRASH_REPORT_ID(-1)getReportOrDraftReport()returns an empty/undefined report (because-1is not a real report)isFromExpenseReportbecomesfalseisFromTrackedExpenseis alsofalse(because reportID is-1, not0)getTransactionAmount()takes the Math.abs() path (line 963-965 in TransactionUtils)For normal expense reports,
isFromExpenseReportwould betrue, causing the amount to be negated (line 977-983), preserving negative amounts as negative.Deleted transactions should be treated similarly to preserve their original sign.
MelvinBot commentedon Mar 31, 2026
Proposal
What is the root cause of that problem?
When a transaction is deleted, its
reportIDis changed toCONST.REPORT.TRASH_REPORT_ID('-1') — seeTransactionUtils/index.ts:140-142:This causes the original report context to be lost. In the search display flow, the report is looked up from search data at
SearchUIUtils.ts:1730:For deleted transactions, this resolves to
data["report_-1"]which isundefined. Then ingetTransactionItemCommonFormattedPropertiesat line 1133:Since
reportisundefined,isExpenseReportisfalse. This value is passed togetAmount()in TransactionUtils at line 958-966:The evidence chain: For workspace expenses, amounts are stored with the opposite sign (a -$5 expense is stored as +500). When displayed with
isFromExpenseReport=true, the amount is correctly negated back to -500 (displaying as -$5). But after deletion, the report lookup fails →isFromExpenseReport=false→Math.abs(500)= 500 → displays as $5.00 instead of -$5.00.The same issue affects the
DataCells/TotalCellcomponent atTransactionItemRow/DataCells/TotalCell.tsx:15, which callsgetTransactionDetails(transactionItem)— this also loses the report context for deleted transactions since thereportfield on the transaction section isundefined.What changes do you think we should make in order to solve the problem?
In
SearchUIUtils.ts, when building transaction sections ingetTransactionsSections, the policy is currently resolved fromreport?.policyID(line 1754). For deleted transactions, sincereportis undefined,policyis also undefined. The fix should resolve the policy independently of the report for deleted transactions.One approach: when a transaction is detected as deleted (
isDeletedTransaction(transactionItem)), try to resolveisExpenseReportusing the policy from the transaction's ownpolicyIDif available, or fall through to the expense report negation logic. Since deleted transactions have already lost their report context, thegetTransactionItemCommonFormattedPropertiesfunction should accept a flag (e.g.,isDeletedTransaction) and when true, skip theMath.abs()and use the expense report sign convention (-amount), preserving the original amount sign. Alternatively, passallowNegative = truetogetAmountfor deleted transactions to avoid theMath.abs()call.The most targeted fix would be in
getTransactionItemCommonFormattedProperties(around line 1133-1146 ofSearchUIUtils.ts): detect if the transaction is deleted, and if so, callgetTransactionAmount(transactionItem, isExpenseReport, false, true)(passingallowNegative = trueas the 4th argument). This ensuresMath.abs()is not applied, and the expense report sign convention is used instead, which correctly restores the negative sign for workspace expenses.What alternative solutions did you explore? (Optional)
reportIDon deleted transactions (backend change) — would be a more robust fix but requires backend coordination.disableOppositeConversion = true— returns the raw stored amount, which doesn't work because expense report amounts are stored with opposite sign.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.
3 remaining items
[-]Reports - Deleted expense with negative amount is not shown negative[/-][+][Due for payment 2026-04-14] Reports - Deleted expense with negative amount is not shown negative[/+]melvin-bot commentedon Apr 7, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.52-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-04-14. 🎊
melvin-bot commentedon Apr 7, 2026
@luacmartins The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Apr 7, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)