Repository navigation
fix(ssh): a relay-era desktop can join the server another desktop on the same login runs - #28886
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
…the same login runs A desktop that still had relay-era projects on a host whose managed server another Orca version ran could never connect: its migration skipped the running-version adoption, so it deferred on a terminal count only a paired server can give. Once the versions matched it failed instead because the server already held the same repository path, added by the other desktop. The migration now pairs with the running server like a fresh desktop does, before any upload. Projects the server already holds at the same host path are linked to the server's project instead of imported twice: the journal is re-cut without them, under the same migration id, only after the server proves it holds nothing of the earlier manifest. A conflict the server will keep refusing now says what conflicts and how to get past it.
The bridge reattaches a relay pane only into its own tab, which a linked project never sends to the server, so linking would leave that terminal running out of sight. Refuse the link instead, naming the project and how to end the terminals.
d127c07 to
effe6ca
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Preserve byte-distinct POSIX paths when matching… · orcad-migration-repository-link.ts:25-43
src/main/ssh/orcad-migration-repository-link.ts:25-43
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve byte-distinct POSIX paths when matching server repositories.
normalizeRuntimePathForComparisonNFC-normalizes both paths. On a byte-exact Linux/SSH host, NFC and NFD names can identify different directories.repositoriesHeldByServerthen treats those paths as one when their IDs differ.linkServerHeldRepositoriesremoves the incoming repository from the source manifest, so migration can omit the distinct checkout and retain the server’s other checkout.Use a byte-preserving POSIX key at this matching boundary. Preserve the existing Windows, separator, and trailing-slash behavior.
Suggested fix
-import { normalizeRuntimePathForComparison } from '../../shared/cross-platform-path' +import { + isWindowsAbsolutePathLike, + normalizeRuntimePathForComparison +} from '../../shared/cross-platform-path' @@ export type OrcadServerRepository = Pick<Repo, 'id' | 'path'> +function repositoryPathKey(path: string): string { + const normalized = normalizeRuntimePathForComparison(path) + if (isWindowsAbsolutePathLike(path)) { + return normalized + } + const byteExact = path.replace(/\/+/g, '/').replace(/\/+$/, '') || '/' + return `${normalized}\u0000${byteExact}` +} + /** Incoming projects the server holds at the same host path under another id. */ export function repositoriesHeldByServer( @@ const serverIdsByPath = new Map<string, Set<string>>() for (const repo of server) { - const key = normalizeRuntimePathForComparison(repo.path) + const key = repositoryPathKey(repo.path) serverIdsByPath.set(key, (serverIdsByPath.get(key) ?? new Set()).add(repo.id)) } return incoming .filter((repo) => { - const ids = serverIdsByPath.get(normalizeRuntimePathForComparison(repo.path)) + const ids = serverIdsByPath.get(repositoryPathKey(repo.path))
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
93835312-e5e8-46d5-b7ff-eec74b53a206
📒 Files selected for processing: 1
tests/e2e/ssh-orcad-shared-login-migration.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
…the same login runs (#28886) Ported to the v1.4.225 base. The base has no OrcadMigrationSourceCutoverPort or createSshRelayMigrationSource, so the linked source view is passed as the cutover context's existing `freshSource`, and the pre-relink fence check calls assertOrcadMigrationSourceUnchanged directly. Only listRemoteOrcadRepositories was taken from the catalog client; the blob-chunk staging from main is not part of this release.
…or an unowned relay terminal A project this desktop moved that the host's server already held is linked to the server's copy, so its tabs and automations from this desktop stay behind. The connect now carries those linked projects and the SSH host card says so, with the automation count, instead of dropping them silently. A bridged relay terminal of unknown or removed project still blocks a link, but its guidance no longer names the linked project as where it runs. Both terminal messages now offer removing the project from this desktop as the way out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ELI5
When two people share one login on a server, and one of them still had projects there from before Orca's managed server existed, that person's Orca could never connect again after updating. Now it joins the server the other person's Orca already runs, and a project both of them added is treated as the same project instead of as a conflict.
What Changed
Before (found in 1.4.225 release testing on a Docker SSH host):
orcad_migration_repository_path_conflict:/root/migrepo).After: B pairs with the server A already runs, without uploading or restarting it, so A's terminals keep running. B's project at the same host path is linked to A's project on the server. B's other projects move as usual. B connects.
Mechanism:
orcad-runtime-deployment.ts: a relay migration now also pairs with a running server of another Orca version (adoptRunningOrcadVersion, from fix(ssh): a new desktop can connect to a host already running a different Orca server version #28642), before any upload. Only--forceskips it now. Before this, a migration always ran its own deploy. Without a paired server it can't count terminals, so it always deferred.orcad-migration-repository-link.ts: after pairing and before staging, the conversion lists the server's projects (repo.list, which every server has).repositoriesHeldByServer).linkedRepositoryIds, andsourceBaselineFingerprintkeeps the whole fenced source.orcad-migration-delta-plan.ts: a later delta move treats linked projects as already on the server, so it never offers them again.ssh-host-server-on-connect.ts+orcad-migration-conflict-guidance.ts: a conversion the server will keep refusing (a catalog/state conflict) now reportsrefusedwith the real reason and the way out (remove that project from this desktop and connect again), instead of "Try connecting again". A staged claim from another desktop's in-flight move expires, so it stays a retry.Why
normalizeRuntimePathForComparison, the same rule the server's own conflict check uses. POSIX paths stay case-sensitive, and only Windows paths fold case. A row with the same id is left to the import's existing same-row check. Two of B's own projects at one path, and id conflicts, are still refused, now with an explanation.repo.listand the catalog calls already exist on every server. The new journal field is optional and local. Older builds ignore it, and the baseline fingerprint keeps a downgraded build from mistaking the linked rows for a change.Linked Issue
Found in 1.4.225 release QA (follow-up to #28642).
Visual Proof
N/A: no layout change. The connect now succeeds. The remaining conflict case uses the existing "Not moved to a managed server" line, whose Details now name the conflict and the way out.
Testing
orcad-migration-repository-link.test.tsruns the conversion against a real server-side import (a second profile store standing in for orcad):orcad_migration_repository_path_conflict(the QA failure).orcad-runtime-deployment.test.ts: a migration deploy onto a host another version runs pairs without uploading. An unverifiable host starts and registers nothing. I checked that both tests fail without the fix.ssh-host-server-on-connect.test.ts: a path conflict becomesrefusedwith the path and the way out. A staged claim stays a retry.New Docker real-host e2e
tests/e2e/ssh-orcad-shared-login-migration.spec.tsruns the exact QA sequence:sleepterminal running.orcad-ssh-dockerlane.pnpm tc:node,pnpm test src/main/ssh src/main/ipc src/shared src/main/persistence-orcad-migration-catalog.test.ts(1873 files passed; one known timing flake inorcad-state-snapshot-shell.test.tspassed on rerun),pnpm run check:code-quality:changed.I manually tested these changes locally
Automated tests added/updated, or explained why not below
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)