Skip to content

Expense - Error shows up when approve-only member creates per diem expense #104917

Open

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.20-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #102933
Email or phone of affected tester (no customers): jsnoidjosinjdiosj2@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • User A creates a Control workspace and imports per diem rates to the workspace.
  • User B creates a workspace and imports per diem rates to the workspace.
  • User A invites User B to workspace with approve-only role.
  • Perform the steps below as User B:
  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense > Per diem.
  3. Select workspace with approve-only role.
  4. Create a per diem expense in that workspace.

Expected Result:

In Step 3, approve-only member should not be able to choose the workspace when creating per diem expense.

Actual Result:

In Step 3, approve-only member is able to choose the workspace when creating per diem expense.
In Step 4, error shows up after creating per diem expense in the workspace.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7294670_1792779756948.16.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7294670

Issue OwnerCurrent Issue Owner: @ShridharGoel

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 23, 2026
  2. applause-bot commented on Oct 23, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/aef31f78cfb7445f8b56ddf2a66020966e9fa655c42181e8bff9d57eb5c082d3

  3. melvin-bot commented on Oct 23, 2026

    @melvin-bot

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

  4. melvin-bot commented on Oct 23, 2026

    @melvin-bot

    @flodnv @Pujan92 you have been assigned to this deploy blocker because you reviewed the offending PR: #102933

  5. melvin-bot commented on Oct 23, 2026

    @melvin-bot

    @ShridharGoel you have been assigned to this deploy blocker because you authored the offending PR: #102933

  6. melvin-bot commented on Oct 23, 2026

    @melvin-bot

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

  7. github-actions commented on Oct 23, 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.
  8. MelvinBot commented on Oct 23, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Investigation

    Causing PR: [Payment due @Pujan92] Add approve-only workspace role (high confidence). This is a frontend bug.

    Recommendation: roll forward with a one-line fix. Revert only if the fix can't land quickly. The feature isn't in production yet.

    Root cause: The PR added canCreateExpensesOnPolicy and applied it to most expense flows. It missed getActivePoliciesWithExpenseChat (policy.ts:70-81). That function accepts any role, including approve-only. It feeds the per diem workspace picker, so approve-only workspaces show up in the list. The server then rejects the expense on submit, which causes the error in step 4.

    Fix: Add canCreateExpensesOnPolicy(policy, currentUserLogin) && to the filter in getActivePoliciesWithExpenseChat. The import already exists at policy.ts:24. Add a unit test in tests/unit/PolicyUtilsTest.ts that excludes an approve-only workspace with per diem enabled.

    Investigation details

    Code path

    1. getActivePoliciesWithExpenseChatAndPerDiemEnabled is just the unfiltered helper plus isPerDiemEligiblePolicy.
    2. IOURequestStepPerDiemWorkspace.tsx:126 passes it to BaseRequestStepWorkspace, which renders the list with no extra filtering.
    3. selectors/Policy.ts:383-391 uses the same helper to count per diem workspaces. IOURequestStartPage uses those counts to show the Per diem tab and to auto-select a single workspace.
    4. In permissions.ts:325, the approve-only role has no create-expense permission.

    Flows the PR did update with canCreateExpensesOnPolicy

    • Participant picker (excludeWorkspacesWithoutCreateExpensePermission)
    • Default workspace (useDefaultExpensePolicy, SetDefaultWorkspacePage)
    • Moving expenses and reports (usePolicyForMovingExpenses, IOURequestEditReportCommon)
    • Report creation (canCreateReportOnPolicy at policy.ts:298)
    • canAddTransaction, canRequestMoney, and the attachment picker menu

    Why fix at this level: The same change also fixes the time-tracking picker (getActivePoliciesWithExpenseChatAndTimeEnabled), the start-page counts, and createHasWorkspaceToSubmitToSelector. It also matches the function name, because the PR stops creating workspace chats for approve-only members.

    Why not revert: The PR touches about 50 files, and the fix is small and contained.

    Not verified: I didn't see the exact error text from step 4. The conclusion doesn't depend on it.


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


    view run

  9. added and removed
    ReviewingHas a PR in review
    DeployBlockerCashThis issue or pull request should block deployment
    on Oct 26, 2026
  10. m-natarajan commented on Oct 26, 2026

    @m-natarajan

    Feature reverted, Not repro ("Approve-only" role option is no longer available in Workspace Settings > Members.)

    Mac 26.6/ Chrome, Version: 9.5.20-5

    Grabando.177.1.mp4
  11. melvin-bot commented on Oct 29, 2026

    @melvin-bot

    @ShridharGoel Whoops! This issue is 2 days overdue. Let's get this updated quick!

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.DailyKSv2EngineeringOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions