Skip to content

fix(projects): a project move names the row it moves; a paired server's twin by its SSH target - #30794

Merged
nwparker merged 4 commits into
mainfrom
nwparker/r4-2-drag-and-remote-move-host
Oct 19, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/r4-2-drag-and-remote-move-host

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Sometimes the same project shows up twice in the sidebar: once on this computer and once on an SSH host, or twice on one paired remote server. The two copies share an id. When you dragged one of them to reorder it, or moved one into a group on a paired server, Orca named only the id. The other copy could get moved, or the server refused the move because it couldn't tell which copy you meant. Now Orca names the exact copy you acted on.

What Changed

Follow-up to #30756 (R4-2 family a), now on main.

  • Sidebar header drag. Before: the drag remembered only the project id. At drop time it looked the row up by id, so with twins it used whichever copy came first, including its host. After: the drag session holds the row the user pressed, and the drop sends that row.
  • Drop re-reads the row. At drop time the dragged row is looked up again by its full identity. If its group changed during the drag (from another window or client), the drop does nothing, so it can't write the old group back.
  • Store action. moveProjectToGroup(project, groupId, order) now takes the row (RepoHostTarget: id, connection, host), not an id plus an optional host. Every caller already had the row, so their getRepoExecutionHostId(...) plumbing is gone. The store finds the exact row with isSameRepoRow, which compares id, host and SSH connection, and updates only that row once the host replies.
  • Paired server. Before: projectGroup.moveProject sent only the id. A server holding twins answered selector_ambiguous, so the move failed. After: the client also sends the row's connectionId. That is the server's own SSH target for the row, and the client keeps it on adopted rows. The server narrows the selector with the existing resolveRepoForConnection, the same way worktree.teardownMissingTerminals already does.

Why

  • Why connectionId and not hostId over the RPC. On the client, every row from a paired server carries the same runtime:<env> host. The RPC's host field maps runtime:* to local on the server, so a host id can't tell a server-local twin from a server-SSH twin. connectionId can, and the selector already accepts it, so this adds no new resolver.
  • Mixed versions. The field is optional.
    • An older client omits it, and the server behaves as before.
    • An older server strips the unknown field (z.object isn't strict), and it also behaves as before: unique ids move, twins still refuse rather than guess.
    • No capability is needed, because neither side can mis-handle the field.
  • Why pass the row and not add another hostId argument. This matches R4-2: a write takes the row's identity, so a guessed host can't get in.

Linked Issue

Follow-up to #30756 (R4-2). No standalone issue.

Visual Proof

N/A. Same drag and the same menu actions; only which row gets written changes.

Testing

  • Automated tests added/updated
  • Twin tests that fail before this change and pass after:
    • the drag commits the dragged SSH twin, not the id-keyed local copy (project-header-drag-commit.test.ts);
    • a paired-server twin move sends connectionId and updates only that row (repos-project-group-cross-host-move.test.ts);
    • the server moves the SSH or the local twin named by connectionId (runtime-remove-project-host-scope.spec.ts);
    • the RPC passes connectionId through (repo.test.ts).
  • Units: the sidebar folder re-run after the fix (378 files / 3,145 tests); before that, sidebar, store project-groups/repos, runtime rpc/repo, project-group controller, managed-worktree queries. 414 files / 3,547 tests pass, single worker.
  • Static-analysis job steps from pr.yml, run locally, are green:
    • the focus-read baseline drops by 1;
    • three e2e store helpers were updated to the row-shaped call.
  • Not verified live on a paired server (unit only).

Review

  • Codex (gpt-6.1-sol, high): 5 rounds. Round 3, after the rebase onto main, found one P2: the drag committed the snapshot's group. It's fixed with the re-read above, and a test covers it. Round 5 is clean.
  • Opus: no P1/P2. Three P3s:
    • Fixed: removed the new row.repo! assertion, and the existing one next to it.
    • Fixed: "the drag uses the row snapshot from pointer-down". Codex raised it as P2 too, and the drop now re-reads the row.
    • Noted, older than this PR: drop position maths is still keyed by id. In the mixed-host "ungrouped" bucket, a twin's start index and siblings come from the first copy. The write is now exact, but the computed order can be off. Fixing it means host-qualified header keys across the drag bucket and DOM attributes; that's a follow-up.

Agent skill upstream boundary

  • Not applicable.

Notes

SSH and paired servers are covered above. Folder rows carry connectionId the same way. No platform-specific code.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A visual, with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered
  • Static job and the affected unit folders pass locally

@nwparker
nwparker changed the base branch from nwparker/r4-2-host-scoped-store-writes to main October 19, 2026 17:15
@nwparker
nwparker force-pushed the nwparker/r4-2-drag-and-remote-move-host branch from 598c8ec to 13a17c2 Compare October 19, 2026 17:15
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb22319f-e795-4799-a96b-46aab29fa38c
📥 Commits

Reviewing files that changed from the base of the PR and between baf123e and c5b5ba9.

📒 Files selected for processing: 26
  • config/focus-setting-read-baseline.txt
  • src/main/runtime/construction/runtime-host-services.ts
  • src/main/runtime/rpc/methods/repo.test.ts
  • src/main/runtime/rpc/methods/repo.ts
  • src/main/runtime/runtime-project-group-controller.ts
  • src/main/runtime/runtime-remove-project-host-scope.spec.ts
  • src/renderer/src/components/sidebar/project-header-drag-commit.test.ts
  • src/renderer/src/components/sidebar/project-header-drag-commit.ts
  • src/renderer/src/components/sidebar/project-header-drag-contract.ts
  • src/renderer/src/components/sidebar/project-header-drag-start.test.ts
  • src/renderer/src/components/sidebar/project-header-drag-start.ts
  • src/renderer/src/components/sidebar/project-header-drag.ts
  • src/renderer/src/components/sidebar/use-worktree-context-menu-commands.ts
  • src/renderer/src/components/sidebar/worktree-list/drag/use-header-drag.ts
  • src/renderer/src/components/sidebar/worktree-list/rows/SectionHeader.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs.ts
  • src/renderer/src/store/project-groups/project-group-mutations.ts
  • src/renderer/src/store/repos/repo-state.ts
  • src/renderer/src/store/slices/repo-host-identity.ts
  • src/renderer/src/store/slices/repos-project-group-cross-host-move.test.ts
  • src/renderer/src/store/slices/repos-project-groups.test.ts
  • src/renderer/src/store/slices/repos.test.ts
  • src/shared/rpc-contract/repo-params.ts
  • tests/e2e/project-group-creation-visibility.spec.ts
  • tests/e2e/sidebar-measured-row-scroll.spec.ts
  • tests/e2e/worktree-lineage-toggle-dialog.spec.ts

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

📝 Walkthrough

Project-group moves now take a repository row and preserve its connection ID through renderer and runtime resolution. Row matching and store updates distinguish repositories with shared IDs. Sidebar drag sessions retain the repository row and validate it against live rows before committing. Tests cover local and SSH twins, drag behavior, and updated call sites.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to c5b5b

The reviewed change has no established merge-blocking issue. Paired-server behavior has unit coverage but has not been verified on a live paired server.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 25 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: project moves now target the exact row, including paired-server SSH twins.
Description check Passed The description covers the required sections, explains the user impact and implementation, documents compatibility and testing, and records the known follow-up limitation. It references issue #30756, …
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: Description check

Explanation

The description covers the required sections, explains the user impact and implementation, documents compatibility and testing, and records the known follow-up limitation. It references issue #30756, although it does not use a populated Fixes # line.

Full details: Docstring Coverage

Explanation

Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 25 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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

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

@nwparker
nwparker merged commit 86ef00a into main Oct 19, 2026
51 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