Repository navigation
test(e2e): stabilize chronically-failing e2e suite #7470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
0bf7458
d63d0b3
37e065b
5851a3c
c0a5617
546a416
3c3c064
27ce7ea
cb412eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,30 +134,34 @@ test.describe('Terminal column desync repro', () => { | |
| await ensureTerminalVisible(orcaPage) | ||
| const ptyId = await settleTerminal(orcaPage) | ||
|
|
||
| // Why: the resize chain (ResizeObserver → rAF fit → PTY resize IPC) needs | ||
| // longer than a fixed wait under loaded CI, and the two columns are sampled | ||
| // non-atomically. Poll until they converge — a genuinely dropped resize | ||
| // never converges and still fails, so this keeps the regression guard. | ||
| const expectColumnsInSync = async (label: string): Promise<void> => { | ||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const snap = await readColumnSnapshot(orcaPage, ptyId) | ||
| return snap.ptyCols === snap.xtermCols | ||
| ? 'synced' | ||
| : `pty=${snap.ptyCols} xterm=${snap.xtermCols}` | ||
| }, | ||
| { timeout: 30_000, message: `${label}: PTY cols should converge to xterm cols` } | ||
| ) | ||
| .toBe('synced') | ||
| } | ||
|
Comment on lines
+141
to
+153
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Inspect the waitForPtyColumnsAtMost implementation and READ_ANY_COLS semantics
rg -n 'READ_ANY_COLS|function waitForPtyColumnsAtMost' tests/e2e/terminal-column-desync-repro.spec.ts tests/e2e/helpers -A 15
# Check whether the resize test's timeout has been raised
rg -n 'test\.setTimeout|test\(' tests/e2e/terminal-column-desync-repro.spec.ts -B2 -A2Repository: stablyai/orca Length of output: 5176 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show the helper implementation and the exact test blocks around the new polling.
rg -n 'waitForPtyColumnsAtMost|READ_ANY_COLS|expectColumnsInSync|test\.setTimeout|//|/\*\*' tests/e2e/terminal-column-desync-repro.spec.ts -A 8 -B 8
# Locate the helper if it lives elsewhere.
rg -n 'waitForPtyColumnsAtMost' tests/e2e -A 12 -B 6Repository: stablyai/orca Length of output: 26370 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the PTY column probe helper to determine whether it already polls/retries internally.
cat -n tests/e2e/terminal-column-probes.ts | sed -n '1,220p'
# Show the full resize test block around the new helper call for timeout context.
cat -n tests/e2e/terminal-column-desync-repro.spec.ts | sed -n '128,210p'Repository: stablyai/orca Length of output: 9747 Avoid stacking the 30s PTY probe inside a 30s poll |
||
|
|
||
| // Baseline: a freshly fit terminal should agree with its PTY. | ||
| const baseline = await readColumnSnapshot(orcaPage, ptyId) | ||
| expect( | ||
| baseline.ptyCols, | ||
| `baseline PTY cols (${baseline.ptyCols}) should equal xterm cols (${baseline.xtermCols})` | ||
| ).toBe(baseline.xtermCols) | ||
| await expectColumnsInSync('baseline') | ||
|
|
||
| // Shrink the window while the terminal is visible, then widen it. xterm | ||
| // reflows via the ResizeObserver; the PTY must follow. | ||
| await orcaPage.setViewportSize({ width: 760, height: 800 }) | ||
| await orcaPage.waitForTimeout(400) | ||
| const narrow = await readColumnSnapshot(orcaPage, ptyId) | ||
| expect( | ||
| narrow.ptyCols, | ||
| `after shrink, PTY cols (${narrow.ptyCols}) should equal xterm cols (${narrow.xtermCols})` | ||
| ).toBe(narrow.xtermCols) | ||
| await expectColumnsInSync('after shrink') | ||
|
|
||
| await orcaPage.setViewportSize({ width: 1280, height: 800 }) | ||
| await orcaPage.waitForTimeout(400) | ||
| const wide = await readColumnSnapshot(orcaPage, ptyId) | ||
| expect( | ||
| wide.ptyCols, | ||
| `after widen, PTY cols (${wide.ptyCols}) should equal xterm cols (${wide.xtermCols})` | ||
| ).toBe(wide.xtermCols) | ||
| await expectColumnsInSync('after widen') | ||
| }) | ||
|
|
||
| // Why: guards the applied-size IPC contract the desync fix relies on. The | ||
|
|
@@ -175,15 +179,26 @@ test.describe('Terminal column desync repro', () => { | |
| const ptyId = await settleTerminal(orcaPage) | ||
|
|
||
| await orcaPage.setViewportSize({ width: 900, height: 800 }) | ||
| await orcaPage.waitForTimeout(500) | ||
|
|
||
| const ptyCols = await readPtyCols(orcaPage, ptyId) | ||
| const reportedCols = await readReportedPtyCols(orcaPage, ptyId) | ||
| expect( | ||
| reportedCols, | ||
| `pty:getSize reported ${reportedCols} but the PTY's process.stdout.columns is ${ptyCols}; ` + | ||
| `getSize must reflect the APPLIED size so the drift-check can detect a dropped resize` | ||
| ).toBe(ptyCols) | ||
| // Why: poll until pty:getSize converges to the real applied columns instead | ||
| // of sampling once after a fixed wait — the resize can still be settling on | ||
| // loaded CI. A getSize that reports intent (not the applied size) never | ||
| // converges to process.stdout.columns and still fails the guard. | ||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const ptyCols = await readPtyCols(orcaPage, ptyId) | ||
| const reportedCols = await readReportedPtyCols(orcaPage, ptyId) | ||
| return reportedCols === ptyCols ? 'match' : `reported=${reportedCols} pty=${ptyCols}` | ||
| }, | ||
| { | ||
| timeout: 30_000, | ||
| message: | ||
| 'pty:getSize must converge to the applied PTY columns (process.stdout.columns) ' + | ||
| 'so the drift-check can detect a dropped resize' | ||
| } | ||
| ) | ||
| .toBe('match') | ||
| }) | ||
|
|
||
| test('PTY columns re-sync after the terminal is resized while hidden', async ({ orcaPage }) => { | ||
|
|
||
There was a problem hiding this comment.
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
Fallback re-introduces the exact flakiness being fixed.
When
snapshot.paneshas no pane whoseleafId !== activeLeafId(e.g., a single-pane scenario),.find()returnsundefinedand the??fallback silently substitutessnapshot.panes[0]— which is the active pane. The guard on the next line never fires (sincepanes[0]is truthy), so the test can seed the thread on the active pane, hitting the auto-ack race the comment above explicitly warns about.🐛 Proposed fix
📝 Committable suggestion