Repository navigation
[Due for payment 2025-06-02] [$250] Move expense - Expense can be moved to report of deleted workspace #62552
Description
Activity
- addedDeployBlockerCashThis issue or pull request should block deploymentThis issue or pull request should block deploymentBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on May 22, 2025 Triggered auto assignment to @bfitzexpensify (
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.Triggered auto assignment to @lakchote (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.💬 A slack conversation has been started in #expensify-open-source
github-actions commented
on May 22, 2025 on May 22, 2025 – with GitHub ActionsContributorMore actions👋 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.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense report from the deleted workspace appears in the Report list when moving expense.
What is the root cause of that problem?
It comes from #62270. But the current problem is
isReportOutstandingfunction doesn't return false for archived reports.App/src/pages/iou/request/step/IOURequestEditReportCommon.tsx
Lines 53 to 67 in 6871ba9
const expenseReports = useMemo( () => Object.values(allPoliciesID ?? {}).flatMap((policyID) => { if (!policyID) { return []; } const reports = getOutstandingReportsForUser(policyID, currentUserPersonalDetails.accountID, allReports ?? {}); return reports; }), [allPoliciesID, allReports, currentUserPersonalDetails.accountID], ); const reportOptions: ReportListItem[] = useMemo(() => { if (!allReports) { return []; Lines 9640 to 9647 in 6871ba9
function getOutstandingReportsForUser(policyID: string | undefined, reportOwnerAccountID: number | undefined, reports: OnyxCollection<Report> = allReports): Array<OnyxEntry<Report>> { if (!reports) { return []; } return Object.values(reports) .filter((report) => isReportOutstanding(report, policyID) && report?.ownerAccountID === reportOwnerAccountID) .sort((a, b) => a?.reportName?.localeCompare(b?.reportName?.toLowerCase() ?? '') ?? 0); } Lines 9618 to 9630 in 6871ba9
function isReportOutstanding(iouReport: OnyxInputOrEntry<Report>, policyID: string | undefined): boolean { if (!iouReport || isEmptyObject(iouReport)) { return false; } return ( isExpenseReport(iouReport) && iouReport?.stateNum !== undefined && iouReport?.statusNum !== undefined && iouReport?.policyID === policyID && iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport?.statusNum <= CONST.REPORT.STATUS_NUM.SUBMITTED && !hasForwardedAction(iouReport.reportID) ); What changes do you think we should make in order to solve the problem?
We should return false for archived report here
const reportNameValuePair = allReportNameValuePair?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${iouReport.reportID}`] ?? {}; return ( isExpenseReport(iouReport) && iouReport?.stateNum !== undefined && iouReport?.statusNum !== undefined && iouReport?.policyID === policyID && iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport?.statusNum <= CONST.REPORT.STATUS_NUM.SUBMITTED && !hasForwardedAction(iouReport.reportID) && !isArchivedReport(reportNameValuePair) );Lines 9618 to 9630 in 6871ba9
function isReportOutstanding(iouReport: OnyxInputOrEntry<Report>, policyID: string | undefined): boolean { if (!iouReport || isEmptyObject(iouReport)) { return false; } return ( isExpenseReport(iouReport) && iouReport?.stateNum !== undefined && iouReport?.statusNum !== undefined && iouReport?.policyID === policyID && iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport?.statusNum <= CONST.REPORT.STATUS_NUM.SUBMITTED && !hasForwardedAction(iouReport.reportID) ); Or we can filter out it here
Lines 9640 to 9647 in 6871ba9
function getOutstandingReportsForUser(policyID: string | undefined, reportOwnerAccountID: number | undefined, reports: OnyxCollection<Report> = allReports): Array<OnyxEntry<Report>> { if (!reports) { return []; } return Object.values(reports) .filter((report) => isReportOutstanding(report, policyID) && report?.ownerAccountID === reportOwnerAccountID) .sort((a, b) => a?.reportName?.localeCompare(b?.reportName?.toLowerCase() ?? '') ?? 0); } What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update
getOutstandingReportsForUsertest and verify the result doesn't include the archived report.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.
cc @jnowakow @DylanDylann @luacmartins @dangrous it comes from #62270
- removedDeployBlockerCashThis issue or pull request should block deploymentThis issue or pull request should block deployment
on May 22, 2025 33 remaining items
@rojiphil @bfitzexpensify @rojiphil 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]
Payment complete to @nkdengineer
@rojiphil, please complete the BZ checklist
@bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
BZ Checklist is pending from my end. Will do it today.
Reacted by Ben FitzpatrickBugZero Checklist:
- [Contributor] Classify the bug:
Bug classification
Source of bug:
- 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
- 2b. Reported on staging (deploy blocker)
- 2c. 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.
-
[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: Not Required. The existing checklist is good enough to capture such issues.
-
[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
Precondition:
Test:
- Create a new workspace
- Go to WS chat and create a new expense
- Open expense report in the step 2
- Select any expense > Move expense
- Verify that the archived report doesn't appear in the list
Do we agree 👍 or 👎
@bfitzexpensify BZ Checklist Done. Thanks.
@bfitzexpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
What's left here before we can close this issue?
Payment summary:
@rojiphil due $250 payment through NewDot Manual Requests
$250 approved for @rojiphil
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.1.49-4
Reproducible in staging?: Yes
Reproducible in production?: No
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): dhsishdsiushbishd@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.4 / Chrome
App Component: Money Requests
Action Performed:
Expected Result:
Expense report from the deleted workspace should not appear in the Report list when moving expense.
Reports from other workspaces should not appear in the Report list (production behavior).
Actual Result:
Expense report from the deleted workspace appears in the Report list when moving expense.
Workaround:
Unknown
Platforms:
Screenshots/Videos
1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @bfitzexpensify