Repository navigation
feat(wsl-mover): mark the desktop rewrite registry complete, with a coverage proof and stale-window re-apply (D1b-7f-2) - #31957
Closed
nwparker wants to merge 5 commits into
Conversation
…load re-apply (D1b-7f-2)
… layout writer (D1b-7f-2)
…d; behavioural coverage proof (D1b-7f-2 review)
7 of 9 tasks
…e registry complete (D1b-7f-2)
8 of 9 tasks
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Moving WSL projects onto the WSL host has a last step: rewriting this computer's own records (sidebar order, focus, saved tabs, history, browser logins and so on) so they point at the host. Until every one of those rewriters existed, the move was held at that last step on purpose: it never finished, and you could never move the same distro again. All of them now exist, so this PR lets the move finish. Everything stays behind the internal
ORCA_INTERNAL_WSL_HOSTSgate, which is off for everyone.What Changed
Before (gate on): a move copied everything to the host and switched over. Its journal then stayed at
destination-committedforever, becauseWSL_MOVE_DESKTOP_REWRITE_REGISTRY_COMPLETEwasfalse. A second move of that distro was refused with "A move of is still finishing."After (gate on): the move goes
destination-committed→client-rewritten→retained, and a later move of the distro is accepted once the earlier one is retained. Gate off: nothing changes.How it works:
true(wsl-move-desktop-rewrite-stores.ts). The journal and the rewrite driver still refuseclient-rewrittenuntil every registered store has a ledger entry.registerWslMoveDesktopRewriteRegistry. Startup calls it once, after the fence and before the first rewrite pass. It registers the stores in run order: ui-routing, session-globals and host-session-seed (7c); orchestration-history (7e); the three renderer localStorage stores (7d); host-automations (driver); and browser-cookies (7f), which is last.wsl-move-rewrite-store-coverage.test.ts. It has no allowlist or skip list, and it checks four things:rewrite-desktoporrewriteDesktopCopymaps to a store id;ui.automationHostFilterwas marked as a rewrite, but nothing rewrote it. It is single-select, so a filter set to "this desktop" would hide every automation the move carried. ui-routing now widens that filter to All hosts, once, and only if the move carried automations.ui.trustedOrcaHooksbecomesnot-applicable. It is keyed by repo id, which the move keeps. The 7d prune guard (wsl-moved-repo-ui-retention.ts) still protects it.persisted.remoteLayoutSnapshotsbecomesrederive. It is a display-only cache whose one reader has no caller. The recorder rebuilds it from the host's first tab stream, and first paint comes from the seededworkspaceSessionsByHostId.wsl-move-stale-window-reapply.ts). The window that was open during the move hydrated before the rewrite, so until it reloads it can write the old focus back.ui.lastActiveWorktreeIdand the local session's active worktree, key and host. It only ever redirects a moved local project to the host, so it can't override a later choice.Shared paths this touches:
main-process-ready-foundation.ts, which registers the stores and passes the recovery and re-apply steps torunWslMoveStartupRewrite.renderer-shutdown-checkpoint.tsgains an optionalafterStagehook, wired throughapp.tsandregister-core-handlers.ts. With the gate closed the hook returns immediately.Why
Linked Issue
Internal WSL mover stack (D1b-7f-2), stacked on #31429.
Visual Proof
N/A. No visible change: everything is behind the internal gate, which is off by default. With it on, the one visible difference is that a second move of a distro is no longer refused once the first is retained, and the unit tests cover that.
Testing
New tests:
wsl-move-registry-complete.test.ts(real SQLite, listed invitest-sqlite-runtime-files.mjs). It runs against the real registry and profile store:destination-committed→client-rewritten→retained, with each store in the ledger exactly once;client-rewrittenandretained) survives a restart and is corrected at startup, idempotently, with the journal unchanged;wsl-move-rewrite-store-coverage.test.ts(the proof),wsl-move-automation-filter-rewrite.test.ts, and anafterStageordering test inrenderer-shutdown-checkpoint.test.ts.client-rewritten.pnpm tc,pnpm teston the moving-wsl-projects, shared/wsl-move, renderer-shutdown-checkpoint, app, register-core-handlers and automation-wsl-move-refusal suites,pnpm run check:code-quality:changed, and the layout-writer, focus-read and other ratchets. No baseline changed: the re-apply reuses the existing session-globals and host-session-seed write call sites.AI Disclosure
Review
An adversarial review focused on store coverage, ledger duplication and startup ordering found no HIGH issues. Its two MEDIUM findings are fixed:
Open LOWs:
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)