Repository navigation
sessions: keep animation frames real in automation card fake-clock tests - #347524
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 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
Dateand 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]>
Bryan Chen (bryanchen-d)
force-pushed
the
flake/automations-fake-raf
branch
from
November 11, 2026 01:37
3a5a74e to
498ceec
Compare
Bryan Chen (bryanchen-d)
marked this pull request as ready for review
November 11, 2026 01:51
Bryan Chen (bryanchen-d)
enabled auto-merge (squash)
November 11, 2026 01:51
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 11, 2026
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-windowanimFrameRequestedflag and callswindow.requestAnimationFrame. That flag only clears when the frame fires.The four
AutomationsCardsWidgettests use sinonuseFakeTimers(), which also fakesrequestAnimationFrame. Since #347444, the finalsetRunsinrun feedback survives acknowledgement and refresh until the new run session appearssplices the run-session list after the lasttickAsync. That splice callseventuallyUpdateScrollDimensions→scheduleAtNextAnimationFrame, which requests the frame from the fake clock.clock.restore()then drops that frame, the flag staystrue, 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 schedulingtests, then the rest of SessionsList, Sessions Workbench, CanvasEditor and others, until the 30-minute task limit.Evidence (local, Chromium, at
225e6b5944)sessionsList.test.tsalone: 502 passing.vs/sessions/**browser tests: 29 failing, starting atcatalogue refresh scheduling › coalesces provider, catalogue and host invalidations…with timeouts, the same shape as CI.automationsView.test.ts+sessionsList.test.ts: 25 failing.dom.jsthat logs any non-nativerequestAnimationFramecall shows exactly one, from the test above, via a list splice.Fix
The four fake clocks in this suite fake only
Dateand 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 swappedrequestAnimationFrame. 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.vs/sessions/**: 8089 passing, 0 failing (was 29 failing).automationsView.test.ts5× in a row: 179/179 each time.