Skip to content

Expense - Error shows up after creating expense to approve-only workspace from self DM #104945

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): jowienwonjsdj3@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 B has a workspace and make it default workspace.
  • User A creates a Control 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. Delete the default workspace.
  3. Go to self DM.
  4. Create an expense.
  5. Click Submit to my employer.
  6. Enter merchant and click Create expense.

Expected Result:

Approve-only member should not be able to create expense in the workspace chat via Submit to my employer flow.

Actual Result:

Approve-only member is able to create expense in the workspace chat via Submit to my employer flow.
Error shows up in the self DM after creating expense via Submit to my employer flow.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7294782_1792860571419.018.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7294782

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 26, 2026
  2. melvin-bot commented on Oct 26, 2026

    @melvin-bot

    @flodnv recently merged #102933, but they are OOO right now, so I'll auto-assign someone else.

  3. applause-bot commented on Oct 26, 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/e132500d9b0d67a8f9cfb86cf0f14cf0b7c82d2ebce30624e845b1fa030a8927

  4. melvin-bot commented on Oct 26, 2026

    @melvin-bot

    Triggered auto assignment to @inimaga (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  5. melvin-bot commented on Oct 26, 2026

    @melvin-bot

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

  6. github-actions commented on Oct 26, 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.
  7. melvin-bot commented on Oct 26, 2026

    @melvin-bot

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

  8. melvin-bot commented on Oct 26, 2026

    @melvin-bot

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

  9. MelvinBot commented on Oct 26, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR (high confidence): [Payment due @Pujan92] Add approve-only workspace role (Expensify/App#102933)

    Root cause: The "Submit to my employer" flow counts workspaces with createFilteredPoliciesInfoSelector. That selector never checks canCreateExpensesOnPolicy. After the user deletes their default workspace, the approve-only workspace is the only one counted. The single-workspace shortcut in StartExpenseFlows.ts:409-426 then skips the picker and submits straight to that workspace. The backend correctly rejects the request, and the error appears in the self DM.

    Recommended fix (App only, fix forward): In src/selectors/Policy.ts:427, also skip policies where canCreateExpensesOnPolicy(policy, email) is false. With only an approve-only workspace, the count becomes 0 and the flow uses the existing "create a new Submit workspace" path. Add a unit test for that case. If a fix can't land quickly, revert #102933.

    Investigation details
    • Why this PR: It introduced the approve-only role and added the create-expense check to the workspace picker (ParticipantSearchResults → OptionsListUtils), but not to this selector. With two or more workspaces the picker is shown and correctly hides the approve-only workspace, so the bug only appears when that workspace is the only one counted, which is what step 2 of the repro sets up. No other PR on the current checklist changes this selector or the employer branch.
    • Same bug at other entry points: The selector also drives "Submit to my employer" from ReportDetailsMenuTrackExpenseItems.tsx:65 and MoneyRequestHeaderSecondaryActions.tsx:198, besides ChatActionableButtons.tsx:200. One selector fix covers all three.
    • Optional: getActivePoliciesWithExpenseChat (src/libs/PolicyUtils/policy.ts) and createHasWorkspaceToSubmitToSelector (src/selectors/Policy.ts) also lack the check. They control whether Submit options appear for split expenses.
    • Why the error lands in the self DM: submitTrackedExpenseToPolicy sends AddTrackedExpenseToPolicy and shows the expense optimistically in the workspace chat. When the backend rejects it, the failure data puts iou.error.genericCreateFailureMessage on the tracked-expense action in the self DM.
    • Why not revert first: The fix is a one-line condition. Reverting a ~50-file feature that ships with a backend change carries more risk. No bad data is written, because the backend blocks the request.

    Next Steps: ShridharGoel (PR author) can fix forward with the change above. Reply with @MelvinBot <your feedback> to refine this analysis.


    view run

  10. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Oct 26, 2026
  11. m-natarajan commented on Oct 26, 2026

    @m-natarajan

    Not Reproducible
    Unable to reproduce - Approve-only no longer available
    iPhone 14 / iOS 26.6.2
    Version 9.5.20-4

    IMG_0009.2.MP4
  12. melvin-bot commented on Oct 29, 2026

    @melvin-bot

    @ShridharGoel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

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