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 2025-06-02] [$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline #61050
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2ReviewingHas a PR in review
Version Number: 9.1.33-3 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only If this was caught during regression testing, add the test name, ID and link from TestRail: Exp Email or phone of affected tester (no customers):applausetester+290404kh@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Mac 15.3 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Invoice feature is enabled.
Go to staging.new.expensify.com
Go offline.
Go to FAB > Send invoice.
Enter amount > Next.
Select any user > Next.
Click Send invoice.
Go to invoice thread.
Click Amount.
Edit the amount and save it.
Expected Result:
The new amount in invoice thread header will match the edited amount.
Actual Result:
The new amount in invoice thread header is not the same as the edited amount when edited offline.
Please re-state the problem that we are trying to solve in this issue.
The new amount in invoice thread header is not the same as the edited amount when edited offline.
What is the root cause of that problem?
The invoice report's total and transaction amount should be negative (compared to BE final response) but they are optimistically positive. Leading to the total calculation logic here to be incorrect:
// For expense report, the amount is negative, so we should subtract total from diff
updatedMoneyRequestReport={
...iouReport,
total: iouReport.total-diff,
};
So for example, the previous total is 100, the updated one is 200, so the diff is 100, and by the above logic, the calculated updated total is 100 - 100 = 0. The previous total should have been negative as the comment in the above snippet suggested.
What changes do you think we should make in order to solve the problem?
Update buildOptimisticInvoiceReporthere and buildOptimisticTransaction in getSendInvoiceInformationhere to build with negative amounts.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
Update the IOUTest's sendInvoice test case here to include update amount with same currency case.
changed the title [-]Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-][+][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+]on Apr 29, 2025
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
changed the title [-][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-][+][Due for payment 2025-06-02] [$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+]on Jun 2, 2025
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2ReviewingHas a PR in review
Activity
melvin-bot commentedon Apr 29, 2025
Triggered auto assignment to @lydiabarclay (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.mkzie2 commentedon Apr 29, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The new amount in invoice thread header is not the same as the edited amount when edited offline.
What is the root cause of that problem?
The invoice report's
totaland transactionamountshould be negative (compared to BE final response) but they are optimistically positive. Leading to thetotalcalculation logic here to be incorrect:App/src/libs/actions/IOU.ts
Lines 3842 to 3847 in 59cb784
So for example, the previous
totalis100, the updated one is200, so thediffis100, and by the above logic, the calculated updatedtotalis100 - 100 = 0. The previous total should have been negative as the comment in the above snippet suggested.What changes do you think we should make in order to solve the problem?
Update
buildOptimisticInvoiceReporthere andbuildOptimisticTransactioningetSendInvoiceInformationhere to build with negative amounts.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
Update the
IOUTest'ssendInvoicetest case here to include update amount with same currency case.melvin-bot commentedon Apr 29, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021917347146786979910
[-]Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-][+][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+]melvin-bot commentedon Apr 29, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (
External)hoangzinh commentedon May 1, 2025
@mkzie2's proposal looks good to me.
Link to proposal #61050 (comment)
🎀👀🎀 C+ reviewed
melvin-bot commentedon May 1, 2025
Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
9 remaining items
mkzie2 commentedon May 6, 2025
Oh lucky for me it was fixed elsewhere. PR ready for review.
melvin-bot commentedon Jun 2, 2025
This issue has not been updated in over 15 days. @hoangzinh, @luacmartins, @mkzie2, @lydiabarclay eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
mkzie2 commentedon Jun 2, 2025
@lydiabarclay @luacmartins PR #61361 hit production 3 weeks ago. Ready for payment.
hoangzinh commentedon Jun 2, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/40015/files#r2121223051
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/507069
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
lydiabarclay commentedon Jun 2, 2025
@mkzie2 I had to make a new job posting because the other expired, offer sent to you!
lydiabarclay commentedon Jun 2, 2025
Payment Summary
Contributor: @mkzie2 paid $250 via Upwork
Contributor+: @hoangzinh due $250 via NewDot
✅ Regression test filed
[-][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-][+][Due for payment 2025-06-02] [$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+]hoangzinh commentedon Jun 3, 2025
Requested in ND
garrettmknight commentedon Jun 3, 2025
$250 approved for @hoangzinh