Skip to content

feat(orcad-migration): a capability-gated blob channel beside scrollback (D1b-6a) - #28866

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-mover-d1b-6a-blob-channel
Oct 14, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-mover-d1b-6a-blob-channel

Conversation

@nwparker

@nwparker nwparker commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1034 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1030
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1224 $\color{#cf222e}{\Huge{\mathbf{−}}}$​229 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​995

ELI5

When Orca moves projects onto a managed Orca server, it already sends terminal scrollback in small chunks that can resume after an interruption. Moving a WSL project losslessly also needs other data: each pane's last folder, shell history and agent chat records. This PR adds a general channel for that data next to the scrollback channel. It is gated per kind of data, so a server that can't install a kind refuses the move instead of quietly dropping it. Nothing sends data on it yet, and SSH conversion works exactly as before.

What Changed

This is step D1b-6a of the lossless WSL project mover.

  • Shared contract (src/shared/orcad-migration-blob-transfer.ts):
    • Blob kinds: terminal-restore-hints, shell-history and agent-session-records.
    • Key rules: each kind has strict key rules: lowercase, no dots, a single path segment, and Windows device names such as con or nul refused.
    • Size caps:
      • 4 MiB for restore hints, and 64 MiB for each of the other two kinds.
      • In total, at most 1024 blobs and 256 MiB.
      • Chunks are 128 KiB, the same as scrollback.
    • Capabilities: a base orcad.migration-blob.v1, plus one per kind (orcad.migration-blob.<kind>.v1).
  • New RPC orcad.migration.stageBlobChunk, separate from stageSnapshotChunk, with resume from receivedBytes. It requires host-admin permission and is gated to the migration runtime client.
  • Receiver: the staging, append, resume, commit, abort and prune logic is shared between scrollback and blobs (orcad-migration-staged-file.ts). Scrollback keeps identical paths, error codes and behavior, now pinned by a test.
    • Blobs commit into a per-migration "received" folder that the next steps install from.
    • Restaging the same key with different bytes is refused.
    • Prune clears received blobs from migrations that were neither staged nor committed.
  • Commit names its blob set: commitCatalog takes an optional expectedBlobs. The destination refuses with orcad_migration_blob_set_mismatch unless the blobs it received match exactly, so a blob that never arrived can't be silently missing.
  • Sender (src/main/ssh/orcad-migration-blob-coordinator.ts): it checks capabilities before sending anything. If a kind is unsupported, the move is refused naming that kind, and nothing is uploaded.
  • Advertising: the server advertises only the base channel for now. Each kind is added to ORCAD_MIGRATION_INSTALLABLE_BLOB_KINDS in the PR that adds its installer (D1b-6b, D1b-6c). Until then the sender refuses every kind, so nothing is staged that couldn't be applied.

Why

Older servers silently drop manifest sections they don't recognize: the digest is checked on the raw manifest, but the import uses the re-parsed one. So new data can't simply be added to the manifest; it has to be gated before staging. Restore hints are captured after terminals pause, but the manifest is signed earlier, so they can't go into the manifest anyway. A separate, resumable, digest-checked channel solves both problems and keeps SSH manifests byte-identical.

Wire compatibility

  • Manifest and scrollback: the manifest is unchanged (the golden digest test passes untouched), and the scrollback RPC is unchanged.
  • Commit request: without blobs, including every SSH commit, the commit request is still exactly { manifest }. A test pins this even against a blob-capable host.
  • expectedBlobs: it is sent only when the destination advertises the blob channel. That channel ships in the same change, so any host that advertises it understands the field.
  • Catalog state: the new blobUploads field is optional, and older readers ignore it.

Linked Issue

N/A (maintainer; tracked in the WSL-via-orcad implementation tracker, step D1b-6).

Visual Proof

N/A: no UI change and no production caller yet.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Contract tests: key and size rules, Windows reserved names, and older catalog states still parsing.

  • Receiver tests:

    • Staging lifecycle: staging, resume, a retried range that doesn't match, conflicts, commit, abort and prune (including received blobs).
    • Blob-set check: mismatch refused, exact set commits, field omitted keeps today's behavior.
    • Restart: a real-store test across a restart.
  • Sender and client tests: resume, a lost acknowledgement, refusal when the base or per-kind capability is missing, and the commit field being sent only with blobs.

  • Regression pin: a test fixing the scrollback staging filename and error codes.

  • Checks: the SSH manifest golden test, pnpm tc:node, both oxlint configs, the changed-code quality gate and the RPC params catalog check all pass. The only failing unit test, orca-runtime-agent-session-operation.test.ts, fails the same way on main.

  • Adversarial review: no HIGH findings, and the shipped scrollback path was verified unchanged. Two MEDIUM issues (a missing blob undetectable at commit; received blobs leaking after a failed commit) and four LOW issues are fixed here.

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

The SSH migration path is shared and refactored, so the SSH end-to-end shards must pass. No caller sends blobs yet, and every kind is refused until its installer lands.

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)

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fab90439-34df-4375-a652-61e849e91bf7
📥 Commits

Reviewing files that changed from the base of the PR and between 430d606a045231c7c8f06fc2d7268e1f7a208dbd and 8901f93.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

The change adds shared contracts and validation for ORCAD migration blobs, disk-backed chunk staging, and blob readiness and commit checks. Runtime and RPC paths accept blob chunks and optional expected blob sets. The SSH client checks destination capabilities, and a transfer coordinator resumes uploads from reported offsets. Snapshot staging now uses shared staged-file operations. This build advertises the blob channel but has no installable blob kinds.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 430d6

The change adds a capability-gated blob upload channel that no caller uses yet, so current behavior is unchanged. The only open item is a minor comment placement fix, and the PR is safe to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 19.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 86 functions across 25 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 clearly identifies the main change: a capability-gated blob channel added beside scrollback for Orcad migration.
Description check Passed The description covers the required sections, including the user impact, implementation, rationale, compatibility, testing, visual proof, scope, and checklist. The blank AI Disclosure and Review secti…
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.
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments: 1
src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-staging.ts: 1

153-160: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Move the misplaced doc comment to commitOrcadMigrationBlobs.

The first JSDoc block on lines 153-156 describes the precondition for commitOrcadMigrationBlobs. In the code it sits directly above a second JSDoc block for assertOrcadMigrationBlobSetMatches. Because of this, commitOrcadMigrationBlobs has no documentation, and editors attach the commit precondition to the wrong function. Move the block to line 192.

Note: the OpenGrep hint on line 251 is a false positive. STAGED_BLOB_NAME.exec is RegExp.prototype.exec, not child_process.exec.

Source: Linters/SAST tools


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf82faee-618f-411c-860a-0441578a558b
📥 Commits

Reviewing files that changed from the base of the PR and between 27c0275 and 430d606a045231c7c8f06fc2d7268e1f7a208dbd.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 25
  • src/main/persistence-orcad-migration-blobs.test.ts
  • src/main/persistence/loading-store/store-runtime-state.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-catalog-import.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-staging.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-staging.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-migration-staged-file.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-scrollback-snapshot-transfer.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-scrollback-snapshot-transfer.ts
  • src/main/runtime/orca-runtime-get-status.ts
  • src/main/runtime/orca-runtime-migration-catalog.ts
  • src/main/runtime/orcad-migration-catalog-import.ts
  • src/main/runtime/rpc/methods/orcad-migration.test.ts
  • src/main/runtime/rpc/methods/orcad-migration.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/ssh/orcad-migration-blob-coordinator.test.ts
  • src/main/ssh/orcad-migration-blob-coordinator.ts
  • src/main/ssh/orcad-migration-catalog-client-blob-kind.test.ts
  • src/main/ssh/orcad-migration-catalog-client.ts
  • src/shared/orcad-migration-blob-transfer.test.ts
  • src/shared/orcad-migration-blob-transfer.ts
  • src/shared/orcad-migration-catalog-state.ts
  • src/shared/orcad-migration-manifest.ts
  • src/shared/orcad-migration-scrollback.ts
  • src/shared/orcad-runtime-capabilities.ts
  • src/shared/rpc-contract/orcad-migration-params.ts

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

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