Skip to content

[backport core/1.59] test: fix WorkflowTab hover-delay flake from wall-time fake timers - #22257

Merged
comfy-pr-bot merged 1 commit into
core/1.59from
backport-22038-to-core-1.59
Oct 29, 2026
Merged

comfy-pr-bot merged 1 commit into
core/1.59from
backport-22038-to-core-1.59

Conversation

@comfy-pr-bot

Copy link
Copy Markdown
Member

Backport of #22038 to core/1.59

Automatically created by backport workflow.

…22038)

- `WorkflowTab` hover-delay tests flaked under CI load
- Cause: global fake timers use `shouldAdvanceTime: true`, so wall time
leaks into the 200ms/100ms delays
- Fix: those tests pin `shouldAdvanceTime: false`

<details><summary>Full context for agent readers</summary>

## Failure

`src/components/topbar/WorkflowTab.test.ts > WorkflowTab - workflow
status indicator > delays hover preview without moving focus and
dismisses after leaving` failed on
#21341 (job
https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/40394181583/job/121824507992):

- first attempt: `Unable to find an accessible element with the role
"dialog"` at the "still open after 99ms" check (the hide timer had
already fired)
- both retries: `expect(element).not.toBeInTheDocument()` at the "not
open after 199ms" check (the show timer had already fired)

## Root cause

`vite.config.mts` sets `fakeTimers: { now: TEST_SYSTEM_TIME,
shouldAdvanceTime: true }`, and `vitest.timer.setup.ts` calls
`vi.useFakeTimers()` before every test. With `shouldAdvanceTime`, the
fake clock also moves forward with real elapsed time. The test steps the
popover's `useTimeoutFn` delays (200ms show, 100ms hide) one millisecond
at a time with `vi.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 indicator` describe's `beforeEach` calls
`vi.useFakeTimers({ shouldAdvanceTime: false })`. Vitest merges that
with the project `fakeTimers` config, so `now` is 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:

- loosening the assertions (e.g. `advanceTimersByTimeAsync(150)`): hides
the boundary the test exists to check
- flipping `shouldAdvanceTime` globally: much wider blast radius, since
other suites rely on it

## Evidence

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 extra `node -e 'for(;;){}'` busy loops. Each run is
100 executions.

| variant | condition | result |
| --- | --- | --- |
| before | idle-ish | 1 failed (`:153`, `:165`), same lines as CI |
| before | under load, 2 runs | 2/2 failed (`:153`, `:165`) |
| after | idle-ish | 2 passed (100/100) |
| after | under load, 3 runs | 3/3 passed (300/300) |
| after | idle, `{ repeats: 200 }` on the hover test | passed (200/200)
|

The full file passes (24/24). `oxfmt`, `oxlint` and `pnpm typecheck` are
clean.

</details>
@comfy-pr-bot comfy-pr-bot added the backport Backporting a PR onto a release candidate label Oct 29, 2026
@comfy-pr-bot
comfy-pr-bot requested a review from a team as a code owner October 29, 2026 15:54
@comfy-pr-bot
comfy-pr-bot enabled auto-merge (squash) October 29, 2026 15:54
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size

⏳ Size data collection in progress…

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 10/29/2026, 03:56:44 PM UTC

Links

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

No verdict is available. Open the workflow run to confirm the check was intentionally skipped, or fix the collection failure and re-run it.

Findings and check details

The 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: ✅ Passed

Fallow 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 details

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since 90ba36745f6d53dbb2a332ffa062413fad0ce083

Full docs: ADR-DEVEX-LINT-0015

🏛️ Architecture: ✅ Passed

Findings and check details

Warnings (219)

  • workspace path matches no source files: src/platform/workspace/fixtures/**. Remove or update it in docs/architecture/domains/records/workspace.domain.json.
  • src/components/graph/selectionToolbox/LinkSelectionActions.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/searchbox/v2/filterChip.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/Popover.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/Card.stories.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/Card.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/CardFooter.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/CardHeader.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/ui/card/card.variants.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/graph/menuOption.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useLiveGraphNode.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useLiveGraphNode.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useWidgetValueHistory.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useWidgetValueHistory.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/widgetHistoryScope.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/widgetHistoryScope.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/litegraphServiceAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/nodeDef/ComfyNodeDefImpl.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/widgets/dynamicGroupDiagnostics.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/widgets/dynamicGroupDiagnostics.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/graph/widgets/dynamicGroupEnforcementBoundary.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/legacyUI/attachLegacyUI.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/core/selection/selectionIntent.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/agentPanel.historyIdentity.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/cloudBadges.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/dynamicPrompts.serializeValue.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/electronAdapter.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/index.cloud.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/index.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/cameraInfo.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/findNumericWidget.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dHost.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dHost.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dInstances.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dLazy.retry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dSettings.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dWidgets.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/load3dWidgets.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/reportLoadModelOutcome.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/load3d/reportLoadModelOutcome.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/slotDefaults.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/touchCanvasAccess.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/touchCanvasAccess.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/extensions/core/touchPointerGuards.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/i18n.literalMessages.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/ContextMenu.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/LGraphCanvas.startRendering.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/lib/litegraph/src/LiteGraphGlobal.cloneObject.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • …and 169 more
Reproduce locally
pnpm architecture:check

Full docs: Frontend domain catalog

@github-actions
github-actions Bot requested a review from thedatalife October 29, 2026 15:55

@dante01yoon dante01yoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean backport: the diff matches the merged original exactly. Approving.

@comfy-pr-bot
comfy-pr-bot merged commit 8743583 into core/1.59 Oct 29, 2026
92 checks passed
@github-actions github-actions Bot added the risk:medium PR risk grade (advisory shadow check; grader-owned) label Oct 29, 2026
@comfy-pr-bot
comfy-pr-bot deleted the backport-22038-to-core-1.59 branch October 29, 2026 16:05
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           core/1.59   #22257   +/-   ##
==========================================
  Coverage      87.45%   87.45%           
==========================================
  Files           2958     2958           
  Lines         156128   156128           
  Branches       42215    42215           
==========================================
  Hits          136544   136544           
  Misses         18908    18908           
  Partials         676      676           
Flag Coverage Δ
unit 86.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

backport Backporting a PR onto a release candidate risk:medium PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants