Repository navigation
fix(ssh): relinking a stopped managed server keeps the project groups it holds, and later moves don't re-send them - #30608
Conversation
…ater moves reference them Relinking found server-held groups only through the rows in them, so an empty group renamed on the server was re-imported and refused. Delta moves re-exported a linked group whenever a new row sat in it, so a group renamed on the server refused the next Move. Both now leave the server's group as is.
…s, with their host stamps
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
|
Docker managed-orcad SSH lane (both shards) passed on bc2c28a: https://github.com/stablyai/orca/actions/runs/39212773938 |
ELI5
When you move an SSH host's projects onto a managed Orca server, the server becomes the owner of those projects and their groups. If you later stop that server and reconnect, or move a few more projects onto it, Orca compares what this desktop remembers with what the server holds. For project groups, that comparison was incomplete. The desktop's old copy of a group could be sent again over the server's newer one, and the server refused the move.
What Changed
Before
orcad_migration_project_group_id_conflict. The reconnect only spotted groups the server held when one of its projects sat inside them.After
connectionIdorexecutionHostId. The group list now keepsexecutionHostId, which it used to drop.Mechanism
orcad-server-project-groups.ts(new):projectGroupsHeldByServeris the identity rule for groups: same id, on the server's own machine.serverHeldProjectGroupsreturns exactly that set once the server's group list has been read. The old search through server projects and their parent groups now runs only when no group list was read.orcad-migration-repository-link.ts: the relink now starts when the server holds a group, not only a project or folder, and it reads the server's group list whenever the move contains groups.orcad-migration-delta-plan.ts: groups that were moved or linked are passed as server-owned groups, which are never sent again. The exception is any group an interrupted older-build manifest already sent, so resuming that manifest still matches its record.Folder workspaces: the review also reported that a folder whose comment was edited on the server failed to relink. Current main already handles this, because a folder is matched by id and folder path (#30017). This PR adds a regression test for it.
Why
Each kind of thing is matched to the server's catalog by its own rule: projects by id and path on the server's machine, folders by id and folder path, and groups by id on the server's machine. For anything the server holds, the server's copy wins. Groups were the kind with no rule of their own; they were only inferred from the projects inside them. That left out empty groups and groups changed on the server. It also counted parent groups the server never had, or kept for another host. Matching against the server's own group list is exact evidence, which keeps the rule simple.
Alternatives considered:
ref-oss check (run after the third review round, as the review rule requires): the design is confirmed, and the approach did not change. Each kind (projects, folder workspaces and project groups) has its own identity rule, and all three are relinked against the server's catalog, with the server authoritative for what it holds. Groups were the kind that was missing. Following that design, round 5 dropped the remaining inference of groups from parent chains when the server's group list is available.
Known limitations (low severity; they fail visibly and lose no data):
orcad_delta_refused_by_server) and the host stays marked as changed. Moves have no access to the server's group list, so they can't tell these apart.Linked Issue
No issue. This comes from internal SSH-hardening review findings #8 and #9; it follows up #29586 and #29962.
Visual Proof
N/A. No UI change. The fix is in the main-process migration planner.
Testing
orcad-migration-repository-link.test.tsandorcad-migration-delta-move.test.ts: an empty group renamed on the server, nested groups whose parent was renamed, a later folder or project in a renamed or imported group, a group the server deleted (refused, not brought back), a same-id group kept for another host, an interrupted older-build delta, and a folder edited on the server. The group tests fail on main; the folder test passes on main.orcad-server-project-groups.test.ts: the identity rule, including a foreign parent, a parent the server lacks, andexecutionHostId.orcad-migration-catalog-client.test.tschecks thatexecutionHostIdsurvives parsing.Review
executionHostIdwas dropped from the server's group list. The final run was clean.Agent skill upstream boundary
Notes
Mixed versions: no wire change. The group list reads one more optional field. A journal written by an older build resumes exactly as that build recorded it. SSH-only flow; folder workspaces covered; no platform-specific code.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)