Repository navigation
refactor(layout): build today's store slices from layout frames (inert) - #29181
Conversation
Adds the phase E2a frame applier: published layout frames plus content facts plus the window's view become today's tab, terminal, editor and browser slices, through the shared Serializer and the window's own restore builders. Nothing calls it yet. Publishes the fields the window needs to rebuild those records (terminal launch inputs, browser tab label and creation time, editor file owner) and extracts the pure parts of editor, browser and terminal restore. An equivalence test compares the result with today's startup restore for every stored profile.
…ly where restore does
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
# Conflicts: # config/main-layout-writer-baseline.txt
ELI5
Today the window rebuilds its tabs at startup by reading the saved session file. Later in this refactor, the main process will tell the window what tabs exist, and the window will draw from that message instead. This PR adds the piece that turns main's message into the exact data the window's tab bars, terminals, editors and browser tabs already read. Nothing uses it yet; a test proves it gives the same result as today's startup.
What Changed
buildLayoutFrameSlices(src/renderer/src/store/workspace-layout-frame-slices.ts). Input: each workspace's layout as main publishes it, the content facts kept beside the layout (titles, scrollback, page state), and this window's own selection. Output: today's store data for tabs, groups, terminal rows and panes, open files, browser tabs, and each workspace's selected tab. The window's global selection (active workspace and tab) stays the window's own; remote-server workspaces stay on today's mirror path.startup-window-frame-parity.test.ts. For every stored profile (local git worktree, folder workspace, floating terminal, SSH host, remote server, every legacy shape, plus editor files owned by an SSH host and by a server, and tab groups with no selected tab in a terminal workspace and an editor-only one), the slices built from main's published layout must equal the slices today's startup restores, field by field, apart from a short listed set. What the user sees must differ only as the existing Loader parity test already lists. The parity difference tables moved unchanged into a shared fixture.No user-visible change.
Why
The plan's switch step (setting the window's tabs from main's messages) needs this conversion, and it must not change what users see. Building it first, unused, with an equivalence test, separates "is the conversion right" from "is the switch safe". Reusing the shared save code and the window's own restore builders, instead of writing a new converter, means no second copy of the restore rules. Writing a direct converter was the alternative; it would have duplicated the restore's sorting, de-duplication and file-id rules.
Differences the test found and lists:
Not produced from main's layout (they stay main's records and today's restore until the switch moves them): sleeping agent records, closed-tab records, default-tab marks, and which terminal a tab reattaches at startup.
Linked Issue
N/A (internal refactor step)
Visual Proof
N/A: nothing calls the new code; no UI or behaviour change.
Testing
pnpm tc, oxlint,pnpm run check:code-quality:changed; vitest oversrc/renderer/src/store,src/renderer/src/app-shell,src/shared/workspace-layout,src/renderer/src/runtime,src/renderer/src/liband the layout stream test. Checked the test is not vacuous by removing the new published fields: three cases fail.AI Disclosure
Review
Fresh review and a delta review after fixes: approve.
Agent skill upstream boundary
Notes
Security, platforms, SSH, mobile, compatibility, performance: no runtime path changes. The new published fields are optional additions; this applier only ever reads the window's own main process.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)