Repository navigation
A pane close by its terminal handle closes only that pane, even before the window lists it (dark, layout-owner build only) - #30920
Conversation
… so a pane close stays a pane close (dark, layout-owner build only) Co-Authored-By: Claude <[email protected]>
…wn copy of the layout
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
In the test build where the main process owns the pane layout, closing one pane of a split tab by its terminal handle could close the whole tab. That happened when the window had listed the tab but not that pane yet. Now only that pane closes. Shipped builds don't change.
What Changed
Before (layout-owner build only): a tab is split into two panes. The window has listed the tab but not the new pane. A command closes one pane by its terminal handle, and both panes close along with the tab.
After: only the named pane closes. The other pane and the tab stay open.
Mechanism: #30786 made such a close work by having the main process add a list entry for the pane it holds, so the close can find it. That entry was built with a layout that holds only that one pane. The close reads the tab's listed layout first, so it took the pane for the tab's last one and turned the pane close into a tab close. Now, after adding the entry, every entry of that tab takes the main process's layout for the tab, which has both panes. So the close sees a sibling and closes just the one pane.
All of the new code sits inside the layout-owner switch branch, so the shipped build drops it.
Why
The fix sits at the same place #30786 added the entry, and it only adds the pane the handle names. That keeps the boundary in one spot.
Alternatives considered:
One trade-off: the layout written here is the main process's. Under the switch the main process writes a split before the window does, so its layout is the tab's newest. While the switch is on, this deliberately overrides the "window's list first" order noted in terminal-surface-close.ts.
Linked Issue
Blocks the layout-owner switch-on flip (#30861). Follows #30786.
Visual Proof
N/A. This affects only the layout-owner build, which is not shipped, and the change is in close logic covered by tests below.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New file
orca-runtime-terminal-close-no-widening-layout-owner.test.tsruns the whole "a close never widens" table with the switch on.New table row "cli-pty close, pane-unlisted": the window lists the tab with only the sibling and no layout. It fails without the fix and passes with it, in the switch-on run.
fix: a tab close by the handle a split returned finds the new pane (dark, layout-owner build only) #30786's close-by-split-handle tests still pass.
Full vitest suite with the switch on by default (a temporary vitest define of the switch, not committed), compared to main with the same define.
Full vitest suite with the switch off fails only in those 13 files.
Switch-off unminified main bundle compared to main, with build hashes normalised: the only change is the source commit stamp, plus asset manifest order. So the shipped build is unchanged.
Typecheck, the changed-code quality gate, oxlint, the formatting check, and the anti-slop lint all pass.
tests/e2e/terminal-tab-close-restart-persistence.spec.ts, run locally with hidden windows and 2 workers:
I also merged current main once, so CI runs this on the current base.
AI Disclosure
Review
An independent review found no blockers. Its minor points were applied: guard on the entry being present, copy the layout, skip no-op stores, and a test row that fails without the fix.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)