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-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense #86093
Version Number: 9.3.42-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#83896 Email or phone of affected tester (no customers):sdjsdjosijnsodiosd@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
👋 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: #83896 - "Implement core "Duplicate report" action logic." by @Krishna2323 (High confidence) Related Issues: None found
Recommendation: REVERT
The PR introduced a bug in the duplicate report functionality where negative expense amounts are converted to positive amounts. This is a clear regression that breaks expected behavior for duplicating negative expenses.
Labels: No label changes made (keeping DeployBlockerCash as this is a frontend bug in the App repository)
📋 Detailed Analysis
Evidence
The issue states that duplicating an expense with a negative amount results in the duplicated expense showing a positive amount
The buildDuplicateTransactionParams function applies Math.abs() to the amount when duplicating transactions. This was likely done to ensure amounts are positive, but it incorrectly converts negative amounts (which are valid in Expensify for refunds, corrections, etc.) to positive values.
The bug occurs at line 524 in src/libs/actions/IOU/Duplicate.ts:
amount: Math.abs(transactionDetails?.amount??0),
When a negative expense is duplicated, Math.abs() strips the negative sign, resulting in a positive amount in the duplicated expense.
Fix Required
Remove the Math.abs() call from the amount field (and potentially taxAmount) to preserve the original sign of the amount when duplicating.
Please re-state the problem that we are trying to solve in this issue.
When duplicating an expense that has a negative amount (e.g., a credit or refund), the duplicated expense shows a positive amount instead of preserving the negative sign.
This was introduced in PR #83896. Here's how the sign is lost:
A negative expense on an expense report is stored with a positive amount in Onyx (expense reports negate amounts for storage).
getTransactionDetails(transaction) calls getAmount(), which negates the stored value back to a negative display amount (e.g., stored +5000 becomes -5000).
Math.abs() strips the negative sign, forcing it to 5000.
getMoneyRequestInformation() then negates again for expense report storage (-5000), which represents a normal positive expense — the credit/refund semantics are lost.
What changes do you think we should make in order to solve the problem?
Remove Math.abs() from lines 524-525 of src/libs/actions/IOU/Duplicate.ts, passing the amount directly:
amount: transactionDetails?.amount ?? 0
taxAmount: transactionDetails?.taxAmount ?? 0
This is safe because getTransactionDetails() already returns correctly sign-corrected amounts. For non-expense-report transactions, getAmount() already applies Math.abs() internally (since "IOU requests cannot have negative values"). For expense report transactions, the sign is meaningful and should be preserved.
What alternative solutions did you explore? (Optional)
An alternative would be to call getTransactionDetails(transaction, undefined, undefined, true) with allowNegativeAmount=true and keep Math.abs(). However, this is more complex and still doesn't solve the problem — allowNegativeAmount only affects the non-expense-report code path, and the expense report path already returns the correct signed amount regardless of that flag. Simply removing Math.abs() is the minimal and correct fix.
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 [-][RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/-][+][Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/+]on Mar 24, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.42-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@Valforte 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]
changed the title [-][Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/-][+][Due for payment 2026-04-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/+]on Mar 25, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.43-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@Valforte@mallenexpensify 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 23, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83896
melvin-bot commentedon Mar 23, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 23, 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 23, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #83896 - "Implement core "Duplicate report" action logic." by @Krishna2323 (High confidence)
Related Issues: None found
Recommendation: REVERT
The PR introduced a bug in the duplicate report functionality where negative expense amounts are converted to positive amounts. This is a clear regression that breaks expected behavior for duplicating negative expenses.
Labels: No label changes made (keeping
DeployBlockerCashas this is a frontend bug in the App repository)📋 Detailed Analysis
Evidence
Verification
/home/runner/_work/App/App/src/libs/actions/IOU/Duplicate.tsamount: Math.abs(transactionDetails?.amount ?? 0),taxAmount: Math.abs(transactionDetails?.taxAmount ?? 0),buildDuplicateTransactionParamsfunction which is called by bothduplicateExpenseTransactionandduplicateReportfunctionsRoot Cause
The
buildDuplicateTransactionParamsfunction appliesMath.abs()to the amount when duplicating transactions. This was likely done to ensure amounts are positive, but it incorrectly converts negative amounts (which are valid in Expensify for refunds, corrections, etc.) to positive values.The bug occurs at line 524 in
src/libs/actions/IOU/Duplicate.ts:When a negative expense is duplicated,
Math.abs()strips the negative sign, resulting in a positive amount in the duplicated expense.Fix Required
Remove the
Math.abs()call from the amount field (and potentially taxAmount) to preserve the original sign of the amount when duplicating.MelvinBot commentedon Mar 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When duplicating an expense that has a negative amount (e.g., a credit or refund), the duplicated expense shows a positive amount instead of preserving the negative sign.
What is the root cause of that problem?
The root cause is
Math.abs()applied to bothamountandtaxAmountinbuildDuplicateTransactionParams()atsrc/libs/actions/IOU/Duplicate.ts:524-525:This was introduced in PR #83896. Here's how the sign is lost:
getTransactionDetails(transaction)callsgetAmount(), which negates the stored value back to a negative display amount (e.g., stored+5000becomes-5000).Math.abs()strips the negative sign, forcing it to5000.getMoneyRequestInformation()then negates again for expense report storage (-5000), which represents a normal positive expense — the credit/refund semantics are lost.What changes do you think we should make in order to solve the problem?
Remove
Math.abs()from lines 524-525 ofsrc/libs/actions/IOU/Duplicate.ts, passing the amount directly:amount: transactionDetails?.amount ?? 0taxAmount: transactionDetails?.taxAmount ?? 0This is safe because
getTransactionDetails()already returns correctly sign-corrected amounts. For non-expense-report transactions,getAmount()already appliesMath.abs()internally (since "IOU requests cannot have negative values"). For expense report transactions, the sign is meaningful and should be preserved.What alternative solutions did you explore? (Optional)
An alternative would be to call
getTransactionDetails(transaction, undefined, undefined, true)withallowNegativeAmount=trueand keepMath.abs(). However, this is more complex and still doesn't solve the problem —allowNegativeAmountonly affects the non-expense-report code path, and the expense report path already returns the correct signed amount regardless of that flag. Simply removingMath.abs()is the minimal and correct fix.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.Krishna2323 commentedon Mar 23, 2026
Working on the PR...
Krishna2323 commentedon Mar 23, 2026
PR ready for review: #86098
cc: @hungvu193
melvin-bot commentedon Mar 23, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
6 remaining items
[-][RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/-][+][Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/+]melvin-bot commentedon Mar 24, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 24, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.42-3 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-03-31. 🎊
melvin-bot commentedon Mar 24, 2026
@Valforte 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 Mar 24, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)[-][Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/-][+][Due for payment 2026-04-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Negative amount is changed to positive amount after duplicating expense[/+]melvin-bot commentedon Mar 25, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.43-3 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-01. 🎊
melvin-bot commentedon Mar 25, 2026
@Valforte @mallenexpensify 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]