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-07-30] [$250] Reports - "Pay" button displayed on unapproved expense preview after changing workspace. #63291
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.56-1 Reproducible in staging?: Yes Reproducible in production?: Yes 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):ibellicotest+948@gmail.com Issue reported by: Applause Internal Team Device used: Motorola MotoG60 - Android 12 - Chrome App Component: Search
Action Performed:
Prerequisite: User has at least two workspace created.
Prerequisite 2: Both workspaces has delayed submissions and approvals enabled.
Open the Expensify app.
Open any workspace chat.
Submit a manual expense.
Tap on "Submit" on expense preview.
Navigate to "Workspaces" and delete the workspace where the expense was submitted.
Navigate to "Reports"
Open the just created expense.
Tap on "More" and select "Change Workspace"
Select another workspace and change the expense to it,
Tap on the arrow on the top left corner to return to expenses list.
Return to inbox.
Navigate to "Reports" again.
Note that a "Pay" button appeared on the expense preview, despite being unapproved.
Open the expense.
Note that an "Approve" button is displayed on top.
Expected Result:
"Approve" button should be displayed on the preview of an expense that is still unapproved.
Actual Result:
After changing an unapproved expense from a deleted workspace to a different one, a "Pay" button appears on preview on "Reports" despite the expense being still unapproved.
We don't optimistically unarchive the expense report when moving the report to another workspace, but BE also doesn't do that either, so it's maybe expected. canIOUBePaid actually also checks whether the report is archived or not, but it checks the chat report instead of the expense report, and it's not archived, so the pay button is shown.
Then, why the approve button show on the expense report page? It's because it uses the ReportPrimaryActionUtils and it doesn't check if the expense report is archived or not.
What changes do you think we should make in order to solve the problem?
Assuming it's the expected behavior that the expense report archived status is still true (if not, we need to unarchive it optimistically and on the BE), we first need to decide the approve and pay behavior, should we hide the approve and pay button when the expense report is archived?
If yes, then
We need to update canIOUBePaid so it checks for the expense report instead of the chat report
Update ReportPrimaryActionUtils.isApproveAction (and ReportPreviewActionUtils) to return false if the expense report is archived, just like we did with ReportPrimaryActionUtils.isPrimaryPayAction.
Else, we need to remove the archived check.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
changed the title [-]Reports - "Pay" button displayed on unapproved expense preview after changing workspace.[/-][+][$250] Reports - "Pay" button displayed on unapproved expense preview after changing workspace.[/+]on Jun 3, 2025
@lydiabarclay@srikarparsi I can confirm that the Approve button was visible when we did test the PR. Moreover this has been tested a few times considering having conflicts, and then retesting after BE change.
This flow didn't work before as the workspace was archived and we are only updating the archived field here. The button after the fix was pushed (my video here and @bernhardoj's latest video here). Hence I feel the linked issue is not regression and should be treated separately.
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: Long standing bug couldn't pinpoint an offending PR. Can also be treated as a feature request.
[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: NA
[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.
I am also posting two scenarios here. The change we made was more of an unarchiving the workspace and unrelated to the primary actions. If it was an issue from this PR, then both the scenarios would've failed.
Scenario 1: If you see Submit button shows up and then subsequent action of Approve shows just fine.
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 Jun 3, 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.bernhardoj commentedon Jun 3, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pay button is displayed in reports page when the report is not approved yet.
What is the root cause of that problem?
The pay button shows when
canIOUBePaidis true. We already check if the report should be approved first or not by usingcanApproveIOU.App/src/libs/actions/IOU.ts
Line 9149 in 4905ee6
However, it returns false because the expense report is archived.
App/src/libs/actions/IOU.ts
Line 9075 in 4905ee6
We don't optimistically unarchive the expense report when moving the report to another workspace, but BE also doesn't do that either, so it's maybe expected.
canIOUBePaidactually also checks whether the report is archived or not, but it checks the chat report instead of the expense report, and it's not archived, so the pay button is shown.App/src/libs/actions/IOU.ts
Line 9157 in 4905ee6
Then, why the approve button show on the expense report page? It's because it uses the ReportPrimaryActionUtils and it doesn't check if the expense report is archived or not.
App/src/libs/ReportPrimaryActionUtils.ts
Lines 88 to 120 in 4905ee6
Only for pay button it checks whether the expense report is archived or not.
App/src/libs/ReportPrimaryActionUtils.ts
Lines 136 to 138 in 4905ee6
What changes do you think we should make in order to solve the problem?
Assuming it's the expected behavior that the expense report archived status is still true (if not, we need to unarchive it optimistically and on the BE), we first need to decide the approve and pay behavior, should we hide the approve and pay button when the expense report is archived?
If yes, then
We need to update
canIOUBePaidso it checks for the expense report instead of the chat reportApp/src/libs/SearchUIUtils.ts
Lines 564 to 565 in 4905ee6
App/src/libs/actions/IOU.ts
Line 9108 in 4905ee6
Update
ReportPrimaryActionUtils.isApproveAction(and ReportPreviewActionUtils) to return false if the expense report is archived, just like we did withReportPrimaryActionUtils.isPrimaryPayAction.Else, we need to remove the archived check.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
[-]Reports - "Pay" button displayed on unapproved expense preview after changing workspace.[/-][+][$250] Reports - "Pay" button displayed on unapproved expense preview after changing workspace.[/+]melvin-bot commentedon Jun 3, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021929949845432749842
melvin-bot commentedon Jun 3, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)mananjadhav commentedon Jun 7, 2025
@lydiabarclay Can you please confirm this?
lydiabarclay commentedon Jun 9, 2025
@Expensify/design what do u think
shawnborton commentedon Jun 9, 2025
I'm actually pretty lost on this one... @trjExpensify any ideas here?
If you have an expense in the processing state, I didn't realize you could even delete the workspace to begin with?
49 remaining items
lydiabarclay commentedon Jul 30, 2025
@mananjadhav can you advise, I am unclear whether this indicates a regression has occurred
srikarparsi commentedon Jul 31, 2025
I commented on the other issue, asking how it links back to this issue. I think we can wait on that response before issuing payment @lydiabarclay
mananjadhav commentedon Aug 1, 2025
@lydiabarclay @srikarparsi I can confirm that the
Approvebutton was visible when we did test the PR. Moreover this has been tested a few times considering having conflicts, and then retesting after BE change.This flow didn't work before as the workspace was archived and we are only updating the
archivedfield here. The button after the fix was pushed (my video here and @bernhardoj's latest video here). Hence I feel the linked issue is not regression and should be treated separately.lydiabarclay commentedon Aug 1, 2025
Ok great, can you please fill out the bz checklist @mananjadhav ?
lydiabarclay commentedon Aug 1, 2025
Payment Summary
Contributor: @bernhardoj due $250 via NewDot
Contributor+: @mananjadhav due $250 via NewDot
✅ Regression test filed
mananjadhav commentedon Aug 1, 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: Long standing bug couldn't pinpoint an offending PR. Can also be treated as a feature request.
[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: NA
[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/532872
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
mananjadhav commentedon Aug 1, 2025
I am also posting two scenarios here. The change we made was more of an unarchiving the workspace and unrelated to the primary actions. If it was an issue from this PR, then both the scenarios would've failed.
Scenario 1: If you see
Submitbutton shows up and then subsequent action ofApproveshows just fine.submit-button-shows-up.mov
Scenario 2: Approve button doesn't show up.
approve-button-not-showing-up.mov
lydiabarclay commentedon Aug 4, 2025
Payment summary here
bernhardoj commentedon Aug 5, 2025
Requested in ND.
flaviadefaria commentedon Aug 6, 2025
$250 Approved for @mananjadhav
JmillsExpensify commentedon Aug 20, 2025
$250 approved for @bernhardoj