Skip to content

Add pure client-local native pane layout model - #1129

Merged
h0x91b merged 1 commit into
mainfrom
chore/dev3-native-terminal-client-layout
Jul 25, 2026
Merged

Add pure client-local native pane layout model#1129
h0x91b merged 1 commit into
mainfrom
chore/dev3-native-terminal-client-layout

Conversation

@h0x91b

@h0x91b h0x91b commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Hi, this is Claude (the AI assistant working on this branch).

Small independent prerequisite for LAY-005 on the tmux-removal roadmap (parent Seq 1141). Adds a standalone, pure, import-free state model for a future native multi-pane terminal, without touching the renderer, terminal host, registry, the Seq 1254 adapter, SplitTree, or tmux.

What

New module src/shared/native-terminal-client-layout/:

  • Models each client's view of the shared, ordered pane set plus its own client-local focus and optional zoom ({ paneIds, focusedPaneId, zoomedPaneId }).
  • reconcileClientPaneLayout folds a fresh observation of the shared pane set into a client's state deterministically: a still-present focus/zoom is kept; a removed zoom target clears zoom; an invalid/missing focus falls back to the nearest surviving pane (next in the old order, else previous, else first); an empty set has null focus. Invariant focus === null ⇔ no panes, verified by validateClientPaneLayout.
  • Focus and zoom are orthogonal overlays; every function is pure, immutable, and returns the same reference on a no-op.

Why it's safe

  • No runtime side effects, no imports, and no PTY dimension anywhere in the module — proven structurally (state has exactly three keys) and by a source sentinel test that rejects imports and pty/cols/rows/resize/dimensions tokens.
  • Local focus/zoom mutations keep the shared pane-list reference identical (result.paneIds === layout.paneIds) and never mutate the caller's inputs.
  • Two clients reconcile independently over the same shared pane set (observer isolation).

Tests & docs

  • 34 deterministic unit tests in src/mainview/__tests__/native-terminal-client-layout.test.ts (mirroring the split-tree test placement) covering 0/1/2/6 panes, focused-pane removal, zoomed-pane removal, reorder, and observer isolation.
  • Decision record decisions/164-client-local-native-pane-overlay.md documents the orthogonal-overlay invariant and the deterministic neighbor fallback.
  • No visible behavior change.

@h0x91b
h0x91b enabled auto-merge (squash) July 25, 2026 07:38
@h0x91b
h0x91b merged commit 8cea6cd into main Jul 25, 2026
9 checks passed
@h0x91b
h0x91b deleted the chore/dev3-native-terminal-client-layout branch July 25, 2026 07:39
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