Repository navigation
Conversation
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8f1a523a-103d-4df6-91bb-f98eb693c46a
📥 Commits
Reviewing files that changed from the base of the PR and between c31712f and 142bd2ecfa474a68f9a78ef3f8bf41e7df47d865.
📒 Files selected for processing: 6
src/renderer/src/components/sidebar/WorktreeContextMenu.delete-shortcut.test.tsxsrc/renderer/src/components/sidebar/WorktreeContextMenu.move-to-group-host.test.tsxsrc/renderer/src/components/sidebar/use-worktree-context-menu-model.tsxsrc/renderer/src/components/sidebar/worktree-list/rows/repo-header-project-actions.test.tsxsrc/renderer/src/components/sidebar/worktree-list/rows/repo-header-project-actions.tsxsrc/renderer/src/store/slices/project-group-owner-routing.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Both Move to group submenus listed every project group in the all-host catalog. Group membership lives on the project's own row, so the move goes to the project's host, which replaces a group id it does not store with null. Picking a group from another host left the project ungrouped, or took it out of its current group, with no error. Filter the submenu to groups whose catalog is the project's catalog: this app's catalog for local and direct-SSH projects, the paired server's for its projects. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e's host The workspace card menu looked the project up by id through the active-workspace selector. Repo ids repeat across hosts, so right-clicking a paired host's workspace while this Mac's same-id project was active filtered and moved with the wrong row. Look the row up on the workspace's own host, as the edit dialog already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… rebasing onto main - isProjectGroupJoinableFromCatalog (stablyai#30127) reuses catalogHostIdFor instead of a second copy. - The card menu's host-aware repo and group lookup moves to use-worktree-menu-project-groups.ts so the menu model stays under max-lines. - The menu test fixture gains unifiedTabsByWorktree, which main's sleep check now reads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A workspace row from older local metadata has no host stamp. The card menu fell back to the active workspace's project row, so with a paired twin active it offered the twin host's groups. Follow the owner index instead: no runtime owner and no host stamp means local. Co-Authored-By: Claude Opus 5.5 <[email protected]>
142bd2e to
0802dd1
Compare
|
Rebased onto main @nwparker since #30127 the store refuses a move into another host's group and says so. This PR keeps that guard. What it still adds on top:
Is the menu filter wanted on top of #30127? If not, I'll close this and keep only (2) as a smaller PR. |
|
Thanks @jbamlee, and thanks for rebasing. Please go with the smaller PR: keep only (2), resolving the card menu's project row on the clicked workspace's host. That one is a real twin bug: with the same repo id on two hosts, the menu can show or move the wrong host's project. It matches the host-scoping we've been tightening across the sidebar. For (1) we'd rather not add the menu filter on top of #30127. The store guard already refuses a cross-host move and says why. A second filter in the menu is one more place that has to agree with the store's host rules, and it hides groups people may expect to see. Please close this one and open the (2)-only PR; I'll review it. |
ELI5
Each project group is saved on one computer, and a project can only join a group saved on the same computer. The Move to group menu lists every group from every connected computer. Since #30127, picking a group from another computer shows an error instead of failing silently, but the menu still offers it. Now the menu only lists groups the project can actually join.
What Changed
Before (current main): on a Mac paired with a Linux host, the Move to group submenu of a Linux project also lists the Mac's groups. Picking one shows "Could not move project to group" (#30127). On a workspace card's right-click menu, when two hosts have a project with the same repo id, the menu can act on the active workspace's host instead of the clicked workspace's host.
After: both submenus list only groups stored on the project's own host. When that host has no groups, the submenu is hidden. New group from project already creates the group on the project's host, so that remains the way to start a group there. The card menu uses the clicked workspace's own project row.
Mechanism:
project-group-owner-routing.ts: newgetProjectGroupsForRepoHost(projectGroups, repo). It keeps a group only when the group and the project resolve to the same catalog (ipcOrRuntimeTargetForHostId): this app's IPC forlocaland directssh:projects, the paired server forruntime:projects.isProjectGroupJoinableFromCatalog(fix(project-groups): say so when a project cannot join a group on another host #30127) now shares the samecatalogHostIdForlookup, so the menu and the store's guard cannot disagree.repo-header-project-actions.tsx(project header…menu) builds its submenu from that list.use-worktree-menu-project-groups.ts: the card menu's project row is looked up on the clicked workspace's host (findIndexedRepoOwnerForHost), not through the active-workspace selector, and its groups come from the same filter. A workspace row from older local metadata has no host stamp; like the worktree owner index, no runtime owner and no host stamp means local.use-worktree-context-menu-model.tsxuses it.Why
Root cause: group membership is
projectGroupIdon the project's own row, and each group is stored on exactly one host. The project's host clears a group id it does not hold. #30127 now refuses such a move in the store with a toast, but both menus still build their list from every host's groups, so the user is offered choices that always fail.Alternatives considered:
Linked Issue
Fixes #29862 (same bug as #13699)
Visual Proof
The Orca app ran in the background with a project on this Mac, one of this Mac's groups, and a group stamped as owned by a paired host. Text below is what the real app rendered.
On current main without this PR, the paired-host group is still listed; choosing it shows the #30127 error toast.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New
repo-header-project-actions.test.tsx: paired-host projects see only their host's groups; local and direct-SSH projects see this app's groups (including a folder-backed SSH-root group); the submenu is hidden when the host has none.New
WorktreeContextMenu.move-to-group-host.test.tsx(real Radix menu): the same filter on the card menu, plus two hosts sharing a repo id; the move is sent with the clicked workspace's host. An unstamped local workspace keeps this Mac's groups while a paired twin is active (fails on the active-workspace lookup).WorktreeContextMenu.delete-shortcut.test.tsx: the fixture's mockeduseRepoByIdreturned a project missing fromstate.repos, which the real store cannot do. It now reads fromstate.repos.Rebased onto main
90e99c48f4:pnpm test src/renderer/src/components/sidebar src/renderer/src/store/slices src/renderer/src/lib(14420 passed),pnpm tc,oxlint,pnpm run check:code-quality:changed.Platforms: macOS (unit tests and a background Electron E2E). The change is renderer-only with no platform branches.
AI Disclosure
Implemented with Claude Code (Claude Opus 5.5). Independent review by GPT-6 Astra (xhigh reasoning) through Codex CLI before the rebase; its one finding, the card menu's repo lookup, is fixed in this PR. CodeRabbit's unstamped-workspace finding on that lookup is fixed too.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code