Skip to content

Per diem - Report from workspace with disabled per diem is not filtered out in report list #82881

Closed

Description

@mitarachim

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.3.22-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #81942
Email or phone of affected tester (no customers): sdiojsnidojodjnosjios@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create two workspaces - A and B.
  • Workspace A has per diem rates.
  • Do not enable per diem in workspace B.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat A.
  3. Create two empty reports.
  4. Go to workspace chat B.
  5. Create an empty report.
  6. Open FAB > Create expense > Per diem.
  7. Select any data and proceed to confirm page.
  8. On confirm page, click Report field.
  9. Select report from workspace B.

Expected Result:

Report from workspace B should not appear in Report list because workspace B has disabled per diem feature.

Actual Result:

Report from workspace B appears in Report list when workspace B has disabled per diem feature.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7081943_1771461650924.4.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 19, 2026
  2. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #81942

  3. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    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.

  5. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Feb 19, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When creating a per diem expense via global create (FAB), the report picker on the confirmation page shows reports from all workspaces — including those that have per diem disabled. Reports from workspaces without per diem enabled should not appear in the list.

    What is the root cause of that problem?

    PR #81942 changed IOURequestStepReport.tsx:265 so that for per diem transactions created via global create, selectedPolicyID is set to undefined instead of the originating policy ID:

    selectedPolicyID = isFromGlobalCreate ? undefined : perDiemOriginalPolicy?.id;
    

    When selectedPolicyID is undefined, useOutstandingReports (at src/hooks/useOutstandingReports.ts:24-34) iterates over all user policies and returns reports from every workspace. There is no per-diem-specific filtering anywhere in this chain — neither in useOutstandingReports nor in the reportOptions construction in IOURequestEditReportCommon.tsx.

    The only per-diem check that exists is validatePerDiemMove (IOURequestEditReportCommon.tsx:189-204), but this is a reactive check — it fires after the user selects a report and shows a warning modal. It does not filter the report list itself.

    What changes do you think we should make in order to solve the problem?

    In IOURequestEditReportCommon.tsx, add a filter to the reportOptions useMemo (around line 124) that, when isPerDiemRequest is true, excludes reports whose policy does not have per diem enabled. The component already receives isPerDiemRequest as a prop and has access to allPolicies.

    The filter should check arePerDiemRatesEnabled on each report's policy. The existing utility canSubmitPerDiemExpenseFromWorkspace from PolicyUtils.ts (line 1141) could be reused here — it already checks that the policy has expense chat enabled, a per diem custom unit exists, and the custom unit is enabled.

    This way, even when selectedPolicyID is undefined (allowing cross-workspace report selection for global create, as intended by PR #81942), the list only shows reports from workspaces that actually support per diem.

    What alternative solutions did you explore? (Optional)

    An alternative is to add the filtering inside useOutstandingReports by passing an isPerDiemRequest parameter and skipping policies without arePerDiemRatesEnabled when iterating all policies. However, filtering in reportOptions within IOURequestEditReportCommon is more targeted and avoids changing the generic hook's interface.

    Detailed Investigation

    Root Cause Analysis

    The data flow is:

    1. User initiates per diem expense from global create (FAB) → transaction.isFromGlobalCreate = true
    2. IOURequestStepReport.tsx:265 sets selectedPolicyID = undefined (changed by PR fix: report from the other workspace doesn't appear in the report field #81942)
    3. useOutstandingReports.ts:24-34 — when selectedPolicyID is undefined, iterates ALL user policies and aggregates reports from every workspace
    4. IOURequestEditReportCommon.tsx:119-153 — reportOptions filters only for search text and canAddTransaction, with no per-diem check
    5. User sees reports from workspaces without per diem enabled

    Evidence Chain

    • IOURequestStepReport.tsx:265: selectedPolicyID = isFromGlobalCreate ? undefined : perDiemOriginalPolicy?.id — the one-line change from PR fix: report from the other workspace doesn't appear in the report field #81942
    • useOutstandingReports.ts:24-34: loops all policies when selectedPolicyID is undefined, no per-diem check
    • IOURequestEditReportCommon.tsx:119-153: reportOptions has no arePerDiemRatesEnabled filter
    • IOURequestEditReportCommon.tsx:189-204: validatePerDiemMove is post-selection only (shows modal), not a list filter
    • PolicyUtils.ts:118-120: getActivePoliciesWithExpenseChatAndPerDiemEnabled exists but is only used in IOURequestStartPage, not the report picker
    • PolicyUtils.ts:1141-1144: canSubmitPerDiemExpenseFromWorkspace exists but is only used in usePolicyForMovingExpenses, not the report picker

    Relevant Code

    • src/pages/iou/request/step/IOURequestStepReport.tsx:263-268 — selectedPolicyID computation
    • src/hooks/useOutstandingReports.ts:24-37 — report aggregation logic
    • src/pages/iou/request/step/IOURequestEditReportCommon.tsx:119-153 — reportOptions filtering (missing per-diem filter)
    • src/pages/iou/request/step/IOURequestEditReportCommon.tsx:159-204 — per-diem validation (post-selection only)
    • src/libs/PolicyUtils.ts:1141-1144 — canSubmitPerDiemExpenseFromWorkspace (reusable utility)

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  7. izarutskaya commented on Feb 19, 2026

    @izarutskaya

    Issue is not reproducible
    Build 9.3.22-2
    Windows 11 / Chrome

    Screen.Recording.2026-02-19.at.14.20.34.mp4
    Recording.3647.mp4

    Not Repro on iPhone 12/iOS 26.3/App/Build v9.3.22-2

    ee.mp4

    Not Repro on Samsung Galaxy A40/Android 11/App/Build v9.3.22-2

    mobizen_20260219_150336.mp4
  8. MarioExpensify commented on Feb 19, 2026

    @MarioExpensify
    Contributor

    Thank you @izarutskaya. Closing this one - will be fixed in the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions