Skip to content

feat(wsl-mover): export a local WSL move's manifest with all dormant state (D1b-3c) - #31414

Closed
nwparker wants to merge 3 commits into
mainfrom
nwparker/wsl-mover-d1b-3c-exporter
Closed

nwparker wants to merge 3 commits into
mainfrom
nwparker/wsl-mover-d1b-3c-exporter

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​530 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​530
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​432 $\color{#cf222e}{\Huge{\mathbf{−}}}$​38 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​394

Stacked for owner review — do not merge. Behind ORCA_INTERNAL_WSL_HOSTS; nothing calls the exporter yet (the move driver stacks on this).

ELI5

When a project moves from this computer's WSL bridge into the Orca server running inside the distro, the move has to carry the project's saved state: tabs, layouts, scrollback, workspace details, history, automations and their runs. Until now only the SSH conversion could export that state. This adds the WSL version, reusing the same collectors, and keeps the SSH export byte-for-byte the same.

What Changed

  • Golden pin first (commit 1, test only): three SSH profiles (base; rich with every dormant kind; shared repo id plus legacy keys) now run through the real dormant-state collectors, and their manifest digests are pinned. They were recorded on main before any refactor and pass unchanged after it.
  • One scope, two kinds (commit 2): the dormant-state export reads its source through a scope that is either an SSH target or "host local, these projects". The SSH conversion's own steps (preflight census, subtraction) keep the SSH-only scope, so a WSL manifest reaching them still throws, as before.
    • An SSH conversion moves every row its host holds, so a host row it can't attribute counts as blocked. A WSL move takes only some of host local's projects, so the host-wide matches (worktree metadata, aliases, automation contexts, client tab ownership, the host/local partition reconciliation) apply to SSH only. A WSL move ignores other local projects instead of blocking on them.
  • The exporter (commit 3): exportWslMoveManifest(store, request) in src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts, the port the move driver calls. It:
    • picks the scoped repos and folder workspaces (local rows of that distro only; another host's row with the same id is never taken) and the project groups they sit in, with ancestors, copied;
    • collects all dormant state through the local-WSL scope, then rewrites UNC paths to the distro's Linux paths;
    • signs a manifest whose source scope equals the request exactly. It's deterministic for one store state and request, so the driver can re-export under the fence and compare digests;
    • returns blockers for anything the collectors can't carry, instead of dropping it, and throws WslMoveScopeChangedError if the plan names a project that is no longer a local row (a stale plan is replanned, not signed);
    • returns the workspaces to quiesce, their pty-session keys, the UNC→Linux worktree id map, and the automations to re-enable after commit.
  • Automations: the manifest wire only carries disabled automations (every destination validates that), so a WSL move carries them disabled and returns the ids that were enabled here. The driver re-enables them on the host after commit. No wire change.
  • New Store read: inspectOrcadMigrationSourceDormantState, the existing collector's full result rather than just its payload.

Why

The mover design requires a lossless move. Reusing the SSH collectors through the existing migration-source abstraction keeps one implementation of "what state does a project own", instead of a second one that drifts. Pinning the SSH digests through the real collectors first is what makes the refactor safe, because SSH destinations verify those bytes.

Linked Issue

N/A (internal WSL host work, tracker row D1b-3c).

Visual Proof

N/A — no UI, and nothing calls the exporter yet.

Testing

  • vitest across migrating-orcad-catalog, src/main/ssh/orcad-migration*, orcad migration, shared orcad-migration and wsl-move: 82 files / 767 tests pass locally. One unrelated localStorage census test failed once in the combined run and passes alone.
  • New golden test: the three SSH profiles' manifest digests are unchanged before vs after.
  • New exporter tests:
    • exact source scope and Linux paths;
    • determinism;
    • dormant state carried for the moved project, and none of another local project's;
    • another host's same-id row not taken;
    • blockers instead of drops;
    • a stale scope throws;
    • SSH-only steps still refuse a WSL manifest;
    • the re-enable list.
  • tsc (node), oxlint, oxfmt and the max-lines ratchet are clean for the touched files.
  • Automated tests added/updated

nwparker and others added 3 commits October 20, 2026 21:41
…urce-kind scope

A local-WSL scope lives on host local and owns only its projects, so host-wide
matches stay an SSH whole-host rule. SSH bytes are pinned by the collector golden.

Co-Authored-By: Claude <[email protected]>
…ormant state (D1b-3c)

Collects the scoped projects, their groups and every dormant-state kind through the
local-WSL export scope, rewrites UNC paths to the distro's, and returns blockers for
anything the collectors can't carry instead of dropping it. Automations move disabled,
as the wire requires, and come back as a list to re-enable on the host after commit.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fbd878b9-0975-4c16-a4bc-01cc4354c1dd
📥 Commits

Reviewing files that changed from the base of the PR and between 01562f8 and 23fff4e.

⛔ Files ignored due to path filters: 1
  • src/main/ssh/__snapshots__/orcad-migration-manifest-collector-golden.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing: 15
  • src/main/persistence/migrating-orcad-catalog/orcad-source-automation-state.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-client-state.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-dormant-state.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-export.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-left-behind-session-rows.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-scope.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-session-copy-resolution.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-session-partitions.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session-eligibility.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-worktree-metadata.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.test.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts
  • src/main/ssh/orcad-migration-manifest-collector-golden.test.ts
  • src/main/ssh/orcad-migration-manifest-export.ts
  • 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

Copy link
Copy Markdown
Contributor Author

Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept.

@nwparker nwparker closed this Oct 26, 2026
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