Repository navigation
Fix paired web Add Project folder browsing - #13885
Conversation
cb8b637 to
eb61548
Compare
📝 WalkthroughWalkthroughThe change adds paired-runtime support for repository browsing and addition in web clients. Web clients now exclude local hosts and select a paired runtime by default. Browse actions route through a host-aware dispatcher for local, runtime, and SSH hosts. Actions remain disabled when no host is selected. Tests cover rendering, routing, submission, reliability gates, and end-to-end multi-client navigation. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/sidebar/use-add-repo-host-selection.ts (1)
68-78: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFinal host fallback is not web-client-aware.
If
selectableHostOptionsis empty for a web client (for example, before the paired runtime host loads), every branch in this fallback chain fails andselectedHostIddefaults toLOCAL_EXECUTION_HOST_IDon Line 78 and again in the effect on Line 96. That id is excluded fromselectableHostOptionsfor web clients, soselectedParsedHostbecomes{ kind: 'local' }even though no local host is offered.routeAddRepoBrowseinadd-repo-browse-authority.tsthen callsbrowseLocal, which relies on a native picker not available in a browser context.Guard both fallbacks so they never resolve to
LOCAL_EXECUTION_HOST_IDwhenisWebClientistrue.🐛 Proposed fix
- const selectedHostId = selectedHost?.id ?? LOCAL_EXECUTION_HOST_ID + const selectedHostId = + selectedHost?.id ?? (isWebClient ? undefined : LOCAL_EXECUTION_HOST_ID) ?? LOCAL_EXECUTION_HOST_IDApply the equivalent guard to the effect's fallback on Line 96, or route both through one shared helper that returns
undefined/an explicit "no host" state instead ofLOCAL_EXECUTION_HOST_IDfor web clients.Also applies to: 90-97
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a738179a-b96f-4790-94a5-a0e1f2d4c884
📒 Files selected for processing (9)
config/reliability-gates.jsoncsrc/renderer/src/components/sidebar/AddRepoDialog.tsxsrc/renderer/src/components/sidebar/AddRepoDialogStepContent.test.tsxsrc/renderer/src/components/sidebar/add-repo-browse-authority.test.tssrc/renderer/src/components/sidebar/add-repo-browse-authority.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/store/slices/repos-paired-runtime-add.test.tstests/e2e/multi-client-navigation-isolation.spec.ts
|
Addressed the web-client fallback finding in f56d4a0. While a paired host is still loading, the selection now has an explicit no-host state instead of resolving to the local execution host; Browse, Clone, and Create cannot invoke client-local behavior. Added a focused regression test and reran typecheck, lint, packaging, and the full CI suite. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e1bc7ebf-2da1-44c4-8706-1bc3864561a5
📒 Files selected for processing (5)
config/reliability-gates.jsoncsrc/renderer/src/components/sidebar/AddRepoDialog.tsxsrc/renderer/src/components/sidebar/AddRepoDialogStepContent.tsxsrc/renderer/src/components/sidebar/AddRepoStartSteps.test.tsxsrc/renderer/src/components/sidebar/AddRepoStartSteps.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/sidebar/AddRepoDialog.tsx
- config/reliability-gates.jsonc
| }: AddRepoLocalStartStepProps): React.JSX.Element { | ||
| const browseActionRef = useRef<HTMLButtonElement | null>(null) | ||
| const actionsRef = useRef<HTMLDivElement | null>(null) | ||
| const actionsUnavailable = isAdding || actionsDisabled |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not intercept host-selector arrow keys while actions are unavailable.
hostSelector is inside the actionsRef container, but handleArrowNavigation still processes ArrowUp and ArrowDown when actionsUnavailable is true. It calls preventDefault() and attempts to focus disabled action buttons because the active element is not an action button. This can prevent keyboard users from opening or navigating the host selector while they must select a host.
Return when actionsUnavailable is true, and ignore events when the active element is not a button[data-add-repo-action]. Add a regression test for this state.
Suggested guard
const handleArrowNavigation = (event: React.KeyboardEvent<HTMLDivElement>): void => {
+ if (actionsUnavailable) {
+ return
+ }
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') {
return
}
...
const currentIndex = buttons.indexOf(document.activeElement as HTMLButtonElement)
+ if (currentIndex < 0) {
+ return
+ }
Summary
Screenshots
Paired-web Add Project journey (recorded from the passing separate-window Playwright/CDP regression):
[email protected]
Live
$electronCDP validation of the same PR head confirms desktop behavior is preserved: the isolated dev instance still presents Local Mac and the native Browse folder action.Testing
pnpm lintpnpm typecheckpnpm test— focused and routing suites run insteadpnpm build— exercised by the E2E-mode Electron/web buildAdditional validation:
pnpm run test:e2e:multi-client-navigation: 2 passed$electronlive CDP attach to the exact worktree identity, rendered desktop inspection, and full-window screenshotAI Review Report
Reviewed the viewer-to-host authority chain, explicit SSH selection, desktop-local behavior, folder workspaces, and mixed-version failure behavior. The regression assertions cover the native picker non-call, in-app host browser rendering, and
repo.adddispatch to the selected paired runtime. No implementation issue remained after the review.Cross-platform review found no new shortcut, label, shell, or path-separator behavior. Existing host path values stay opaque to the viewer and are interpreted by the selected macOS, Linux, Windows, or SSH runtime; native Electron folder picking remains desktop-local only.
Security Audit
No new dependencies, auth handling, command execution, filesystem APIs, or IPC/RPC shapes were added. Host paths continue through the existing runtime-scoped browse and add APIs, and paired web cannot fall back to the viewing computer’s native picker. No secrets or credentials are introduced or logged.
Notes
There are no remote wire changes. An older host without directory browsing support fails visibly in the in-app browser while manual host-path entry remains available; it never falls back to the viewer filesystem.