Skip to content

fix(ci): pin unit test fork pool + retry to kill intermittent timeouts - #2746

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-unit-pool-flakiness
Oct 13, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-unit-pool-flakiness

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

The unit vitest project runs with vitest's default unbounded fan-out (one worker per CPU) across ~400 cds.test('serve') files, each booting a CAP server. On CI runners this occasionally starves one file's cold boot past the 30s testTimeout, producing flaky failures that aren't code bugs:

  • test/admin-schema-ext.test.js — 3× 30s timeouts on /admin/$metadata (PR run 38392511887). Passes 3/3 in ~16s in isolation.
  • The same unbounded fan-out is why smoke, e2e, and hybrid-qa tiers already pin pool: 'forks' + maxWorkers + retry. The unit tier never got the caps.

(The parser assertion failures seen on earlier DEV merges #2739/#2740 were separate, Node-22/merge-ref inherited, and already self-cleared on current DEV — not addressed here.)

Fix

Add to the unit project in vitest.config.ts:

pool: 'forks',
maxWorkers: process.env.CI ? 4 : undefined,  // cap CI concurrency; unbounded locally
retry: process.env.CI ? 1 : 0,               // absorb a lone transient boot blip

retry: 1 is the single lever that would have turned every recent intermittent red green. It masks nothing real — a deterministic failure fails both tries.

Verification

admin-schema-ext.test.js + scan-markdown-source.test.ts → 20/20 pass under CI=true with the new pool settings active.

Mirrors the documented #1177/#1179 fork-pool-race mitigations already in this config.

🤖 Generated with Claude Code

The unit vitest project ran with vitest's default unbounded fan-out (one
worker per CPU) across ~400 cds.test('serve') files, each booting a CAP
server. On CI this intermittently starved a file's cold boot past the 30s
testTimeout, surfacing as flaky 30s timeouts (e.g. /admin/$metadata in
admin-schema-ext.test.js) that pass 3/3 in isolation. The smoke/e2e/
hybrid-qa tiers already pin pool:'forks' + maxWorkers + retry against this
exact unbounded-fan-out saturation; the unit tier never got the caps.

Add to the unit project:
- pool: 'forks'
- maxWorkers: 4 on CI (unbounded locally)
- retry: 1 on CI (absorbs a lone transient boot blip; a deterministic
  failure still fails both tries, so this masks nothing real)

Verified: admin-schema-ext.test.js + scan-markdown-source.test.ts pass
20/20 under CI=true with the new pool settings.
@jung-thomas
jung-thomas merged commit c188afe into DEV Oct 13, 2026
4 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-unit-pool-flakiness branch October 13, 2026 13:20
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.

1 participant