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-11] [$250] Expense - Error shows up after approving held expenses which are also duplicates #62423
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.1.47-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):sjdoisjsdoddjs@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Delayed submissions is set to Manually
Add approvals is enabled
Go to staging.new.expensify.com
Go to workspace chat
Submit two expenses with the same amount
Click on the expense preview to go to expense report
Right click on any expense preview > Hold
Enter reason and save it
Click More > Submit
Click More
Click Approve
Expected Result:
There will be a confirmation modal to approve full amount or unheld amount
Actual Result:
There is no confirmation modal to approve full amount or unheld amount
Error shows up after approving held expenses which are also duplicates
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Platforms Tested:
On which of our officially supported platforms was this issue tested:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidenceBug6837271_1747762362373.20250521_012811.mp4
Please re-state the problem that we are trying to solve in this issue.
When a user tries to approve an expense report that contains at least one held expense, a confirmation modal should appear, allowing the user to choose whether to approve only the unheld amount or the full amount.
As a result, the modal was only shown when using the primary Approve button, but not from the secondary actions menu.
What changes do you think we should make in order to solve the problem?
We should update the secondary actions menu so that the Approve action calls the same confirmApproval function as the primary Approve button.
This ensures that the modal is always shown when there are held expenses, regardless of how the user initiates the approval.
Solution code:
[CONST.REPORT.SECONDARY_ACTIONS.APPROVE]: {text: translate('iou.approve',getAmount(CONST.REPORT.SECONDARY_ACTIONS.APPROVE)),icon: Expensicons.ThumbsUp,value: CONST.REPORT.SECONDARY_ACTIONS.APPROVE,// Use confirmApproval to ensure the hold confirmation modal is shown if there are held expenses.// This keeps the behavior consistent with the primary Approve button.onSelected: confirmApproval,},
Now, the logic for showing the modal is unified and always works as expected.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Approving a report with at least one held expense via the primary Approve button should show the confirmation modal.
Approving a report with at least one held expense via the secondary actions menu should also show the confirmation modal.
Approving a report with no held expenses should not show the modal and should proceed directly.
What alternative solutions did you explore? (Optional)
Adding a separate check inside approveMoneyRequest to show the modal if called directly.
This was rejected because it would mix UI logic with business logic and could lead to duplicated code.
⚠️@Tony-MK Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
⚠️@Tony-MK Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
Please re-state the problem that we are trying to solve in this issue.
Expense - Error shows up after approving held expenses, which are also duplicates
What is the root cause of that problem?
getSecondaryReportActions adds the approve action because the isApproveAction function does not check whether the report has violations to return false.
What changes do you think we should make in order to solve the problem?
Other than checking for reportHasDuplicatedTransactions, we can return false early when the report has violations or add an extra to this condition in isApproveAction.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Create test cases for getSecondaryReportActions where the report has violations.
What alternative solutions did you explore? (Optional)
Please re-state the problem that we are trying to solve in this issue.
There is no confirmation modal to approve full amount or unheld amount
Error shows up after approving held expenses which are also duplicates
What is the root cause of that problem?
The reason the API returns the error is the full parameter is undefined, we called approveMoneyRequest without full param and this function has no default value for this param
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)
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-]Expense - Error shows up after approving held expenses which are also duplicates[/-][+][$250] Expense - Error shows up after approving held expenses which are also duplicates[/+]on May 21, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.58-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@ishpaul777@laurenreidexpensify@ishpaul777 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]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[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:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[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:
[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: No need this came from a large new feature PR case might not be considered then
[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.- No need this part [Simplified actions] project we'd have enough tests covering the flow
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon May 20, 2025
Triggered auto assignment to @laurenreidexpensify (
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.ganzz4 commentedon May 20, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user tries to approve an expense report that contains at least one held expense, a confirmation modal should appear, allowing the user to choose whether to approve only the unheld amount or the full amount.
What is the root cause of that problem?
The root cause is in the file
src/components/MoneyReportHeader.tsx, inside thesecondaryActionsImplementationobject.Specifically, the Approve action in the secondary actions menu was directly calling
approveMoneyRequest(moneyRequestReport), bypassing the logic in confirmApproval that checks for held expenses and shows the modal if needed.Problematic code:
App/src/components/MoneyReportHeader.tsx
Lines 627 to 637 in c4dfb1c
As a result, the modal was only shown when using the primary Approve button, but not from the secondary actions menu.
What changes do you think we should make in order to solve the problem?
We should update the secondary actions menu so that the Approve action calls the same
confirmApprovalfunction as the primary Approve button.This ensures that the modal is always shown when there are held expenses, regardless of how the user initiates the approval.
Solution code:
Now, the logic for showing the modal is unified and always works as expected.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
approveMoneyRequestto show the modal if called directly.This was rejected because it would mix UI logic with business logic and could lead to duplicated code.
ganzz4 commentedon May 20, 2025
I've recorded a quick demo video showing the fix in action:
Result.mp4
github-actions commentedon May 20, 2025
github-actions commentedon May 20, 2025
Tony-MK commentedon May 20, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Error shows up after approving held expenses, which are also duplicates
What is the root cause of that problem?
getSecondaryReportActionsadds the approve action because theisApproveActionfunction does not check whether the report has violations to returnfalse.App/src/libs/ReportSecondaryActionUtils.ts
Lines 114 to 116 in 6977aaf
Unlike how
canApprovechecks forhasAnyViolationsand doesn't allow the user to approve the report.App/src/libs/ReportPreviewActionUtils.ts
Lines 73 to 77 in 6977aaf
App/src/libs/ReportPreviewActionUtils.ts
Line 87 in 6977aaf
What changes do you think we should make in order to solve the problem?
Other than checking for
reportHasDuplicatedTransactions, we can returnfalseearly when the report has violations or add an extra to this condition inisApproveAction.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Create test cases for
getSecondaryReportActionswhere the report has violations.What alternative solutions did you explore? (Optional)
N/A
thelullabyy commentedon May 21, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
There is no confirmation modal to approve full amount or unheld amount
Error shows up after approving held expenses which are also duplicates
What is the root cause of that problem?
The reason the API returns the error is the
fullparameter isundefined, we calledapproveMoneyRequestwithoutfullparam and this function has no default value for this paramApp/src/components/MoneyReportHeader.tsx
Line 635 in 15463ca
App/src/libs/actions/IOU.ts
Line 9065 in 15463ca
App/src/libs/actions/IOU.ts
Line 9248 in 15463ca
What changes do you think we should make in order to solve the problem?
confirmApprovalto display the confirm modal in the case has hold transactions.App/src/components/MoneyReportHeader.tsx
Line 635 in 15463ca
trueforfullparamApp/src/libs/actions/IOU.ts
Line 9065 in 15463ca
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)
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[-]Expense - Error shows up after approving held expenses which are also duplicates[/-][+][$250] Expense - Error shows up after approving held expenses which are also duplicates[/+]melvin-bot commentedon May 21, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021925126785852858565
30 remaining items
melvin-bot commentedon Jun 4, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.58-4 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 2025-06-11. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 4, 2025
@ishpaul777 @laurenreidexpensify @ishpaul777 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]
laurenreidexpensify commentedon Jun 9, 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:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
laurenreidexpensify commentedon Jun 9, 2025
@ishpaul777 bump for checklist before payment thanks
melvin-bot commentedon Jun 11, 2025
Payment Summary
Upwork Job
BugZero Checklist (@laurenreidexpensify)
laurenreidexpensify commentedon Jun 11, 2025
@ishpaul777 pls complete checklist thanks
ishpaul777 commentedon Jun 11, 2025
will do in couple hours
ishpaul777 commentedon Jun 11, 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:
[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: No need this came from a large new feature PR case might not be considered then
[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.- No need this part [Simplified actions] project we'd have enough tests covering the flow
laurenreidexpensify commentedon Jun 12, 2025
Payment Summary:
garrettmknight commentedon Jul 3, 2025
$250 approved for @ishpaul777