Skip to content

fix(orcad-migration): refuse before fencing a manifest no catalog request can carry - #30836

Merged
nwparker merged 1 commit into
mainfrom
nwparker/orcad-manifest-request-budget
Oct 19, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/orcad-manifest-request-budget

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22

ELI5

When Orca moves an SSH host's saved projects and tabs to its managed server, it first locks the host and writes down what it is moving. One of its size checks was a little looser than another. A move that landed in the gap got locked in and could never be finished or undone. This PR does the strict check before taking the lock, so such a move is refused up front.

What Changed

Before: two limits disagree by about 1.1 KB:

A manifest in that gap was journaled and the host fenced, then:

  • the stage was refused;
  • the abort's first step (reading the server state) was refused, so the fence could not be released;
  • every reconnect resumed the same journaled manifest and failed the same way.

The host stayed fenced. The message said "Close tabs … then reconnect", which cannot help while the journal pins the manifest.

After: the budget check runs before the fence and journal are written, and before a delta move's journal. The user gets the same "too large, here are the largest parts" message, quoting the real request limit, and nothing is locked.

Mechanism:

  • One function, assertOrcadMigrationRequestFits, now holds the request budget, in orcad-migration-manifest-export.ts next to the existing oversize message.
  • The catalog client calls it for every request, with the same behaviour as before.
  • fenceOrcadMigrationSource calls it before it journals.
  • runOrcadDeltaMove calls it for a fresh delta before its terminal check, lease retirement and journal.

Why

The check stays out of createOrcadMigrationManifest. Delta planning, source assertions and preflight build manifests there that are never sent, and a full re-export can legitimately be larger than the delta that actually goes over the wire. The two journal points are the only places a manifest becomes binding, so they are the smallest correct choke point.

I did not release a fenced host when the client refuses an oversized request. An older client with a different reserve could have sent the stage, so that refusal is not proof the server holds nothing.

Follow-up (not in this PR): a host fenced in the last two days with a manifest in this ~1.1 KiB window keeps its fence. Releasing it safely needs proof from the server, for example an exact sealed-size check instead of the reserve.

Linked Issue

N/A (found in the post-hardening deficiency scan; regression from #30249).

Visual Proof

N/A: main-process refusal only, no UI change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated:
    • orcad-migration-source-fence.test.ts › "refuses, without a journal or fence, a manifest under the export cap that no request can carry". It fails on main (the fence is taken).
    • orcad-migration-delta-move.test.ts › "refuses, unjournaled, a delta under the export cap that no request can carry". It fails on main (the move proceeds).
    • All 24 src/main/ssh/orcad-migration* and orcad-runtime-conversion test files pass, plus the full static-analysis job locally.
  • Not verified live on a real host: unit tests only.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Wire: no change. Requests and the host are untouched; only the client refuses earlier.
  • Platforms: cross-platform; no paths or processes involved.
  • SSH: this is the SSH-host-to-managed-server move path.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…uest can carry

Export accepted manifests up to the 768 KiB validation cap, but every catalog
request (stage, state, abort) refuses params over the host's sealed-frame
budget, about 1.1 KiB lower. A manifest in that window was journaled and
fenced, then every way forward or back refused before sending, leaving the
host fenced. Measure the request budget once, in the export module, and check
it before the fence and before a delta's journal.

Co-Authored-By: Claude <[email protected]>
@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: 404d86b6-ff38-44a4-b32a-29581709f334
📥 Commits

Reviewing files that changed from the base of the PR and between feba21d and d1840a2.

📒 Files selected for processing: 6
  • src/main/ssh/orcad-migration-catalog-client.ts
  • src/main/ssh/orcad-migration-delta-move.test.ts
  • src/main/ssh/orcad-migration-delta-move.ts
  • src/main/ssh/orcad-migration-manifest-export.ts
  • src/main/ssh/orcad-migration-source-fence.test.ts
  • src/main/ssh/orcad-migration-source-fence.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.

📝 Walkthrough

The manifest exporter now provides a shared request-size assertion based on the host inbound JSON limit and a 1,024-byte envelope reserve. The catalog client uses this assertion. New delta moves and source fencing check manifest size before creating cutover state or applying an SSH fence. Tests cover requests that exceed the request budget while remaining within the manifest export-size cap.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to d1840

The new size check rejects oversized migration requests before creating new cutover state. No actionable merge-blocking issue was established; merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. 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 is concise, specific, and accurately describes the main change: rejecting oversized migration manifests before fencing.
Description check Passed The description is detailed and covers the user impact, mechanism, rationale, testing, platform considerations, and follow-up scope. It marks the linked issue as N/A even though the template requests …
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 is detailed and covers the user impact, mechanism, rationale, testing, platform considerations, and follow-up scope. It marks the linked issue as N/A even though the template requests an actual issue link, but it references the related #30249 regression and is otherwise complete.

  • 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 a75748a into main Oct 19, 2026
52 checks passed
nwparker added a commit that referenced this pull request Oct 19, 2026
…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]>
nwparker added a commit that referenced this pull request Oct 19, 2026
…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]>
nwparker added a commit that referenced this pull request Oct 20, 2026
…y can be cancelled by its id (#30864)

* fix(orcad-migration): a source fenced on a manifest no request can carry 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]>

* test(orcad-migration): cover the durable abort by reference and its RPC method

Co-authored-by: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
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