Repository navigation
test: fix WorkflowTab hover-delay flake from wall-time fake timers - #22038
Conversation
The frontend fake timers run with shouldAdvanceTime, so real elapsed time also advances the clock. The hover tests step the 200ms show and 100ms hide delays to the millisecond; on a loaded runner a timer fired one step early. Pin shouldAdvanceTime: false for that describe.
🎨 Storybook: ✅ Built — View Storybook🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight
Findings and check detailsThe matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md 🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. Findings and check detailsNo new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since b0d816d3216e08ead715c73607f8b40f7388d566
Full docs: ADR-DEVEX-LINT-0015 🏛️ Architecture: ✅ PassedFindings and check detailsWarnings (210)
Reproduce locallypnpm architecture:checkFull docs: Frontend domain catalog |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Configure fake timers src/components/topbar/WorkflowTab.test.ts |
The beforeEach setup enables fake timers with automatic time advancement disabled before resetting the mocked workflow status. |
Priority:
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix
Possibly related issues
- Comfy-Org/ComfyUI_frontend#15782: This change also configures Vitest fake timers and disables automatic time advancement, which may relate to the issue’s reported timing measurements.
Suggested reviewers: drjkl
Merge Risk: 
Minimal · up to 34c01
-
The test timer setup is appropriate for deterministic hover-delay checks and is ready to merge.
Pre-merge checks: 
6
-
Full details: Description check
-
Explanation
The description explains the failure, root cause, fix, alternatives, and verification results. It does not use the template headings exactly, but it includes the required summary and verification information.
Full details: End-To-End Test Suggestion For User-Facing Changes
-
Explanation
The pull request changes only
src/components/topbar/WorkflowTab.test.tsand updates test timer setup. It does not change application behavior or add a user-facing feature. This check encourages, but does not require, a Playwright test.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #22038 +/- ##
==========================================
- Coverage 87.71% 86.66% -1.06%
==========================================
Files 2894 3004 +110
Lines 158374 157718 -656
Branches 43310 40391 -2919
==========================================
- Hits 138922 136681 -2241
- Misses 18612 20317 +1705
+ Partials 840 720 -120
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@christian-byrne Successfully backported to #22257 |
|
@christian-byrne Successfully backported to #22258 |
WorkflowTabhover-delay tests flaked under CI loadshouldAdvanceTime: true, so wall time leaks into the 200ms/100ms delaysshouldAdvanceTime: falseFull context for agent readers
Failure
src/components/topbar/WorkflowTab.test.ts > WorkflowTab - workflow status indicator > delays hover preview without moving focus and dismisses after leavingfailed on #21341 (job https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/40394181583/job/121824507992):Unable to find an accessible element with the role "dialog"at the "still open after 99ms" check (the hide timer had already fired)expect(element).not.toBeInTheDocument()at the "not open after 199ms" check (the show timer had already fired)Root cause
vite.config.mtssetsfakeTimers: { now: TEST_SYSTEM_TIME, shouldAdvanceTime: true }, andvitest.timer.setup.tscallsvi.useFakeTimers()before every test. WithshouldAdvanceTime, the fake clock also moves forward with real elapsed time. The test steps the popover'suseTimeoutFndelays (200ms show, 100ms hide) one millisecond at a time withvi.advanceTimersByTimeAsync(199)+(1)and(99)+(1). Once a loaded runner spends more than ~1ms of wall time between those steps, a timer fires a step early. Either assertion can then fail, which matches both CI errors. On an idle machine the drift stays under 1ms, so it passed locally.Fix
The
workflow status indicatordescribe'sbeforeEachcallsvi.useFakeTimers({ shouldAdvanceTime: false }). Vitest merges that with the projectfakeTimersconfig, sonowis kept. Time moves only when the test advances it. This is the same pattern other suites already use (e.g.src/stores/assetDownloadStore.test.ts,src/components/queue/job/JobAssetsList.test.ts). Only the two hover/click tests in that describe depend on timers. The other tests in it do not care.Alternatives not taken:
advanceTimersByTimeAsync(150)): hides the boundary the test exists to checkshouldAdvanceTimeglobally: much wider blast radius, since other suites rely on itEvidence
Both hover tests temporarily run with
{ repeats: 50 },-t "hover|click-dismissed", on a shared 8-core host at load average 26–36. "Under load" adds 10 extranode -e 'for(;;){}'busy loops. Each run is 100 executions.:153,:165), same lines as CI:153,:165){ repeats: 200 }on the hover testThe full file passes (24/24).
oxfmt,oxlintandpnpm typecheckare clean.