Skip to content

ci: stabilize flaky Test job (cap nx parallelism + raise vitest timeouts)#478

Merged
AlemTuzlak merged 3 commits into
mainfrom
fix/stabilize-devtools-component-test-timeouts
Jun 24, 2026
Merged

ci: stabilize flaky Test job (cap nx parallelism + raise vitest timeouts)#478
AlemTuzlak merged 3 commits into
mainfrom
fix/stabilize-devtools-component-test-timeouts

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Test job (pnpm run test:prnx affected ...) has been failing intermittently across unrelated PRs (#471, #477, and this one), always passing on a plain re-run with no code change. The failing task varied — @tanstack/devtools:test:lib (timeout-shaped) and @tanstack/devtools:test:types (tsc, which is deterministic and cannot fail nondeterministically on real errors). That signature = resource contention on the runner, not a real test/type bug.

Root cause

nx.json sets "parallel": 5. That's fine on a developer's many-core machine, but a GitHub-hosted runner is far smaller, and each affected test:lib (vitest) / test:types (tsc) task spawns its own worker pool. Running 5 such heavy tasks concurrently oversubscribes CPU and RAM, which:

The team had already worked around the same contention by pinning test:e2e to --parallel=1, but test:pr still ran at the global parallel: 5.

nx-set-shas (correct main-branch-name) and fetch-depth: 0 are already configured correctly, so nx affected base/head selection is fine — the only misconfiguration was unbounded CI parallelism.

Fix

  1. .github/workflows/pr.yml — set NX_PARALLEL: 3 in the workflow env. CI-only; local dev keeps parallel: 5 from nx.json. Keeps concurrent heavy tasks within the runner's CPU/RAM budget.
  2. packages/devtools/vite.config.ts — raise testTimeout/hookTimeout to 30s so the heavy component renders have headroom even when the runner is loaded. Fast unit tests are unaffected; a genuine hang still fails (after 30s instead of 5s).

Belt-and-suspenders: (1) removes the contention that caused both flake shapes; (2) protects test:lib specifically against residual slowness.

Verification

  • nx test:lib @tanstack/devtools 174 tests pass locally
  • nx test:types @tanstack/devtools passes locally
  • CI on this PR is green under the new NX_PARALLEL=3 path

No published-package code changes, so no changeset.

Summary by CodeRabbit

  • Bug Fixes
    • Improved CI reliability by reducing parallel work on hosted runners.
    • Increased test timeouts for slower environments to help prevent flaky test failures.

…b in CI

The component tests added in #472 render the full Solid + goober tree and take
1-4s locally. Shared CI runners are ~4x slower (the suite runs in ~8s locally
but ~31s in CI), which pushes individual tests past vitest's default 5s
testTimeout and causes intermittent `@tanstack/devtools:test:lib` failures
across unrelated PRs (e.g. #471, #477).

Raise testTimeout and hookTimeout to 30s for the devtools package so slow CI
runs have headroom. Fast unit tests are unaffected; a real hang still fails
(just after 30s instead of 5s).
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36f25df6-b138-46a4-8f1d-8f7e62b4a8a5

📥 Commits

Reviewing files that changed from the base of the PR and between e026667 and 7e9c642.

📒 Files selected for processing (2)
  • .github/workflows/pr.yml
  • packages/devtools/vite.config.ts

📝 Walkthrough

Walkthrough

Two CI stability tweaks: the PR workflow gains a top-level NX_PARALLEL: 3 env variable to limit Nx task concurrency on GitHub-hosted runners, and the packages/devtools Vitest config raises both testTimeout and hookTimeout from the default to 30_000 ms.

Changes

CI Stability Fixes

Layer / File(s) Summary
NX parallelism cap and Vitest timeout increase
.github/workflows/pr.yml, packages/devtools/vite.config.ts
Adds NX_PARALLEL: 3 to the workflow-level env block with explanatory comments about runner resource limits; sets testTimeout and hookTimeout to 30_000 in the Vitest config with comments about slow shared CI runners.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through CI lanes,
Too many tasks brought flaky pains.
Three at once — a calmer pace,
Timeouts stretched to give more space.
No more flaps, the builds run clean,
The greenest CI ever seen! 🐇✅

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning PR #39 is a release/versioning PR, but these changes only adjust CI and Vitest settings, so the linked issue is not satisfied. Add the release/versioning package updates required by #39, or retarget this PR to the correct CI-stability issue.
Out of Scope Changes check ⚠️ Warning The CI workflow and Vitest timeout edits are unrelated to the linked release/versioning scope in #39. Keep CI stability changes in a separate PR and reserve this one for the package versioning/publishing work in #39.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main CI stabilization changes: Nx parallelism cap and Vitest timeout increases.
Description check ✅ Passed The description covers the problem, fix, and verification, and is mostly complete despite not using the exact template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/stabilize-devtools-component-test-timeouts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jun 24, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit aaa71f6

Command Status Duration Result
nx run-many --target=test:e2e --parallel=1 --pr... ✅ Succeeded 1m 2s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 2s View ↗
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-24 11:46:14 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-devtools

npm i https://pkg.pr.new/@tanstack/angular-devtools@478

@tanstack/devtools

npm i https://pkg.pr.new/@tanstack/devtools@478

@tanstack/devtools-a11y

npm i https://pkg.pr.new/@tanstack/devtools-a11y@478

@tanstack/devtools-client

npm i https://pkg.pr.new/@tanstack/devtools-client@478

@tanstack/devtools-ui

npm i https://pkg.pr.new/@tanstack/devtools-ui@478

@tanstack/devtools-utils

npm i https://pkg.pr.new/@tanstack/devtools-utils@478

@tanstack/devtools-vite

npm i https://pkg.pr.new/@tanstack/devtools-vite@478

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/@tanstack/devtools-event-bus@478

@tanstack/devtools-event-client

npm i https://pkg.pr.new/@tanstack/devtools-event-client@478

@tanstack/preact-devtools

npm i https://pkg.pr.new/@tanstack/preact-devtools@478

@tanstack/react-devtools

npm i https://pkg.pr.new/@tanstack/react-devtools@478

@tanstack/solid-devtools

npm i https://pkg.pr.new/@tanstack/solid-devtools@478

@tanstack/svelte-devtools

npm i https://pkg.pr.new/@tanstack/svelte-devtools@478

@tanstack/vue-devtools

npm i https://pkg.pr.new/@tanstack/vue-devtools@478

commit: 7e9c642

@AlemTuzlak AlemTuzlak requested a review from a team as a code owner June 24, 2026 11:39
nx.json sets `parallel: 5`, which is fine for local dev machines but
oversubscribes GitHub-hosted runners: each affected `test:lib` (vitest) and
`test:types` (tsc) task spawns its own worker pool, so 5 heavy tasks at once
exhaust CPU/RAM and intermittently stall or OOM-kill deterministic tasks. That
produced flaky failures across unrelated PRs (#471, #477, #478) that pass on a
plain re-run.

The team already pins `test:e2e` to `--parallel=1` for the same reason; cap the
Test job's nx parallelism via NX_PARALLEL=3 (CI-only, leaves local dev at 5).
Combined with the raised vitest timeouts, this keeps tasks within the runner's
budget.
@AlemTuzlak AlemTuzlak changed the title test(devtools): raise vitest timeouts to stop flaky component test:lib in CI ci: stabilize flaky Test job (cap nx parallelism + raise vitest timeouts) Jun 24, 2026
@AlemTuzlak AlemTuzlak merged commit 92f69d0 into main Jun 24, 2026
11 checks passed
@AlemTuzlak AlemTuzlak deleted the fix/stabilize-devtools-component-test-timeouts branch June 24, 2026 12:05
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.

2 participants