Repository navigation
test(e2e): layout oracle reads the live runtime layout - #27560
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to 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 |
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 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 winRemove reported frame breaches from the map.
When the same rule breach clears and recurs in a later step,
checkFramecannot record it again because this entry remains inframeBreaches. 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
📒 Files selected for processing (5)
tests/e2e/AGENTS.mdtests/e2e/helpers/workspace-layout-oracle-session.tstests/e2e/helpers/workspace-layout-oracle.tstests/e2e/workspace-layout-oracle-headless.spec.tstests/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.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 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 winRe-arm frame breaches after each step.
If a violation heals and then recurs,
checkFramecannot record the second occurrence.takeFrameBreachesleaves the first occurrence inframeBreachesas 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.tstests/e2e/helpers/workspace-layout-oracle-session.tstests/e2e/helpers/workspace-layout-oracle.tstests/e2e/workspace-layout-oracle-headless.spec.tstests/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.
| ...(['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' |
There was a problem hiding this comment.
🎯 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.
66a387c to
b6c3faa
Compare
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
layout.subscribeconsumer. 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 thesession:getIPC and headless hosts read the saved profile.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).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: ….session.tabs.listand restarts. Before, groups only a client listed were ignored, and non-terminal tabs were skipped.session:flush), so the disk-format rules check what main holds now, not a write up to 5 s old.headless-terminals:<worktree>). A dropped group or a different order still fails.platformfield 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.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 testworkspace-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
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)