Skip to content

test(vite-plugin): fix webkit operation-completion poll flake - #1240

Merged
trueadm merged 1 commit into
octanejs:mainfrom
o-alexandrov:fix-webkit-operation-poll-flake
Sep 22, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
o-alexandrov:fix-webkit-operation-poll-flake

Conversation

@o-alexandrov

@o-alexandrov o-alexandrov commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

The heavy integration lane fails intermittently on this case, most recently on the CI run for #1237, which changes only release scripts and cannot affect it:

FAIL  vite-plugin  packages/vite-plugin-octane/tests/production.test.ts
  > preserves early composer input through independent activation and conversation navigation in webkit
AssertionError: expected +0 to be 1
Caused by: Error: Matcher did not succeed in time.

Why these two polls

Both waits poll for the terminal yield of a conversation operation:

await expect.poll(() => page.getByText('Completed: one accepted operation', { exact: true }).count()).toBe(1);

Neither passes a timeout, so each gets Vitest's default expect.poll budget, which is { interval: 50, timeout: 1000 }.

These are the only polls in the test that wait on work gated behind a deliberate server-side delay. The fixture host in tests/_fixtures/app/src/conversation/host.ts yields Working on …, sleeps 600ms, and only then yields Completed: …. Every other poll in the test waits on state that lands without that delay, which is consistent with the failure concentrating here.

I have not instrumented how much of the 600ms is still outstanding by the time the poll starts: the preceding conversation switches consume some of it, and the exact residual depends on runner speed. So the honest statement is that these two assertions have the least headroom in the test and a 1000ms budget is too tight for WebKit on a loaded CI runner, not that the full sleep sits inside the poll window.

I also checked the obvious alternative, a lost update when the test switches from conversation B back to A. The watch generator in _fixtures/app/src/conversation/operations.ts re-compares source.frame.revision at the top of each iteration before awaiting, so a publish that lands during re-subscription is still observed on the next pass. I found no dropped-frame path, which points at latency rather than a correctness bug.

Change

Give both completion polls a 10s timeout, matching the explicit timeouts already used for slow browser polls elsewhere in the suite, for example { timeout: 10_000 } in packages/vite-plugin-octane/tests/browser/hmr.test.ts and packages/monaco-editor/tests/browser/editor.browser.test.ts.

The second poll (Completed: history-4, the webkit fetched-SSR case) has the identical shape and the same thin margin, so it gets the same treatment rather than waiting for it to go red on its own.

No it or describe timeout changes, and no assertion is weakened: the test still requires exactly one matching node. Only the time allowed to observe it changes, so a genuine regression that never yields Completed: still fails, 9s later. Both enclosing tests already allow 60s, so the larger poll budget cannot outlive its test.

Tests

Not run. vitest run packages/vite-plugin-octane/tests/production.test.ts needs the built workspace and Playwright browsers, which I could not provision. The change is confined to two expect.poll option objects; prettier --check passes on the file, and the { interval?, timeout?, message? } option shape is checked against ExpectPollOptions in vitest 4.1.10.

If this still flakes at 10s, the fixture's hardcoded 600ms sleep is the next thing to attack.

The two polls that wait for a generator's terminal `Completed: …` yield
relied on the default 1s expect.poll timeout. The fixture's host sleeps
600ms between the first and last yield, so the budget only covers that
sleep plus one RPC round trip, and WebKit in CI intermittently exceeds
it. Both waits now allow 10s, matching the explicit timeouts already
used for slow browser polls elsewhere in the suite.
@github-actions github-actions Bot added the test PR: tests only label Sep 22, 2026
@trueadm
trueadm merged commit c25a185 into octanejs:main Sep 22, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test PR: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants