Repository navigation
Conversation
[Low impact] The changes reach test execution, not app runtime behavior. The PR appears safe to merge, with two non-blocking gaps in what the new E2E tests prove. FindingsSummaryAdds unit and paired-client tests for server-created and server-closed tabs, plus switch-on CI wiring.
Reviews (1) · Last reviewed commit: "test(layout-owner): add C3/C4 paired ser..." · Reviewed by Greptile |
| await host.client.call('layout.apply', { | ||
| command: { | ||
| type: 'createTerminalTab', | ||
| workspace: worktreeId, | ||
| tabId: midStartId, | ||
| leafId: randomUUID() | ||
| } | ||
| }) | ||
| await host.client.call('layout.apply', { | ||
| command: { type: 'closeTabs', workspace: worktreeId, tabIds: [midStartId] } | ||
| }) |
There was a problem hiding this comment.
Mid-start case may never start
This step creates a tab and immediately closes it without checking that the desktop saw it or began a start. If the desktop receives only the final empty layout, every assertion passes without testing cleanup during a start.
Wait for the tab’s starting state before closing it. Make this a separate test so an earlier failure cannot skip it.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| // Mount every tab on both desktops so closing tests real binding retirement on both sides. | ||
| for (const webId of [tabFromA, tabFromB, tabFromPhone]) { | ||
| await openTab(desktopA, worktreeId, webId) | ||
| await openTab(desktopB, worktreeId, webId) | ||
| } |
There was a problem hiding this comment.
Binding cleanup can pass unchecked
This loop says it establishes live bindings on both desktops, but openTab only waits for a pane manager to exist. That manager is registered before the pane layout is restored. The final absence check can therefore pass without proving that each desktop ever held a PTY binding for the closed tabs.
Wait for expectPanesBoundToHandles on both desktops before closing them.
7d04443
into
layout-owner-c3-c4-server-frames
ELI5
Tests only (no product code changes) exercising the C3 and C4 fixes in #52149 across disconnect/reconnect, server closes (focused, split, last-tab, mid-start), same-ID close+recreate, multi-client agreement (two desktops + phone), server restart rebinding, and 200-workspace scale. Several tests fail against #52149 and expose real gaps in frame-dropped tab retirement and stream removal.
Before / after
ptyIdsByTabIdbuildLayoutFrameStorePatchnever clears globalactiveTabId, andshouldRepairActiveTerminalTabskips repair whentabs.length === 0, leavingactiveTabIdpointing at the deleted tab permanentlydroppedTerminalTabRecordsPatchseeskept.has(tab.id) === trueandmergeTerminalRowpreservesexisting.ptyId, so bothtab.ptyIdandptyIdsByTabId[tabId]permanently retain the dead pre-disconnect PTY (and oldlocalOnlyScrollbackByTabId) even after the new PTY attaches and echoes outputdroppedTerminalTabRecordsPatchonly inspects whole dropped tabs, leaving the closed pane's PTY inptyIdsByTabIdand leaf scrollback inlocalOnlyScrollbackByTabIdat the frame-patch layerterminalPaneStartsByPaneKey(unit); FAIL forpendingStartupByTabId(unit) —droppedTerminalTabRecordsPatchdoes not retirependingStartupByTabIdremovedworkspace frameworkspace-layout-frame-sync.tsskips keys missing fromcacheon flush (if (!layout) continue), leavingtabsByWorktree,terminalLayoutsByTabId,ptyIdsByTabId, andlocalOnlyScrollbackByTabIdstrandedMechanism
config/scripts/ci/layout-owner/switch-on-unit-tests.txt):src/renderer/src/store/workspace-layout/frames/frame-dropped-terminal-tab-records.test.ts(5 tests: 4 fail, 1 pass)src/renderer/src/runtime/workspace-layout/server/server-layout-frames-lifecycle.test.ts(6 tests: 2 fail, 4 pass).github/workflows/layout-owner-switch-on.ymle2e-paired):tests/layout-owner-e2e/paired-server-frames-disconnect-and-restart.spec.ts(2 tests: 2 pass)tests/layout-owner-e2e/paired-server-frames-close-and-reopen.spec.ts(2 tests: 2 fail — last focused tab staleactiveTabId, and disconnected same-ID close+recreate keeping dead PTY on bothtab.ptyIdandptyIdsByTabId)tests/layout-owner-e2e/paired-two-desktops-and-phone-tabs.spec.ts(1 test: 1 pass)tests/layout-owner-e2e/paired-server-frames-many-workspaces.spec.ts(1 test: 1 pass)How it was tested
Switch on (
ORCA_LAYOUT_OWNER=main,ORCA_SERVER_LAYOUT_OWNER=main, exported and logged), darwin, hidden windows (ORCA_BACKGROUND_LAUNCH=1), foreground runs with timeouts:pnpm test ... --maxWorkers=2): 11 tests run — 5 passed, 6 failed for the real reasons above.playwright test --config tests/layout-owner-playwright.config.ts --project electron-headless --workers=1):paired-server-frames-disconnect-and-restart.spec.ts: 2/2 passed (50.4s) (an earlier attempt briefly hit the shared Mac's host-wide 256-terminal cap; subsequent full run passed cleanly)paired-server-frames-close-and-reopen.spec.ts: 0/2 passed (2 real failures reproduced in Electron: staleactiveTabIdon last-tab close, and stale pre-disconnect PTY kept on bothtab.ptyIdandptyIdsByTabIdafter same-ID recreate)paired-two-desktops-and-phone-tabs.spec.ts: 1/1 passed (35.9s)paired-server-frames-many-workspaces.spec.ts: 1/1 passed (18.0s)pnpm run typecheck:ci,pnpm run check:e2e-typecheck-ratchet,oxlint(default, code-quality-native, js-plugins),oxfmt --check,ast-grep,check:max-lines-ratchet,check:flaky-test-pattern-ratchet,check:layout-writer-ratchets,check:test-file-runners,check:path-literal-ratchet— all clean.Visible changes
None (tests and switch-on lane wiring only; no product code modified).