Skip to content

test(e2e): layout oracle reads the live runtime layout - #27560

Merged
Jinwoo-H merged 5 commits into
mainfrom
layout-p1-oracle-live
Oct 11, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
layout-p1-oracle-live

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​620 $\color{#cf222e}{\Huge{\mathbf{−}}}$​316 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​304
Prod 0 0 0 0

ELI5

The layout checker used to look at a copy of the tab layout: the window's in-memory session for the windowed app, and the saved profile file for a headless server. It looked at that copy every few hundred milliseconds. Now it subscribes to the live layout feed the app already serves and checks every update it publishes. It still reads the saved file once each step settles, to check what was written to disk. Test-only; nothing users run changes.

What Changed

  • Live source. The oracle's runtime layout now comes from a layout.subscribe consumer. The window opens it in its renderer through the local runtime bridge and forwards each frame to the test. A headless host (orcad or Electron serve) is subscribed over its pairing offer, and the subscription is reopened after each serve restart. Before, the window read the session:get IPC and headless hosts read the saved profile.
  • Every frame. The model rules (workspace-layout-model-rules.ts) run on every published frame. This replaces the 100 ms rule sampler and the rule reads inside the 300 ms settle loop. A breach that heals before the step settles is still reported as (transient).
  • Saved profile at each settled step. The disk-format rules (workspace-layout-rules.ts) and the round-trip check now run on the saved profile, so saves are still checked. Their lines read <rule>: saved profile: ….
  • Exact comparison. Every group's tab order, and every tab of every kind (terminal, editor, browser, agent), is compared exactly against the window's drawing, session.tabs.list and restarts. Before, groups only a client listed were ignored, and non-terminal tabs were skipped.
  • Settle wait. Views have no change events, so a step still re-reads them every 300 ms. It settles when they agree with the live layout and no frame arrived across two gaps between reads, counting frames that land during the sleep. Differences the known-on-main list covers don't hold the wait, since they never converge. The 12 s limit is unchanged.
  • Saved profile is current. Before reading the saved profile, the window flushes main's debounced save (session:flush), so the disk-format rules check what main holds now, not a write up to 5 s old.
  • Renamed groups. A client group listed under a different id from the runtime group holding the same tabs in the same order is reported as one "group id differs" line. Only that line is known on main (headless lists headless-terminals:<worktree>). A dropped group or a different order still fails.
  • Known-on-main list. Refilled from runs on main's code: Linux CI run https://github.com/stablyai/orca/actions/runs/38170663248 (every scenario recorded three times, on a temporary branch with the oracle files only, since deleted) plus local macOS runs. Every entry was reproduced by at least one of them. An entry reproduced on one OS only carries a platform field and matches only on that OS: setup-split (STA-9417) rules/expected on macOS; the cold-/live-daemon relaunch and Electron rename entries on Linux.
    • Removed: transient disk-format entries, since those breaches are no longer sampled; the "two writers" entry, gone once saves are flushed; the cold-relaunch row-order entry, since panes per tab now follow the published tab order, not row order.
    • Kept or re-added: client-reorder tab order, cold-relaunch client list, live-daemon, sleep-wake, headless move-tab entries.
    • Added: cold- and live-daemon relaunch tab-bar re-mint (Linux), rename-after-restart for orcad (macOS) and Electron serve (Linux), headless group rename.

Model rules mostly cannot fire on main yet. Main's feed is a projection of the saved-format session that already drops ungrouped tabs and stray pane data. They start to bite when the layout holder lands.

Why

This is the PR 6 plan's P1, written so the oracle can later gate the switch. Reading the live feed checks what clients will actually receive, and checking every frame catches breaches a poll misses. Rebuilding a saved document from a frame would mean inventing fields the frame doesn't carry. So the disk-format rules read the real saved profile instead.

Linked Issue

N/A (maintainer; plan item P1)

Visual Proof

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

Testing

Local macOS, ORCA_BACKGROUND_LAUNCH=1, window and headless oracle specs (20 window scenarios + 9 × orcad/Electron serve):

  • This branch, final head (macOS): 38 passed (8.6 min).

  • origin/main (73c53311dc0) with its own oracle: 38 passed (9.7 min).

  • Linux CI recording run above: both jobs green, every scenario three times.

  • pnpm tc, check:code-quality:changed, oxlint, oxfmt, new unit test workspace-layout-oracle-feed.unit.test.ts.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Subscribing turns on main's layout stream, which recomputes every workspace on each write, in e2e runs only. SSH and folder workspaces: the partition of a published workspace comes from its terminal tabs' host, and the folder-workspace scenario passes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c6551063-12d9-4ff8-bf37-c89fd1d76ae4

📥 Commits

Reviewing files that changed from the base of the PR and between 66a387c5e7518307f4d2c1a0cd1c99b4cf426f1d and b6c3faa.


📒 Files selected for processing (2)
  • tests/e2e/helpers/workspace-layout-oracle-session.ts
  • tests/e2e/workspace-layout-oracle-headless.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

The e2e layout oracle now checks the runtime’s published layout stream and saved profile data as separate inputs. It compares drawn and client views against live layouts, checks layout rules at settled steps, and records transient frame-level breaches. Window and headless scenarios reconnect layout subscriptions after reloads and host restarts.


Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to b6c3f

The oracle can still miss recurring transient layout breaches and classify unrelated cold-relaunch findings as known. Resolve those test-detection gaps before merging unless the reduced coverage is explicitly accepted.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description follows the required template and explains the live layout feed, saved-profile checks, rationale, testing, visual-proof exception, and compatibility considerations. The unchecked full …
Title check Passed The title clearly and concisely identifies the main change: the end-to-end layout oracle now reads the live runtime layout.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR




  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Remove reported frame breaches from the map. · workspace-layout-oracle.ts:153-155

tests/e2e/helpers/workspace-layout-oracle.ts:153-155
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove reported frame breaches from the map.

When the same rule breach clears and recurs in a later step, checkFrame cannot record it again because this entry remains in frameBreaches. The later transient report then omits the breach. Delete each entry after taking it so a later frame can record a new occurrence. As per coding guidelines, the oracle records frame-level findings at each step.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d60eba43-5374-460c-b996-6372d79255c2
📥 Commits

Reviewing files that changed from the base of the PR and between f5a95b3 and 6106240.

📒 Files selected for processing (5)
  • tests/e2e/AGENTS.md
  • tests/e2e/helpers/workspace-layout-oracle-session.ts
  • tests/e2e/helpers/workspace-layout-oracle.ts
  • tests/e2e/workspace-layout-oracle-headless.spec.ts
  • tests/e2e/workspace-layout-oracle-known-on-main.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/AGENTS.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Re-arm frame breaches after each step. · workspace-layout-oracle.ts:254

tests/e2e/helpers/workspace-layout-oracle.ts:254
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Re-arm frame breaches after each step.

If a violation heals and then recurs, checkFrame cannot record the second occurrence. takeFrameBreaches leaves the first occurrence in frameBreaches as reported. A breach covered by a known-on-main entry at its first step can therefore go undetected at a later step. Remove consumed lines from the map so each step can report a new occurrence.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0541eadc-8ff6-4e12-9cf6-8a7eebc59f95
📥 Commits

Reviewing files that changed from the base of the PR and between 6106240 and 13f1873f59d6b979a4bd117c0c01aeaf75d5ca4f.

📒 Files selected for processing (5)
  • tests/e2e/helpers/workspace-layout-oracle-compare.ts
  • tests/e2e/helpers/workspace-layout-oracle-session.ts
  • tests/e2e/helpers/workspace-layout-oracle.ts
  • tests/e2e/workspace-layout-oracle-headless.spec.ts
  • tests/e2e/workspace-layout-oracle-known-on-main.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment on lines +41 to +45
...(['rules', 'view'] as const).map((check) => ({
scenario: 'cold-daemon-restart',
check: 'expected',
check,
step: 'after cold relaunch',
detail: /: panes per tab \[1,2\], expected \[2,1\]$/,
cause: 'one tab order'
},
// After a cold relaunch the paired-client tab list stays empty while the window shows the tabs.
cause: 'tab bar not saved after relaunch'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Limit the cold-relaunch exceptions to the known tab-bar failure.

If a different model rule fails after cold relaunch, this entry also classifies it as known-on-main. The new client exception at Lines 33–37 has the same scope problem. Add rule or detail filters that match the observed failure, so unrelated breaches remain unexpected.

The oracle now reads the runtime's layout from a layout.subscribe consumer
(the window's renderer, or a headless host's pairing offer) instead of
session:get or the saved profile. Model rules run on every published frame,
replacing the 300 ms settle read and the 100 ms rule sampler; disk-format
rules and the round trip run on the saved profile at each settled step.
Views are compared to the live layout exactly for every group and tab kind.
The known-on-main list is refilled from runs of this oracle on main.
…wait

A difference main is known to keep never converges, so a step settles once
only known-on-main differences remain. The orcad title-after-restart entry
is narrowed to the scenario a run on main reproduced.
…roups, flushes saves

The settle wait carries the frame count across reads, so a frame during the
sleep restarts the quiet window. The client check pairs a group listed under
another id with the runtime group holding the same tabs in the same order,
so only that rename is known on main and a dropped group still fails. The
window flushes main's debounced save before the saved-profile read.
…main

Removes the two-writers saved-profile entry (gone once the window flushes
main's save). Re-adds client-reorder tab order and the cold-relaunch client
list, and adds the cold- and live-daemon relaunch tab-bar entries and the
Electron rename-after-restart entry, each reproduced by Linux CI run
38170663248 or a local run on main's code.
Entries reproduced on one OS only carry a platform and match only there.
The cold-relaunch restart entry now matches only a single group whose tabs
and order are unchanged, so a reorder still fails.
@Jinwoo-H
Jinwoo-H force-pushed the layout-p1-oracle-live branch from 66a387c to b6c3faa Compare October 11, 2026 21:10
@Jinwoo-H
Jinwoo-H merged commit 8e01e6d into main Oct 11, 2026
37 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