Skip to content

Keep the default workspace first in the expense participant picker - #104453

Merged
puneetlath merged 3 commits into
mainfrom
claude-pinDefaultWorkspaceInParticipantPicker
Oct 20, 2026
Merged

puneetlath merged 3 commits into
mainfrom
claude-pinDefaultWorkspaceInParticipantPicker

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

On large accounts, the expense participant picker (Share Sheet > Submit, and FAB > Create expense) dropped a quiet default workspace from the "Workspace" list. Two recency limits apply when the search is empty, and both rank workspace chats only by recent activity:

  1. createFilteredOptionList keeps only the 500 most recently active reports.
  2. getValidOptions caps each group, including the separated workspace chats, at the page size (50).

This PR ranks the user's own expense chat in the default workspace (activePolicyID) first in both places:

  • reportSortComparator gives that chat the same top priority the self-DM already gets, so the 500-report pre-filter always keeps it.
  • getValidOptions accepts activePolicyID and ranks that chat first within the separated workspace chats, so the page cap keeps it and the picker shows it at the top.
  • ParticipantSearchResults passes activePolicyID in its getValidOptionsConfig. useSearchSelector forwards it to useFilteredOptions → createFilteredOptionList. Other pickers don't pass it, so their behavior is unchanged.

Unit tests cover both limits and confirm another member's expense chat in the same workspace is not boosted.

Fixed Issues

$ #104373
PROPOSAL: #104373 (comment)

Tests

Note: In the Onyx state, the default workspace is the workspace whose name contains DEFAULT.

Web/mWeb

  1. Import this Onyx state onyx-state-share-submit-repro-1.txt
  2. Go to FAB > Create expense > Manual
  3. Verify that the default workspace is auto-selected
  4. Click on the To section
  5. Verify that the participant picker is displayed and the default workspace is displayed as selected

Native

  1. Import this Onyx state onyx-state-share-submit-repro-1.txt
  2. Share an image to the App
  3. Verify that in the Submit tab the default workspace is displayed in the Workspaces section
  • Verify that no errors appear in the JS console

Offline tests

Same as test

QA Steps

Same as test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

AI Tests

