Repository navigation
test(e2e): layout oracle scenarios with window, headless serve and SSH - #26674
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:session:getchannel; for a windowless serve, its saved profile) against the rules from #26673; breaks seen only while settling are recorded as "transient"data-pty-id), against mainsession.tabs.list) and the CLI (terminal.list) are told, against main, including renamed titles and terminals running with no paneechosent to each visible pane's terminal must show up in that pane (frozen or crossed panes)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:
workspace-layout-oracle.spec.ts(window attached, 20): new tab, split, close pane, close tab, swap panes, a paired client reordering tabs, drag a pane out (STA-9259) with two restarts, CLI split, CLI create/rename/close, paired-client create/move-to-new-group/close, restart, cold daemon restart, in-app daemon restart, folder workspace, STA-9417's setup split, sleep/quit/resume.workspace-layout-oracle-latency.spec.ts: command-to-drawn-update p50/p95, idle and while another tab floods output withyes. Measuring only, no pass/fail.workspace-layout-oracle-headless.spec.ts(no window, both orcad and Electron serve, 6 each): the serve issues [Bug]: orca serve omits older Desktop-created terminals from session.tabs.list when a worktree has serve- tabs #23429, orca-serve: terminal tab rename does not survive browser reload #19582, CLIterminal closecan never close a background tab that failed reveal — headless close path throwstab_not_foundfor tabs that were never persisted #10747, [Bug]: Remote Orca server tabs drift out of sync with desktop/mobile clients (extra tabs, closed tabs reappear on mobile) #25794, [Bug][Remote Orca Server] Tabs Sync/PTY totally bogged #9450, plus split/close with warm and cold restarts. Renderer and runtime disagree on which partition owns SSH worktree session state #12723 needs SSH; [Architecture / RFC]: Tab, Terminal & PTY Lifecycle Stabilization across Local, Remote & Cloud Runtimes #21556 is the tracking RFC.workspace-layout-oracle-ssh.spec.ts(Docker SSH host, added to the Docker SSH lane): remote tab, split, close, relaunch and reconnect.workspace-layout-oracle-known-on-main.ts: what main still fails, each with its cause. Anything not listed fails the test, so a rework PR removes entries as it fixes them and cannot add new failures.config/scripts/check-workspace-layout-rules.mjs <userDataDir>runs the rules over any profile, including a running dev app's.helpers/terminal-layout-journeys.tsand ported the setup-split and sleep journeys from the closed core branch (test code only). Documented intests/e2e/AGENTS.md.What it finds on main
terminal.listreports the title as null after restart; Electron serve keeps itNo 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:
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:
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.
Notes
Test-only. SSH is covered through the Docker SSH lane; mobile through the paired-client RPC the phone uses.
Checklist
N/Afor visuals with reasonpnpm typecheckpasses locally