Skip to content

feat(mobile): search the whole workspace from Files - #48863

Merged
AmoabaKelvin merged 4 commits into
mainfrom
mobile-files-workspace-search
Nov 27, 2026
Merged

AmoabaKelvin merged 4 commits into
mainfrom
mobile-files-workspace-search

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

The search bar in the phone's Files screen now finds any file in the workspace, not just files in folders you already opened. Results show the file name with its folder underneath. File rows are now the same size as other lists in the app, show a visible press in light mode, and long names keep their endings, so foo.test.ts no longer looks like foo.ts.

Files Added Deleted Net
Test 0 0 0 0
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​356 $\color{#cf222e}{\Huge{\mathbf{−}}}$​387 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31

What Changed

Before:

  • Typing filtered only the folders you had already expanded. The empty state said so: "Only folders you have opened are searched." A part-loaded folder added a "Searched 200 of 3,412 · Search all" row.
  • Rows were 44 pt tall with 14 pt names. The press colour (bgRaised) was invisible on white.
  • Long names were cut at the end, and a file the phone can't open had a second line, "Unavailable on mobile".

After:

  • Search: typing asks the computer for matching paths with files.searchPaths, the same search chat @ uses. Older hosts fall back to files.list. A result row shows the name, the folder under it (cut from the start so the end stays visible) and the git letter at the end. Tapping a file opens it; tapping a folder clears the search and opens that folder in the tree. While the next answer is on its way, the previous results stay up as long as the new text narrows them. "No matches" offers Clear search. The bar now says "Search files".
  • SSH and offline: the host's search sees no SSH workspace and can't answer offline. Matches from folders already listed are added after the host's results, so those cases still find what you opened.
  • Rows: tree and result rows use the list row's measures: 48 pt (60 with a folder line), 15 pt names, an 18 pt icon in a 24 pt slot, 16 pt side insets, and the translucentFill press. Unpreviewable files dim to the shared disabled opacity instead of adding a second line. A folder's inline error offers Retry as a 44 pt text action.
  • Long names are cut in the middle, so the extension and a few letters before it stay visible.

How it works: useMobileNativeChatFileSearch gains an optional limit (the host allows up to 32) and maxAgeMs. It also reports which query its paths answer, for its own client and workspace only. A failed search answers with nothing instead of hanging, and a connection cutover asks again. Chat @ passes neither option and behaves as before. The opened-folders filter (filterDirectoryCache), the "searched" paging row and Search all are removed.

Matches existing screens:

  • Rows copy ListRow (components/list/ListGroup.tsx:330-364).
  • The folder line uses TailClippedText, as the session tabs sheet does.
  • Search keeps the existing BottomSearchBar and MobileNoMatchState.

Why

Finding a file by name is the main job of a phone file browser, and the old filter couldn't find anything in a folder you hadn't opened. The computer already serves workspace-wide path search for chat @, so Files uses it too.

Changes from the mock:

  • Results are full-width rows like the tree around them, not a rounded group with a "6 files" header. The host caps results at 32, so a count would read as a total when it is only the top matches.

Linked Issue

None; part of the phone UX review round.

Visual Proof

The real Files panel in Chromium at 393 × 852, against a fake host with the same files in every frame. Each image is before | after.

Searching "reducer" (before: "No matches", because src wasn't opened)
search-dark.png
search-light.png

Tree with folders open (48 pt rows, a long name kept apart by its ending)
tree-dark.png
tree-light.png

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

In the Chromium harness, with a fake host answering files.readDir, files.searchPaths and git.status, I checked in dark and light: the closed tree, an open tree with long names, a search with matches across unopened folders, a search with long names, no matches, and a search over opened folders. pnpm check:changed and the mobile typecheck pass. No tests were added because this is UI behaviour.

Performance

None that matters. A search is one debounced files.searchPaths call per query, asking for at most 32 paths; the host keeps its file list cached for 30 s, and the phone reuses an answer for the same 30 s. The listed-folder matches walk only folders already in the phone's cache, capped at 32. Typing on an older host that lacks files.readDir sends no request, because its root read already holds the whole list. The page bundle's eager code shrinks by 1.2 KB (11,481,634 → 11,480,461 of 11,534,336).

Risk

Level: Low

This affects the phone's Files screen and adds two optional options to the search hook chat uses. The riskiest part is search on hosts that answer files.searchPaths slowly. The previous results or "Searching…" show until the answer arrives, and the folders you opened still match locally. A plain revert backs it out.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

No host or RPC changes. Older hosts without files.searchPaths use files.list, as chat @ already does. On SSH workspaces the host's search returns nothing, so results come only from folders you have opened (as before). Follow-up: tapping a folder result whose parent folder is only partly loaded (more than 500 entries) clears the search but can't show the folder until its parent's next page loads.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mobile file explorer combines native file-search results with matches from loaded directory entries. The panel configures searches to return up to 32 results and use a 30-second maximum cache age. The “Search all” paging flow and its row actions are removed. Search results display their parent folder, and file names use updated truncation. Search labels and related translations are updated or removed.

Merge Risk: Low · up to 8f150

File search now covers the whole workspace and falls back to listed folders. Search results that share a filename in different folders have the same screen-reader label, because the parent folder is shown visually but not announced. This is a small accessibility gap that can be fixed in a follow-up, and no performance regression or functional defect was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(mobile): search the whole workspace from Files" matches the main change: the mobile Files search bar now queries the host's workspace-wide path search (files.searchPaths) instead of fi…
Description check Passed The description follows the repository template closely: ELI5, What Changed (before/after and mechanism), Why, Linked Issue, Visual Proof with before/after images, Testing, Performance, Risk with leve…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(mobile): search the whole workspace from Files" matches the main change: the mobile Files search bar now queries the host's workspace-wide path search (files.searchPaths) instead of filtering only opened folders. It is specific and uses conventional commit form, so a teammate scanning history would understand the primary change.

Full details: Description check

Explanation

The description follows the repository template closely: ELI5, What Changed (before/after and mechanism), Why, Linked Issue, Visual Proof with before/after images, Testing, Performance, Risk with level, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist are all present. The Linked Issue section says 'None; part of the phone UX review round.' and the template says there should always be one for outside contributors, so that is a gap if the author is an outside contributor. The AI Disclosure and Review sections are empty headers. The Risk section names the riskiest part and a revert path. Overall the description is mostly complete.

Resolution

Confirm whether the author is an outside contributor. If so, link a real issue in the Linked Issue section. Fill in the empty AI Disclosure and Review sections, or confirm they do not apply.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f2c60f0d-89ba-44aa-a86e-ee1eff16f7fa
Commits

Reviewing files that changed from the base of the PR and between 3e107a6 and 8f150f9.

Files selected for processing: 11

  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 11

  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Include the folder in search-result accessibility labels. · mobile-file-explorer-row.tsx:248-255

mobile/src/files/explorer/mobile-file-explorer-row.tsx:248-255
Minor · Functional Correctness · Quick win

Include the folder in search-result accessibility labels.

src/cart/reducer.ts and src/lib/reducer.ts both receive “Preview file reducer.ts.” The explicit accessibilityLabel overrides the folder text rendered inside the row. Screen-reader users cannot distinguish these workspace matches. React Native documents this override behavior. (reactnative.dev)

For search results, include item.relativePath or a localized name-and-folder label. Keep the existing basename labels for ordinary tree rows.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2b61f9c-d05b-49d5-8738-9f4196fcd7b9
Commits

Reviewing files that changed from the base of the PR and between c1ba91e and 3e107a6.

Files selected for processing: 18

  • mobile/src/files/explorer/MobileFileExplorerPanel.tsx
  • mobile/src/files/explorer/file-tree.ts
  • mobile/src/files/explorer/mobile-file-explorer-row.tsx
  • mobile/src/files/explorer/mobile-file-explorer-rows.tsx
  • mobile/src/files/explorer/mobile-file-explorer-styles.ts
  • mobile/src/files/explorer/use-mobile-file-explorer-paging.ts
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • mobile/src/session/native-chat/composer/attachments/use-mobile-native-chat-file-search.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Typing in the Files search bar now asks the computer for matching paths
(files.searchPaths, the same search chat @-mentions use) instead of
filtering only the folders already opened. Rows take the list row's
measures, a press that shows in light mode, and long names keep their
endings.
@AmoabaKelvin
AmoabaKelvin force-pushed the mobile-files-workspace-search branch from 3e107a6 to 8f150f9 Compare November 27, 2026 08:33
@AmoabaKelvin
AmoabaKelvin merged commit 9a8c7a0 into main Nov 27, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant