Skip to content

Visual suite: a whole shard fails with "Could not capture a stable screenshot" on half of all main runs #3106

Description

@mfal

One shard of the visual suite goes red with every test in it reporting

Could not capture a stable screenshot within 5000ms.

Nothing is ever compared, so there are no diff images to look at and nothing in the log says what the shard would have rendered. It hits 5 of the last 10 main runs, a different shard each time, and it is the failure behind #3090 and #3104.

Evidence

Five main runs, all with the same signature — the stable screenshot message, zero pixels (ratio …) differ, and the whole shard down:

Run Shard Result
33631694282 visual (3) whole shard
33626556173 visual (3) whole shard
33608121174 visual (1) 85 failed, 1 passed
33607745081 visual (2) 73 failed, 1 passed
33599165776 visual (1) 85 failed, 1 passed

The other three to five shards of the same run pass in 3-6 minutes.

What is known about it

  • It is not a diff. Zero pixel comparisons happen. toMatchScreenshot never clears its stability gate, so it writes neither reference, actual nor diff — the visual-diffs-* artifact is empty.
  • It is not browser-specific. In 33633352648 shard 5, both Firefox and WebKit failed on the same runner (118 of 120 tests). ci: retry a hung visual shard on the label workflow #3090 observed 63 of 64 blocks on firefox-linux, which reads as browser-specific but is one sample.
  • It starts at the first test, not after warm-up. In 33633338781 shard 1, the first file to finish (Button, 8 tests) took 41966ms — 8 × the 5s budget. No degradation curve.
  • A re-run in the same job does not help. The attempts retry in .github/actions/run-visual-shard was pointed at exactly this. Its first real exercise ran three attempts and produced 85 failed / 1 passed each time, at 474s, 472s and 472s. The attempts share the runner. ci: retry a hung visual shard on the PR run too #3104 documents this; the label-workflow half is being reverted.
  • A tiny scenario survives. The single pass in each affected shard is a small one — CopyButton at 656ms, LoadingSpinner (Local) at 411ms — while everything larger times out on the same runner in the same attempt.

Lead

toMatchScreenshot's stability budget is vitest's default 5000ms; nothing in the repo raises it. Right beside it, waitForPaintedContent (packages/remote-react-components/src/tests/lib/environments.tsx) deliberately carries 20s, with a comment that CI hardware is slower than the machine its numbers came from. The same argument applies to the screenshot's stability window, and #3090 already noted it.

The option is per-call ScreenshotMatcherOptions.timeout, so it can be set once for the visual project rather than per test.

Two things to settle before raising it:

  1. Does a longer window actually stabilize on the affected runner? The failure is "two consecutive captures never matched", and nothing measured so far says whether the gap is 6s or unbounded. If it is unbounded, the budget is the wrong knob and something keeps repainting.
  2. The interaction with the job timeout. A budget of 15s over 86 tests is 21 minutes per attempt in the worst case, against a 35-minute job with up to three attempts. Raising the budget means revisiting attempts and timeout-minutes together.

Why it is worth fixing rather than living with

A reviewer meets a red required check with no diff images. The cheapest-looking next move is the update-screenshots label — which runs --update over the whole suite and git add -A, and is exactly how #2945 committed a tooltip-less frame as a baseline and kept the scheduled run red (#2985). Half of all main runs currently offer that invitation.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugtoolingCI, config of build-tools... the painful things not related to the bare source code

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions