Repository navigation
fix(layout): close the dark layout path's gaps, and refuse to package it - #29207
Conversation
… through main behind ORCA_LAYOUT_OWNER A build made with ORCA_LAYOUT_OWNER=main registers layout.apply: main applies the window's layout command to the stored partition through the shared applyLayoutCommand, minting new ids. A user split then waits for main's answer and mounts the pane id main minted. Every other build substitutes 'window', so neither branch is compiled in.
A load-then-save rewrite also normalizes records the command never touched. The command's effect is now the diff between the save before and after it, written onto the stored partition record by record. A split whose main reply says a paired server holds the tab splits as today.
…d partitions reload to the command's result
…CA_LAYOUT_OWNER In a layout-owner build the window's pane close, title change and equalize go through layout.apply and the window shows main's answer. A window pane close keeps the legacy close's rules: the tab's last pane is refused, a pane restarted since main read the close is left alone, every partition holding the tab closes it, and the tab's remote session id follows the remaining pane. The rules sit behind a command field only layout.apply sets.
…ORCA_LAYOUT_OWNER Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…e drops main cannot take Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…oday Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…de-up profile state Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…row names a paired server The split switch point asked which host to route to with a helper that falls back to the focused server, so a focused server could claim a workspace whose row names no owner. Use the same owner test the tab mirror uses.
…yout/c1b-pane-ops # Conflicts: # src/renderer/src/components/terminal-pane/terminal-pane-split-through-layout-owner.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-through-layout-owner.ts
…/c1b2-pane-gestures
…ed or failed splits and moves, ratios during a move, release guard - A pane main saved but the window could not mount (source pane or manager gone during the await) is closed again in main, so it does not come back on restart. - A split main refuses because its copy lacks the workspace, tab or pane, or a failed call, splits as today; a refused or failed move moves as today. - Divider ratios committed while a move is in flight wait for the window's move, then go to main. - The orcad bundle gets the ORCA_LAYOUT_OWNER define when the switch is on. - Packaging and the orcad template refuse ORCA_LAYOUT_OWNER=main and any output a dark build marked. - workspace-layout-record-patch.ts: no non-null assertions; plain comment for the map depth.
…throws, not just for splits - sendPaneCommandToLayoutOwner runs asToday for workspace/tab/pane_not_found and a thrown call, so close, rename and equalize fall back like split and move; a handler that throws no longer runs the fallback too. - A close main refuses as its last pane, while this window still has others, closes as today. - A move whose local step throws still releases held divider ratios. - Drop the orcad output marker: nothing read it; the template build refuses the switch itself.
# Conflicts: # src/main/persistence/loading-store/pty-binding-persistence.ts # src/main/persistence/terminal-topology/terminal-layout-apply.test.ts # src/main/persistence/terminal-topology/terminal-pane-admission.ts # src/main/runtime/orca-runtime.ts # src/main/runtime/rpc/methods/workspace-layout-apply.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts # src/shared/rpc-contract/workspace-layout-params.ts # src/shared/workspace-layout/workspace-layout-record-patch.test.ts # src/shared/workspace-layout/workspace-layout-record-patch.ts
… layout-owner files
…1b2-pane-gestures
…1c-dark-followups
…e checkout fixture
…wups # Conflicts: # src/renderer/src/components/terminal-pane/layout-owner-pane-close.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-commands.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-commands.ts # src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-gestures.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-gestures.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts # src/renderer/src/components/terminal-pane/use-terminal-pane-close-actions.ts
…three build files
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
This fills the gaps an independent review found in the new, unshipped way of laying out terminal panes (#29185, #29187, #29192). In that build, the window asks the background process before it splits, closes, moves or resizes a pane. This PR covers the cases where that request can't finish normally: the background process doesn't have the pane yet, the call fails, or the window loses the pane while it waits. In all of them the window now ends up in a sensible state. It also makes sure that build can never be packaged as a release. Builds made the normal way are unchanged.
What Changed
Stacked on #29192. Everything below applies only to a build made with
ORCA_LAYOUT_OWNER=main, except the release guard.sendPaneCommandToLayoutOwner. A close the background process refuses as its last pane, while the window still has other panes, also closes as today. A handler that throws no longer triggers the fallback as well.orcadbundle now gets theORCA_LAYOUT_OWNERvalue when the switch is on. Before, a switched-on server always ran with the switch off.beforePack) and the orcad template build now fail ifORCA_LAYOUT_OWNER=mainis set. Packaging also fails ifout/mainholds a marker file, which a switched-on main build leaves behind (config/layout-owner-build.cjs).workspace-layout-record-patch.ts. The two!assertions are gone, and the unclear "Why 2:" comment is replaced with a plain one.Why
runDurableMutation), so the only pane that can be stranded is one the window received but could not mount, and the window knows that pane's id.Linked Issue
Internal layout refactor, phase C1 follow-up (no public issue).
Visual Proof
N/A. No shipped build changes behaviour. With the switch off, the built bundles match #29192's except for the record-patch tidy-up, which only the switched-on path reaches (see Testing).
Testing
I manually tested these changes locally
Automated tests added/updated
A split whose source pane or manager is gone when the answer arrives closes the minted pane in main. A split that mounts sends nothing more.
For split, close, rename, equalize and move: the window acts as today when main lacks the workspace, tab or pane, and when the call throws. A throwing handler does not run the fallback.
A close refused as the last pane closes the tab when the window has one pane, closes the pane as today when it has more, and does nothing when the tab is not mounted.
Divider sizes are held until two moves in flight have both settled, including one whose local move threw.
The release guard refuses the switch and a marked
out/main. ThebeforePacktest runs with the switch on.Switch off, built bundles (
build:electron-viteand the three orcad entry bundles, at feat(layout): move panes and save divider sizes through main behind ORCA_LAYOUT_OWNER #29192's head and this head, build commit normalized): the renderer (1,374 files) and preload are byte-identical.out/main/index.jsandorcad-server.jsdiffer only in the two record-patch lines (queue.shift() ?? record, and the loop ininsertionIndex). That code runs only fromlayout.apply, which is registered only with the switch on.orcad-launcher.jsdiffers only in the server's sha256 that it embeds. With the switch on, the orcad server bundle has no unresolvedORCA_LAYOUT_OWNERread left.Checks run: the static-analysis job's steps locally (oxlint, anti-slop, code-quality gates, ratchets, RPC catalog,
pnpm tc), plus the terminal-pane, record-patch,layout.applyand packaging-config tests.