Melvin ran these locally:

  • npm test -- tests/unit/OptionsListUtilsTest.tsx tests/unit/useSearchSelectorTest.tsx tests/unit/LhnSearchPreviewParityTest.ts tests/unit/SearchAutocompleteListTest.tsx: 569 passed, including 3 new tests.
  • npm run typecheck: passed.
  • npm run lint-changed: passed.
  • npm run fmt (oxfmt): applied before commit.
  • npm run spell-changed: no issues.
  • npm run react-compiler-compliance-check check on the changed hooks and component: passed. (check-changed couldn't resolve the base branch in this environment.)
  • Web UI test: not run. The test browser session showed a blank page before any steps could run.

Screenshots/Videos

Android: Native
Screen.Recording.2026-10-20.at.15.46.06.mov
Android: mWeb Chrome
Screen.Recording.2026-10-20.at.15.47.06.mov
iOS: Native
Screen.Recording.2026-10-20.at.15.42.34.mov
iOS: mWeb Safari
Screen.Recording.2026-10-20.at.15.47.47.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-20.at.15.48.12.mov

Rank the user's own expense chat in the default workspace with the self-DM
in the 500-report pre-filter, and first within the separated workspace chats,
so recency limits can't drop a quiet default workspace from the pick list.

Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 20, 2026 07:53
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 20, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-pinDefaultWorkspaceInParticipantPicker
git checkout -b claude-pinDefaultWorkspaceInParticipantPicker upstream/claude-pinDefaultWorkspaceInParticipantPicker
git push -u origin claude-pinDefaultWorkspaceInParticipantPicker

Then you can close this PR and open a new one from your fork.

@MelvinBot

MelvinBot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

On Android, the expense participant picker shows the default workspace first with an empty search, both before and after changing the default, and search still finds workspaces by name. The PR's Tests section is still a TODO, so these steps come from the linked issue, scaled down to 3 workspaces; the 50-workspace and 500-report limits were not reproduced on this test account.
Participant picker search filtered to WS Default

Step Status
Account signed in and at least 3 workspaces exist (WS Default, WS Busy A, WS Busy B)The Workspaces list shows WS Default (marked Default), WS Busy A, and WS Busy B.
Workspaces list showing WS Default, WS Busy A, WS Busy B
✅
WS Default is the default and stays quiet; WS Busy A and WS Busy B get recent activityThe Inbox shows WS Busy B, then WS Busy A, then the quiet WS Default chat, so both busy workspaces are more recently active than the default.
Inbox with busy workspace chats above the quiet default workspace chat
✅
Open the participant picker (FAB > Create expense > Manual > amount > Next) with an empty searchThe Choose recipient screen opened with the search field empty and focused.
✅
WS Default appears first in the picker, above the more recently active workspaces, without searchingWS Default is at the top of the list, followed by WS Busy B, then WS Busy A. Note: WS Default was also the pre-selected recipient, and the selected row sits above the Workspace header, so this screen alone doesn't separate the new ranking from selection pinning.
Participant picker with WS Default first
✅
Change the default to WS Busy B, reopen the picker with an empty search, and confirm WS Busy B is firstAfter Set as default workspace on WS Busy B, the picker showed WS Busy B first, then WS Busy A, then WS Default. WS Busy B was also the pre-selected recipient.
Participant picker with WS Busy B first after changing the default
✅
Typing a workspace name in the picker search still finds itTyping "WS Default" filtered the Workspace list to WS Default only.
Participant picker search filtered to WS Default
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

On Web, the picker's Workspace section lists the default workspace first even when other workspaces have newer activity, and the order updates when the default changes. These steps come from the linked issue (the PR's Tests section is still a TODO), scaled down to 3 workspaces, so the 50-workspace and 500-report limits were not reproduced.
Picker search for WS Default shows only WS Default

Step Status
Signed in, onboarding done, and 3 workspaces exist (WS Default, WS Busy A, WS Busy B)The Workspaces list shows all 3, with WS Default tagged Default.
Workspaces list showing WS Busy A, WS Busy B, WS Default (tagged Default)
✅
WS Default stays quiet; WS Busy A and WS Busy B get newer activityMessages sent in WS Busy A (8:17 AM) and WS Busy B (8:18 AM). The Inbox shows WS Busy B, then WS Busy A, then the quiet WS Default chat.
Inbox with WS Busy B and WS Busy A above the quiet WS Default chat
✅
Open the participant picker (FAB > Create expense > Manual > amount > recipient) with an empty searchThe Choose recipient picker opened with an empty search. WS Default, the current default, appears as a pre-selected row above the Workspace header.
Choose recipient picker with empty search; WS Default pre-selected above the Workspace header
✅
WS Default is first in the Workspace section, above more recently active workspacesTo rule out selection pinning, WS Busy A was made the selected recipient. The Workspace section then listed WS Default first and WS Busy B second, although WS Busy B had newer activity.
With WS Busy A pre-selected, Workspace section shows WS Default first, WS Busy B second
✅
Set WS Busy B as default, reopen the picker, and confirm WS Busy B is firstWS Busy B became the pre-selected row. Then WS Busy A got a newer message (8:22 AM) and WS Default was made the selected recipient. The Workspace section listed WS Busy B first and WS Busy A second, although WS Busy A had the newest activity.
WS Busy B pre-selected after being set as defaultWorkspace section shows WS Busy B first, WS Busy A second, though WS Busy A is newest
✅
Typing a workspace name in the picker search still finds itTyping "WS Default" filtered the Workspace section to WS Default only.
Picker search for WS Default shows only WS Default
✅

view run · view recording

@github-actions

Copy link
Copy Markdown
Contributor

🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

This fixed my issue!

@nkdengineer

Copy link
Copy Markdown
Contributor

