Skip to content

sessions: keep animation frames real in automation card fake-clock tests - #347524

Merged
Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
flake/automations-fake-raf
Nov 11, 2026
Merged

Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
flake/automations-fake-raf

Conversation

@bryanchen-d

Copy link
Copy Markdown
Collaborator

Fixes the main CI unit-test cascade in 495093: every Electron and Browser unit job on every OS times out after about 70 failures.

Mechanism

scheduleAtNextAnimationFrame (dom.ts) sets a per-window animFrameRequested flag and calls window.requestAnimationFrame. That flag only clears when the frame fires.

The four AutomationsCardsWidget tests use sinon useFakeTimers(), which also fakes requestAnimationFrame. Since #347444, the final setRuns in run feedback survives acknowledgement and refresh until the new run session appears splices the run-session list after the last tickAsync. That splice calls eventuallyUpdateScrollDimensions → scheduleAtNextAnimationFrame, which requests the frame from the fake clock. clock.restore() then drops that frame, the flag stays true, and no later test in the same renderer ever gets an animation frame.

PR CI didn't catch it because it runs only affected test files, split across 4 workers. Main CI runs the full suite in one renderer, so the next frame waiters time out: first the SessionsList › catalogue refresh scheduling tests, then the rest of SessionsList, Sessions Workbench, CanvasEditor and others, until the 30-minute task limit.

Evidence (local, Chromium, at 225e6b5944)

  • sessionsList.test.ts alone: 502 passing.
  • All vs/sessions/** browser tests: 29 failing, starting at catalogue refresh scheduling › coalesces provider, catalogue and host invalidations… with timeouts, the same shape as CI.
  • automationsView.test.ts + sessionsList.test.ts: 25 failing.
  • An instrumented dom.js that logs any non-native requestAnimationFrame call shows exactly one, from the test above, via a list splice.

Fix

The four fake clocks in this suite fake only Date and the timer functions, so animation frames stay real and the shared runner can't be stranded. A shared helper keeps the four tests consistent. Test-only change, and the feature from #347444 is unchanged.

A separate hardening of dom.ts (#347523) makes the shared runner recover from a swapped requestAnimationFrame. This PR is the targeted fix for the test that triggers it.

Validation (Chromium unless noted)

  • automationsView.test.ts + sessionsList.test.ts: 681 passing, 0 failing, no faked rAF call. WebKit: 681 passing.
  • All vs/sessions/**: 8089 passing, 0 failing (was 29 failing).
  • automationsView.test.ts 5× in a row: 179/179 each time.
  • eslint is clean. tsc shows no errors in the touched file.

Authored with Copilot

Copilot AI balanced review requested due to automatic review settings November 11, 2026 01:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable review findings remain for this test-only fake-clock change, though tests were not rerun during review.

No open issues 🎉

What changed in this PR

This test-only change prevents automation card fake clocks from stranding the shared animation-frame runner and causing timeouts in later tests. Production automation behavior remains unchanged.

Changes:

  • Add a shared fake-clock helper that fakes Date and timer functions while leaving animation frames real.
  • Use the helper in all four affected tests, preserving automatic clock restoration.

No actionable findings remain. Validation results are reported in the PR description; tests were not rerun here.

File Description
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​automationsView.test.ts Centralizes fake-clock setup and keeps animation frames real across four automation card tests.

Review effort: Balanced

The sinon clocks in AutomationsCardsWidget faked requestAnimationFrame. Since
#347444, the last setRuns in 'run feedback survives acknowledgement and refresh
until the new run session appears' splices a list after the final tick, so
scheduleAtNextAnimationFrame sets the window's animFrameRequested flag and
requests the frame from the fake clock. restore() drops that frame, the flag
never clears, and no later test in the renderer gets an animation frame. In the
full single-renderer unit run this times out every later frame waiter, starting
with the SessionsList catalogue refresh tests (main CI 495093).

Fake only Date and timers in these tests so animation frames stay real.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the test-only fake-timer changes, though tests were not independently rerun.

No open issues 🎉

Review effort: Balanced

@bryanchen-d
Bryan Chen (bryanchen-d) merged commit 5faf343 into main Nov 11, 2026
53 of 54 checks passed
@bryanchen-d
Bryan Chen (bryanchen-d) deleted the flake/automations-fake-raf branch November 11, 2026 02:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.147.0 milestone Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants