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
[HOLD for payment 2024-11-11] [$250] Held expense-Negative amount in transaction thread for held expense after paying unheld expense #49754
Version Number: 9.0.40-1 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR:#49463 Email or phone of affected tester (no customers):applausetester+kh010901@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Go to staging.new.expensify.com
[User A] Submit two expenses to User B.
[User A] Hold one of the expenses.
[User B] Go offline.
[User B] Pay the unheld expense.
[User B] Click on the expense preview of the held expense in the main chat.
Expected Result:
The amount in the transaction thread will not be negative.
@OfstadC FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
// The amounts are stored using an opposite sign and negative values can be set,
// we need to return an opposite sign than is saved in the transaction object
letamount=transaction?.modifiedAmount??0;
if(amount){
return-amount;
}
However, when we handle the pay money request and use getReportFromHoldRequestsOnyxData, we are actually creating an ExpenseReport. For 1:1 direct messages, it should instead be an IOUReport.
This is also not consistent with the BE response in case of 1:1 DMs the backend will return an IOUReport
What changes do you think we should make in order to solve the problem?
We should add a check here isPolicyExpenseChat. The idea is that if it's a policy expense chat, we should build an optimistic expense report using buildOptimisticExpenseReport. If it's not a policy expense chat, then we should build an optimistic IOU report using buildOptimisticIOUReport. This is the same logic we are using here Pseudocode
changed the title [-][$250] Held expense-Negative amount in transaction thread for held expense after paying unheld expense[/-][+][HOLD for payment 2024-11-11] [$250] Held expense-Negative amount in transaction thread for held expense after paying unheld expense[/+]on Nov 4, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.56-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@hungvu193@OfstadC 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]
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
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: We already created some tests to prevent this case, I don't think we need regression test for this one.
Activity
melvin-bot commentedon Sep 25, 2024
Triggered auto assignment to @OfstadC (
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.IuliiaHerets commentedon Sep 25, 2024
We think that this bug might be related to #wave-collect - Release 1
IuliiaHerets commentedon Sep 25, 2024
@OfstadC FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Nodebrute commentedon Sep 26, 2024
Edited by proposal-police: This proposal was edited at 2024-10-09 18:11:01 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Negative amount in transaction thread for held expense after paying unheld expense
What is the root cause of that problem?
For expense report case we add
-before amount because the amounts are stored using an opposite signApp/src/libs/TransactionUtils/index.ts
Lines 345 to 351 in b655040
However, when we handle the pay money request and use
getReportFromHoldRequestsOnyxData, we are actually creating an ExpenseReport. For 1:1 direct messages, it should instead be anIOUReport.App/src/libs/actions/IOU.ts
Lines 6451 to 6459 in b655040
This is also not consistent with the BE response in case of 1:1 DMs the backend will return an
IOUReportWhat changes do you think we should make in order to solve the problem?
We should add a check here isPolicyExpenseChat. The idea is that if it's a policy expense chat, we should build an optimistic expense report using
buildOptimisticExpenseReport. If it's not a policy expense chat, then we should build an optimistic IOU report usingbuildOptimisticIOUReport. This is the same logic we are using here PseudocodeAfter this change, this line will evaluate to false, and we'll move to this block, where we'll apply
-amount, which will fix the bugApp/src/libs/TransactionUtils/index.ts
Line 337 in b655040
Note: This is pseudocode only. We need to test the implementation with multiple test cases, which can be done in the pull request (PR).
What alternative solutions did you explore? (Optional)
We can use
buildOptimisticIOUReporthere instead ofbuildOptimisticExpenseReportOfstadC commentedon Sep 27, 2024
Missed this yesterday - reviewing now
melvin-bot commentedon Sep 30, 2024
@OfstadC Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
OfstadC commentedon Oct 1, 2024
I had issues reproducing this on Friday - forgot to add a comment here.
m-natarajan commentedon Oct 1, 2024
Able to reproduce
20241001_220541.mp4
36 remaining items
[-][$250] Held expense-Negative amount in transaction thread for held expense after paying unheld expense[/-][+][HOLD for payment 2024-11-11] [$250] Held expense-Negative amount in transaction thread for held expense after paying unheld expense[/+]melvin-bot commentedon Nov 4, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 4, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.56-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 2024-11-11. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 4, 2024
@hungvu193 @OfstadC 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]
OfstadC commentedon Nov 5, 2024
Commenting to please Melly Melvin. @hungvu193 Please ensure BZ checklist is completed by payment date. Thank you!
hungvu193 commentedon Nov 11, 2024
Link to comment: https://github.com/Expensify/App/pull/42573/files#r1836147530
Link to discussion: N/A
OfstadC commentedon Nov 11, 2024
Payment Summary
garrettmknight commentedon Nov 20, 2024
$250 approved for @hungvu193