Skip to content

test(e2e): layout oracle scenarios with window, headless serve and SSH - #26674

Merged
Jinwoo-H merged 10 commits into
mainfrom
layout-oracle-scenarios
Oct 9, 2026
Merged

Jinwoo-H merged 10 commits into
mainfrom
layout-oracle-scenarios

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3240 $\color{#cf222e}{\Huge{\mathbf{−}}}$​106 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3134
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74

ELI5

This adds scripted end-to-end checks that drive the real app (and a windowless orca serve, and an SSH host) through tab and pane actions, and after every step decide on their own whether the layout is right. Run against today's main, they catch the known bugs, so later rework PRs can be judged by "nothing new breaks" instead of by review rounds. Test code only.

Stacked on #26673 (the rules check).

What Changed

After every scenario step, LayoutOracle (tests/e2e/helpers/workspace-layout-oracle.ts) waits up to 12 s for things to settle and then records which checks fail:

Check Compares
rules the main process's layout (read through the existing read-only session:get channel; for a windowless serve, its saved profile) against the rules from #26673; breaks seen only while settling are recorded as "transient"
view what the window draws, read from the DOM (tab strips, terminal surfaces, each pane's data-pty-id), against main
client what a paired client (session.tabs.list) and the CLI (terminal.list) are told, against main, including renamed titles and terminals running with no pane
expected the panes per tab the step should produce, which panes it removes, and that every other pane still shows the terminal it showed before (catches a command applied to the wrong pane, or lost); an empty layout cannot pass
restart the layout after a relaunch, a relaunch with the terminal daemon killed, or the in-app daemon restart, against before
marker an echo sent to each visible pane's terminal must show up in that pane (frozen or crossed panes)
remount terminal views (xterm instances) are counted per pane in the window; one created again outside a relaunch, reload or daemon restart fails

Between steps a sampler runs the rules every 100 ms, so a breach that heals before the step settles is still recorded (as transient). Main has no hook that reports every layout write to a running app without a production change, so in the app this is sampling; the unit model test in #26673 checks every write exactly.

Scenarios:

What it finds on main

Scenario Result on main Caught by
STA-9417 setup split fails 18/18 runs view, client, marker 18/18; rules (one terminal in two panes, pane id changed) 12/18; the other 6 runs leave the setup terminal with no pane
In-app daemon restart fails 3/3 main drops the worktree's tabs while the window keeps them (view, expected); after the next relaunch the split is gone, 1 pane instead of 2 (expected, restart)
Cold daemon restart fails 3/3 paired client's tab list stays empty while the window and CLI show 3 panes (client); tab rows reordered (rules)
Sleep, quit, wake fails 3/3 the woken worktree has no tab bar in main until the window saves again (rules, view, client, restart)
Paired client reorders tabs fails 3/3 tab bar order and tab row order disagree (rules)
Headless, any close (both hosts) fails 3/3 serve saves only tab rows, then a close saves a tab bar missing the open tabs (rules)
Headless #19582 rename + restart (orcad) fails 3/3 terminal.list reports the title as null after restart; Electron serve keeps it
Every tab-creating scenario transient main saves the tab row before the window saves the tab bar (rules, transient)
Other window scenarios (including host navigation, window reload, quit right after a split, old phone pane tree with the window open), headless #23429/#10747/#25794/#9450, SSH pass —

No unexpected terminal-view recreation was seen in any scenario. The counter was checked on its own: two xterm creations in one pane count as two.

Latency on an M-series Mac, 10 samples each, in ms (p50 / p95). Each number includes one CDP round trip:

Action Idle Another tab flooding output
split (window) 53 / 71 62 / 71
close pane (keyboard) 785 / 963 854 / 1468
new tab (CLI) 41 / 64 43 / 61
rename (CLI) 20 / 26 22 / 31
tab reorder (phone) 13 / 18 16 / 16
close tab (CLI) 2263 / 2314 2288 / 2302

The close-pane and close-tab numbers are not broken down yet. They include the keyboard helper's focus step and the close's wait for the shell to exit.

Reverted-fix proof: with #25380 reverted, drag-out shows a pane in two tabs (rules, transient) 3/3; the unit-level reverts are in #26673.

Why

The plan for the layout rework requires automatic checks proven on main before any rework code. Reading the window's DOM (not its store) for the view check keeps the check meaningful once the window becomes a view of main. Settling before recording avoids failing on normal lag; recording breaks seen while settling keeps short-lived duplicates visible.

Linked Issue

Part of the workspace tab layout rework (STA-9417, STA-9259).

Visual Proof

N/A: test code only, no UI or behavior change.

Testing

All on macOS, background launches, hidden windows:

  • Window spec: 3 consecutive full runs after the review additions, 20/20 pass each (with the known-on-main list applied), about 5 min per run. Before the additions: 3 runs, 16/16.
  • Headless spec: 3 runs, 12/12 pass, about 4.5 min each, run in parallel with the window spec.
  • SSH spec: 3 runs, pass, about 16 s each.
  • Latency spec: 1 run, about 1 min.
  • STA-9417 scenario repeated 18 times.
  • Parity spec scenarios still pass after the helper move.
  • pnpm tc, pnpm run check:code-quality:changed, oxlint, oxfmt.

The new specs run in the normal e2e lane (changed specs on PRs, the full suite elsewhere), which does not block merges today. Making them a required gate for rework PRs is a follow-up once they have a CI track record. Not run on Linux or Windows yet.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Notes

Test-only. SSH is covered through the Docker SSH lane; mobile through the paired-client RPC the phone uses.

Checklist

  • This PR is small and focused (one oracle; scenarios share it)
  • I explained what changed and why
  • N/A for visuals with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm typecheck passes locally

…al rules

A pure rules check over the runtime's session partitions: a terminal in two
panes, a pane in two tabs, a tab outside exactly one group, tab rows and tab
bar disagreeing, two tab orders, and ids changing for the same pane, tab or
group across an update. Wired into the seeded layout model test after every
step, plus late-spawn cases (one known on main, kept as an expected failure).
Drives layout journeys through window gestures, CLI and paired-client runtime
commands, and after every step checks the runtime's layout against the
structural rules, the window's DOM, the paired-client and CLI views, the
expected end layout, restarts (relaunch, cold daemon, in-app daemon restart)
and per-pane terminal markers. Findings main still has are listed with their
cause; anything else fails. Includes headless orcad/Electron serve scenarios
for the serve issues and a Docker SSH scenario.
…mands with the window

The layout model now checks the structural rules on every in-memory
workspace-session write, not only at each step's end, naming the writer
of any breach. Three documented two-writer transients (main mints a tab
row before the window writes its tab bar) are allow-listed by rule, op
and writer; they must still heal by the step's end.

New model ops race a stale window save against a paired client's tab
close, a host-created split, and main's PTY-exit retirement. A new file
runs main's updateMobileSessionPaneLayout (old phone pane trees) against
the real Store; the case with no topology revision is an it.fails: main
drops a live pane and its binding there.
…ts, more scenarios, latency

Every step checks the expected panes, which panes went away and that the rest
kept their terminals; a 100 ms sampler runs the rules between steps; xterm
creations are counted per pane and an unexpected recreation fails. Adds host
navigation, window reload (graph republication), quit right after a change
(quit-time save), an old client's stale pane tree, and a latency measurement
(command to drawn update, idle and under an output flood; no pass/fail).
…c, short socket dir

Adds an SSH folder-workspace (no repo) scenario that checks the layout lives in
one partition across relaunch; registers the SSH oracle spec in the Docker SSH
lane's selection lists; headless hosts put long-TMPDIR profiles under ~/.orca-lo
instead of /tmp.
… Linux relaunch findings

The headless oracle spec needs out/orcad, which only the orca serve mode-switch
job builds, so it runs there (and fails rather than skips in CI if orcad is
missing). Records what the first Linux CI run found on main: after a relaunch
main can hold tab rows with no tab bar past the settle wait, and Electron serve
on Linux also lists a renamed terminal's title as null after a restart.
…nership gap

Linux CI saw terminal.list answer terminal_surface_ownership_unavailable while
the window re-published its terminals; reads retry for up to 10 s, commands do not.
@Jinwoo-H
Jinwoo-H changed the base branch from layout-oracle-rules to main October 9, 2026 01:17
@Jinwoo-H
Jinwoo-H merged commit 7f0e067 into main Oct 9, 2026
42 checks passed
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