Repository navigation
fix(orcad-migration): a host fenced on a manifest no request can carry can be cancelled by its id - #30864
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 seconds. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
646f073 to
57f3b82
Compare
…rry can be aborted by its identity A desktop that fenced a manifest just under the export cap before #30836 could never send its abort: every catalog request carries the whole manifest and refuses it before sending. The abort now asks the server by migration id and digest instead (orcad.migration.abortCatalogByReference, behind a new capability), and releases only on the server's durable absent answer. A committed server still refuses the release. Co-authored-by: Claude <[email protected]>
…PC method Co-authored-by: Claude <[email protected]>
57f3b82 to
77ab5e2
Compare
ELI5
Moving an SSH host to its managed Orca server first "fences" the host on this computer, then sends the server a description of everything being moved. #30836 stopped new moves from starting when that description is too big to send. But a computer that had already started one before #30836 is stuck: every message about that move, including "cancel it", carries the whole description, so every one is refused before it leaves. The host stays fenced for good.
This PR adds a small "cancel by name" message that only carries the move's id and fingerprint. The server looks up its own copy, and the stuck host can be released.
What Changed
orcad.migration.abortCatalogByReferencewith only{ migrationId, manifestSha256 }. The server finds the move by id, checks the fingerprint matches, and cancels its own staged copy if it has one. It writes that to disk before answering. The fence is released only when the server says, after that write, that it holds nothing for the move. If the server says the move is already committed, the release is refused, as it is today for any committed move.How it works:
abortOrcadMigrationCutover(src/main/ssh/orcad-migration-cutover-coordinator.ts) checksorcadMigrationRequestFitsfirst, using the same budget fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 measures. If the full message would not fit, it uses the newabortByReferenceport and skips the read and abort that carry the whole manifest.abortOrcadMigrationCatalogByReference(src/main/persistence/migrating-orcad-catalog/orcad-catalog-reference-abort.ts) looks for the move's stored stage or receipt, refuses a fingerprint mismatch, and hands the stored manifest to the existingabortStagedOrcadMigrationCatalog. The runtime wrapper flushes before reporting an absent result, as the existing durable abort does.abortRemoteOrcadMigrationCatalogByReference(src/main/ssh/orcad-migration-catalog-reference-client.ts) sends the request only to a server that advertises the new capabilityorcad.migration-catalog-abort-by-reference.v1. It accepts an "absent" answer only when the server marks it as flushed to disk.Why
The real risk is a desktop that started the move before v1.4.230 (8f86ccf). That version had no client-side size check, so a manifest in this window could really have reached the server and been staged, or even committed, as long as its sealed frame fit in 1 MiB. So "we can't send it" can never count as proof that the server holds nothing. Only the server can say so, and the server already has its own copy of whatever it received. That makes asking by id and fingerprint the one answer that is provably safe.
Alternatives considered:
Wire compatibility: this adds a new method and a new advertised capability. Nothing changes in existing messages. A client that talks to an older server, one without the capability, refuses before sending and keeps the fence. That refusal uses its own error code, never
ORCAD_MIGRATION_DESTINATION_UNSUPPORTED, which the coordinator treats as permission to release. If a server advertises the capability but answers method-not-found, that is mapped to the same refusal. Older desktops never see or send the new method.Linked Issue
Follow-up to #30836 (from the SSH/managed-server deficiency scan). No separate issue.
Visual Proof
N/A. No UI change. The existing cancel action now succeeds where it used to fail with the "too large" message.
Testing
New tests, which fail on main:
orcad-migration-cutover-coordinator.test.ts, "a journal fenced before fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 on a manifest no request can carry". This rebuilds a pre-fix(orcad-migration): refuse before fencing a manifest no catalog request can carry #30836 journal and fence on a manifest that is over budget but under the cap. The fake destination refuses whole-manifest requests unsent, as the real client does. On main, the abort rejects withorcad_migration_manifest_too_largeand the fence stays. With this PR it covers: release on a durable absent answer; abort of a stage an older build delivered whole; fence kept when the server can't answer by reference; release refused for a committed server.persistence-orcad-migration-catalog.test.ts: the real Store aborts by reference from its own staged copy. It refuses a fingerprint mismatch with the stage left in place, and never rolls back a commit.orcad-migration-catalog-client-frame-budget.test.ts: only the identity is sent, a non-durable absent answer is refused, and a server without the capability gets nothing.Verified locally: those three files, plus the
orcad-migration*,migrating-orcad-catalog,runtime/rpc/methods,managed-server/lifecycleandshared/orcad-migrationfolders, single worker. The only failures there (orcad-runtime-deployment,orcad-runtime-maintenance, somerpc/methodssession-tab and orchestration specs, all with "AppEnvironment not initialized") fail the same way on main. Also ranpnpm tcand every step of the "static analysis and typecheck" job, including all ratchets andverify:rpc-params-catalog.Live vs tests: verified in unit tests only. I didn't reproduce on a real host, because building a pre-#30836 fenced journal needs an older desktop build plus a manifest in a 1 KiB window.
AI Disclosure
Review
Codex (
gpt-6.1-sol, high): three rounds (first head, rebased head, and after the review-driven test additions). No findings in any of them. Independent Opus review: mergeable. Its two P2 test gaps are closed: the written-to-disk-before-absent retry forabortStagedOrcadMigrationCatalogByReferenceDurably, andorcad.migration.abortCatalogByReferencein the RPC registration and runtime-client-only tests.Agent skill upstream boundary
Notes
Known limits (P3, intentional and conservative):
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)