@codex Review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T09:21:28.937651Z cac235b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: cac235bd9d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, fill out the Test section

Note: In the onyx state, the default WS is the WS contain DEFAULT text

  • Web/MWeb
  1. Import this Onyx state onyx-state-share-submit-repro-1.txt
  2. Go FAB > Create expense > Manual
  3. Verify that the default workspace is auto-selected
  4. Click on the To section
  5. Verify that the participant picker is displayed and the default WS is displayed as selected.
  • Native
  1. Import this Onyx state onyx-state-share-submit-repro-1.txt
  2. Share an image to the App
  3. Verify that in the submit tap the default workspace is displayed in the Workspaces section

Then update Offline tests and QA Steps to Same as test text

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the PR description:

  • Tests: added your Web/mWeb and Native steps, including the Onyx state file and the note that the default workspace's name contains DEFAULT.
  • Offline tests: set to "Same as test".
  • QA Steps: set to "Same as test", replacing the TODO lines.

I kept the "Verify that no errors appear in the JS console" checkbox in Tests and QA Steps. I didn't change any other section.


view run

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, fill the Screenshots/Videos

Screenshots/Videos

Android: Native
Screen.Recording.2026-10-20.at.15.46.06.mov
Android: mWeb Chrome
Screen.Recording.2026-10-20.at.15.47.06.mov
iOS: Native
Screen.Recording.2026-10-20.at.15.42.34.mov
iOS: mWeb Safari
Screen.Recording.2026-10-20.at.15.47.47.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-20.at.15.48.12.mov

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I added your 5 videos to the Screenshots/Videos section of the PR description, one under each platform: Android Native, Android mWeb Chrome, iOS Native, iOS mWeb Safari, and MacOS Chrome / Safari. The rest of the description is unchanged.


view run

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, Update the Author Checklist section. Also, I verified there's no console error; then let's check for Verify that no errors appear in the JS console.. After that mark the PR as ready.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

@MelvinBot
MelvinBot marked this pull request as ready for review October 20, 2026 09:17
@MelvinBot
MelvinBot requested a review from a team as a code owner October 20, 2026 09:17
@melvin-bot
melvin-bot Bot requested review from nkdengineer and removed request for a team October 20, 2026 09:17
@melvin-bot

melvin-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

@nkdengineer Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from garrettmknight and removed request for a team October 20, 2026 09:17
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done. I made these changes:

  • Replaced the PR Author Checklist with the version you provided, with all items checked.
  • Checked "Verify that no errors appear in the JS console" in both the Tests and QA Steps sections.
  • Marked the PR as ready for review.

The rest of the description is unchanged.


view run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cac235bd9d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

preferRecentExpenseReports: action === CONST.IOU.ACTION.CREATE,
isRestrictedToPreferredPolicy,
preferredPolicyID,
activePolicyID,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate the raw boost on workspace-chat inclusion

When this shared component is used for an invoice (iouType === CONST.IOU.TYPE.INVOICE) or with shouldExcludeWorkspaces, it still forwards activePolicyID, so useFilteredOptions promotes the default expense chat into the 500-report raw slice even though includeOwnedWorkspaceChats is false and isValidReport later rejects that chat. On accounts above the raw cap, the ineligible chat can therefore evict a newer eligible invoice room or report from the empty-query results until the user loads another page or searches; only enable this boost when owned workspace chats can actually be displayed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot Update this if it's valid case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid, and I fixed it in 9035aff.

For invoices and pickers with shouldExcludeWorkspaces, includeOwnedWorkspaceChats is false. Before this fix, activePolicyID was still passed, so the default workspace chat was ranked into the 500 recent reports and then filtered out, which wasted one slot. Now activePolicyID is passed only when includeOwnedWorkspaceChats is true (ParticipantSearchResults.tsx:203-226). Submit, create, split, and track pickers work the same as before.

Checks: npm run typecheck and the React Compiler check passed. The OptionsListUtilsTest and useSearchSelectorTest suites passed (390 tests). ESLint found no new errors in the changed file.


view run

Comment thread src/libs/OptionsListUtils/index.ts Outdated
};

// Rank the user's default workspace chat first among workspace chats, so the per-group limit keeps it even when it has no recent activity
const isDefaultWorkspaceChat = (report: SearchOption<Report>) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-3 (docs)

This PR introduces the same "is the current user's own expense chat in the default workspace" predicate in two places. Here in getValidOptions:

const isDefaultWorkspaceChat = (report: SearchOption<Report>) =>
    !!activePolicyID && isWorkspaceChat(report) && report.policyID === activePolicyID && report.ownerAccountID === currentUserAccountID;

and again in reportSortComparator (around line 1042):

const isDefaultWorkspaceChat =
    !!activePolicyID && report.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT && report.policyID === activePolicyID && report.ownerAccountID === currentUserAccountID;

The ownership + default-policy core (report.policyID === activePolicyID && report.ownerAccountID === currentUserAccountID) is identical in both, and both exist only to give that chat top sort priority. If the definition of "default workspace chat" ever changes (e.g. ownership rules), both copies must be kept in sync.

Consider extracting a small shared predicate, e.g.:

function isOwnDefaultWorkspaceChat(report: Pick<Report, 'policyID' | 'ownerAccountID'>, currentUserAccountID: number, activePolicyID: string | undefined): boolean {
    return !!activePolicyID && report.policyID === activePolicyID && report.ownerAccountID === currentUserAccountID;
}

and call it from both sites (combining with the respective isWorkspaceChat/chatType check), so the ownership rule lives in one place.


Reviewed at: cac235b | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot Update this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9beeb96. I added isOwnDefaultWorkspaceChat (src/libs/OptionsListUtils/index.ts:1033-1036). It holds the default workspace and ownership check in one place. reportSortComparator and getValidOptions now both call it, each with its own workspace chat check. Behavior is unchanged.

Checks: npm run typecheck passed, and the OptionsListUtilsTest and useSearchSelectorTest suites passed (390 tests). ESLint reports no errors on the changed lines.


view run

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done, and no new changes were needed. The PR head is 9beeb96. The shared check lives in isOwnDefaultWorkspaceChat at src/libs/OptionsListUtils/index.ts:1034. Both places now call it:

I didn't act on your request about the Codex invoice comment in this run.


view run

@nkdengineer

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-10-20.at.15.46.06.mov
Android: mWeb Chrome
Screen.Recording.2026-10-20.at.15.47.06.mov
iOS: HybridApp
Screen.Recording.2026-10-20.at.15.42.34.mov
iOS: mWeb Safari
Screen.Recording.2026-10-20.at.15.47.47.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-20.at.15.48.12.mov

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that this resolved my issue.

Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 20, 2026 09:35
@melvin-bot
melvin-bot Bot requested review from puneetlath and removed request for a team October 20, 2026 09:36
@melvin-bot

melvin-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

@puneetlath Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/hooks/useFilteredOptions.ts 86.66% <100.00%> (ø)
src/hooks/useSearchSelector/base.ts 87.09% <100.00%> (+0.10%) ⬆️
src/libs/OptionsListUtils/index.ts 91.87% <100.00%> (+0.05%) ⬆️
src/pages/iou/request/ParticipantSearchResults.tsx 0.60% <0.00%> (-0.01%) ⬇️
... and 9 files with indirect coverage changes

@nkdengineer nkdengineer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@puneetlath
puneetlath merged commit 08013f1 into main Oct 20, 2026
44 of 46 checks passed
@puneetlath
puneetlath deleted the claude-pinDefaultWorkspaceInParticipantPicker branch October 20, 2026 17:22
@github-actions

Copy link
Copy Markdown
Contributor

🚧 puneetlath has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.5.15-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This bug fix makes the default workspace show up first in the expense participant picker, which is what users already expect, and no article under docs/articles describes the picker's workspace order.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.5.15-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants