Skip to content

fix(file-explorer): search folder workspace roots#6170

Closed
bennewell35 wants to merge 1 commit into
stablyai:mainfrom
bennewell35:ben/fix-file-explorer-monorepo-search
Closed

fix(file-explorer): search folder workspace roots#6170
bennewell35 wants to merge 1 commit into
stablyai:mainfrom
bennewell35:ben/fix-file-explorer-monorepo-search

Conversation

@bennewell35

@bennewell35 bennewell35 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolve Quick Open file-list targets through known worktrees so folder workspaces can provide their root path even when they are not in worktreesByRepo.
  • Recompute folder workspace connectionId from subscribed store state so hydration does not leave SSH folder roots stale.
  • Add a hook-level regression for repo-less folder workspaces plus the existing helper coverage.

Fixes #5939.

Screenshots

N/A - no visual UI change. This affects Quick Open file-list loading for folder workspace roots.

Testing Checklist

  • Focused Quick Open folder workspace regression tests.
  • Nearby File Explorer projection and component tests.
  • Targeted lint for touched TypeScript files.
  • Full TypeScript typecheck.
  • Diff whitespace check.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/quick-open-file-list.test.ts src/renderer/src/components/quick-open-file-list.react.test.tsx src/renderer/src/lib/connection-context.test.ts src/renderer/src/lib/worktree-runtime-owner.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/useFileExplorerVisibleRowProjection.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts --environment happy-dom src/renderer/src/components/right-sidebar/FileExplorer.test.tsx
  • pnpm exec oxlint src/renderer/src/components/quick-open-file-list.ts src/renderer/src/components/quick-open-file-list.test.ts src/renderer/src/components/quick-open-file-list.react.test.tsx src/renderer/src/lib/connection-context.ts
  • pnpm run typecheck
  • git diff --check origin/main..HEAD

Review Report

  • CodeRabbit reported no actionable review comments.
  • GitHub review threads are empty as of this update.
  • Copilot review did not run because the requesting user hit quota.

Security Audit

  • No auth, permissions, secrets, payments, uploads, or external vendor configuration changed.
  • The change passes an existing workspace root and resolved connection id through the existing runtime file-list path.
  • Focused diff scan found no new secret, token, eval, HTML injection, process-spawn, or network-call patterns.

Copilot AI review requested due to automatic review settings June 23, 2026 12:48

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

getConnectionId in connection-context.ts is refactored to delegate its store-read and folder-workspace resolution logic to a new exported getConnectionIdFromState helper that accepts a typed AppState subset directly.

quick-open-file-list.ts gains an exported RuntimeFileListTarget type and getRuntimeFileListTarget function, which resolves worktreePath, determines canList, and returns a stable excludeRequest. useRuntimeFileListForWorktree is updated to use useAppStore with getKnownWorktreeById, getConnectionIdFromState, and getRuntimeFileListTarget, with the effect's early-exit condition and dependency array expanded to include target.canList.

Tests are added: a unit test for getRuntimeFileListTarget on a folder workspace worktree, and a React hook integration test asserting that listRuntimeFiles is not called until folder workspace metadata is hydrated in the Zustand store.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(file-explorer): search folder workspace roots' directly relates to the main objective of enabling file search in folder workspace roots, particularly for monorepo parent directories.
Linked Issues check ✅ Passed The PR changes properly address issue #5939 by enabling folder workspaces to resolve file-list targets through known worktrees and maintaining correct connection IDs, allowing file search to work in monorepo parent directories.
Out of Scope Changes check ✅ Passed All changes are focused on resolving the file-list target issue for folder workspaces through worktree resolution and connection ID recomputation, with no unrelated modifications detected.
Description check ✅ Passed The PR description comprehensively covers all required template sections with detailed context about changes, testing methodology, and security considerations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands.

nwparker added a commit that referenced this pull request Jun 29, 2026
The file-explorer name search returned zero results whenever the
workspace root was a monorepo parent opened as a FolderWorkspace.
useRuntimeFileListForWorktree resolved its worktree via useWorktreeById,
which only reads worktreesByRepo, so a folder-workspace key resolved to
null and the effect early-returned with setFiles([]).

Resolve the Quick Open file-list target through getKnownWorktreeById so
folder workspaces supply their root path (folderPath) even when absent
from worktreesByRepo, and recompute connectionId from subscribed store
state via getConnectionIdFromState so SSH folder roots are not left
stale after hydration.

Supersedes community PR #6170; adds a dedicated getConnectionIdFromState
unit test that asserts resolution from a passed-in state snapshot.

Fixes #5939

Co-authored-by: bennewell35 <142949922+bennewell35@users.noreply.github.com>
nwparker added a commit that referenced this pull request Jun 29, 2026
Resolve the File Explorer and Quick Open runtime file-list target through known worktrees so folder workspaces provide their root path, and make connectionId resolution reactive for SSH folder workspaces after store hydration.

Supersedes #6170.

Co-authored-by: bennewell35 <142949922+bennewell35@users.noreply.github.com>
@nwparker

Copy link
Copy Markdown
Contributor

Thanks for the fix, Ben. I closed this as superseded by #6567, which adopted this renderer-side folder-workspace fix with co-author credit, and #6481, which landed the complementary backend nested-subproject enumeration. Appreciate you jumping on this.

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.

[Bug]: File explorer name search returns no results when workspace root is a monorepo parent project

4 participants