Skip to content

[Due for payment 2026-10-28] Create report workspace selector ignores domain restrictions and misfires on the FAB #101560

Closed

Description

@MelvinBot

Problem

The "Create report" workspace selector does not follow the intended product logic. While testing ReportActionAvatars — WorkspaceAvatar + policyID migration it became clear that nobody could reproduce the documented test steps, and digging into the code turned up three real gaps between the intended behaviour and what ships today.

The intended behaviour was spelled out by trjExpensify in this comment:

  • If your default workspace is set to the personal workspace (i.e. via Classic or having no group workspaces):
    • If you are a member of no group workspaces, prompt to upgrade.
    • If you are a member of one group type workspace, create the report on that. (We largely ignore the personal workspace in NewDot)
    • If you are a member of more than one group type workspace, show the workspace selector first to choose which one to create the report on.
  • Your default group workspace is billing restricted, but not domain restricted:
    • If you are a member of one group workspace, show the billing restriction modal.
    • If you are a member of more than one group workspace, show the workspace selector first.
      • If you pick a billing restricted workspace, show the billing restriction modal.
      • If you pick a non-billing restricted workspace, allow creating the report on that.
  • Your default group workspace is domain restricted, but not billing restricted:
    • Don't show the selector, regardless of how many workspaces you are a member of.
  • Your default group workspace is billing restricted and domain restricted:
    • Don't show the selector, regardless of how many workspaces you are a member of.
    • Show the billing restriction modal.

The first two bullets match the code. The remaining three do not.

What's wrong

1. Domain restrictions are ignored entirely.

src/hooks/useCreateReport.tsx:111-129 branches only on "is the default personal" and "is the default billing restricted". It never looks at the domain securityGroup's preferred-workspace restriction. A domain-restricted user gets the same behaviour as an unrestricted one: the selector still opens in the same situations. src/pages/DynamicNewReportWorkspaceSelectionPage.tsx:236 then lists every eligible workspace they belong to, with no preferred-workspace filtering.

2. Billing + domain restricted shows the selector instead of the billing modal.

Same branch at useCreateReport.tsx:122: when the default is billing restricted and the user belongs to more than one workspace, the selector wins. ROUTES.RESTRICTED_ACTION is only reached at useCreateReport.tsx:141, which requires exactly one eligible workspace.

3. FAB shows the selector when the default is the 3rd+ eligible workspace.

src/pages/inbox/sidebar/FABPopoverContent/menuItems/CreateReportMenuItem.tsx:34-36 truncates the eligible-policy list with .slice(0, 2). If the default workspace isn't in that first slice, getDefaultChatEnabledPolicy can't find it, returns undefined, and the !workspaceIDForReportCreation guard opens the selector instead of creating the report directly on the default.

This is FAB-only. The Search router (useCreateNavigationSuggestions.ts:111) and the Reports empty view (EmptySearchView.tsx:90) pass the unsliced list and behave correctly. It's also what made the original PR's test steps unreproducible — m-natarajan confirmed the selector appeared only when the default was the 3rd workspace in the list.

Expected

Align all three with the spec above:

  1. Respect the domain securityGroup preferred-workspace restriction — skip the selector for domain-restricted users regardless of workspace count.
  2. When the default is both billing and domain restricted, show the billing restriction modal instead of the selector.
  3. Drop the .slice(0, 2) truncation on the FAB (or resolve the default before truncating) so a default that happens to be 3rd+ in the list creates the report directly.

Actual

  1. Domain restrictions have no effect on the flow.
  2. Billing + domain restricted users with 2+ workspaces get the selector.
  3. FAB opens the selector when the default is the 3rd+ eligible workspace.

Follow-up to ReportActionAvatars — WorkspaceAvatar + policyID migration, specifically this comment. That PR was a pure avatar refactor and did not change any of this flow.

Issue OwnerCurrent Issue Owner: @huult

Activity

  1. added
    Reviewing
    Weekly
    and removed
    Daily
    on Sep 18, 2026
  2. jponikarchuk commented on Sep 24, 2026

    @jponikarchuk

    Deploy Blocker #102130 was identified to be related to the PR #101430 that attempted to fix this issue.

  3. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  4. added
    Daily
    and removed
    Reviewing
    Weekly
    on Sep 24, 2026
  5. changed the title [-]Create report workspace selector ignores domain restrictions and misfires on the FAB[/-] [+][Due for payment 2026-10-01] Create report workspace selector ignores domain restrictions and misfires on the FAB[/+] on Sep 24, 2026
  6. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @sobitneupane

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.92-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-10-01. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  7. 54 remaining items

  8. sobitneupane commented on Oct 30, 2026

    @sobitneupane
    Contributor

    are you due payment? It doesn't look like you reviewed the final PR, just the one that was reverted.

    You are right. I only reviewed the PR that was reverted. so, I guess no payment.

  9. trjExpensify commented on Oct 30, 2026

    @trjExpensify
    Contributor

    @jmusial IIRC from Classic, we allow moving expenses and reports to other workspaces with this setting enabled. So I think those are intentional.

  10. jmusial commented on Nov 2, 2026

    @jmusial
    Contributor

    @trjExpensify makes sense, thanks. Then let's drop 3.

    That leaves

    • Backend: items 1 and 2 (enforce preferred workspace as activePolicyID, push security group changes to members). - I don't have access to we'll need someone internal to create issues.
    • Frontend: item 4 (one default-workspace rule, which touches about 20 flows and needs its own PR and QA pass). - This is a code-quality refactor with small behaviour fixes for edge cases. Should I do it as a part of this issue ?
  11. trjExpensify commented on Nov 2, 2026

    @trjExpensify
    Contributor

    Backend: items 1 and 2 (enforce preferred workspace as activePolicyID, push security group changes to members). - I don't have access to we'll need someone internal to create issues.

    @mountiny @rayane-d would be good people to look into this.

    Frontend: item 4 (one default-workspace rule, which touches about 20 flows and needs its own PR and QA pass). - This is a code-quality refactor with small behaviour fixes for edge cases. Should I do it as a part of this issue ?

    Feel free to spin out a new issue for it. 👍

  12. huult commented on Nov 3, 2026

    @huult
    Contributor

    66. > Backend: items 1 and 2 (enforce preferred workspace as activePolicyID, push security group changes to members). - I don't have access to we'll need someone internal to create issues.

     [@mountiny](https://github.com/mountiny) [@rayane-d](https://github.com/rayane-d) would be good people to look into this.
     > Frontend: item 4 (one default-workspace rule, which touches about 20 flows and needs its own PR and QA pass). - This is a code-quality refactor with small behaviour fixes for edge cases. Should I do it as a part of this issue ?
     
     
     Feel free to spin out a new issue for it. 👍
    

    @MelvinBot Please create a new issue for item 4 (consolidating the default-workspace rule across the ~20 affected flows) and assign it to me, @jmusial. Thanks!

  13. MelvinBot commented on Nov 3, 2026

    @MelvinBot
    ContributorAuthor

    I created Consolidate the default-workspace eligibility rule across report and expense flows for item 4. It has the Task and Weekly labels.

    I assigned both jmusial and huult, because "assign it to me, @jmusial" could mean either person. Remove whichever assignee you don't need.

    The issue lists the three checks that disagree (canCreateReportOnPolicy, the check inside useDefaultExpensePolicy, and isPolicyValidForMovingExpenses), with permalinks. I found no existing issue that covers this work.

  14. huult commented on Nov 3, 2026

    @huult
    Contributor

    Backend: items 1 and 2 (enforce preferred workspace as activePolicyID, push security group changes to members). - I don't have access to we'll need someone internal to create issues.

    @mountiny @rayane-d would be good people to look into this.

    @MelvinBot Could you please create a Backend issue for items 1 and 2 and assign it to @mountiny and @rayane-d? Thanks!

  15. MelvinBot commented on Nov 3, 2026

    @MelvinBot
    ContributorAuthor

    I created an internal issue for backend items 1 and 2 and assigned it to mountiny and rayane-d. It covers:

    1. Making the domain preferred workspace the member's default (activePolicyID) as soon as the admin sets or changes it, or a member joins the group.
    2. Pushing security group changes to group members.

    The issue is in a private repo, so I can't link it here. mountiny and rayane-d can find it in their assigned issues. I found no existing issue covering this work.

  16. huult commented on Nov 3, 2026

    @huult
    Contributor

    Alright, I've created two separate tickets for Backend and App so the teams can continue working on them. This ticket is now resolved, so I'll close it. cc @trjExpensify

  17. JmillsExpensify commented on Nov 14, 2026

    @JmillsExpensify
    Contributor

    $175 approved for @huult

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

Metadata

Metadata

Labels

Awaiting PaymentDailyTask

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions