Skip to content

test(autoCombo): warm task-fitness DB in beforeAll so first-call init can't time out (#15106) - #15253

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
yourspraveen:test/15106-autocombo-db-warmup
Oct 2, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
yourspraveen:test/15106-autocombo-db-warmup

Conversation

@yourspraveen

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15246

Closes #15106

Problem

Two AutoCombo Vitest tests time out at the 5 s default under parallel load, although both are pure computation:

  • open-sse/services/autoCombo/__tests__/autoCombo.test.ts: Scoring > should calculate a score between 0 and 1
  • tests/unit/autoCombo/tieredRotation.test.ts: Connection Density Factor > multi-connection provider scores higher than single-connection at same quality

Each is the first test in its file to call getTaskFitness(), and that first call pays the lazy, synchronous model-intelligence DB init (queryModelIntelligence, open-sse/services/autoCombo/taskFitness.ts).

Fix

The scoped fix from the issue thread, with no global testTimeout change:

  • Each of the two files gets a top-level beforeAll that calls getTaskFitness() once, with its own 30 s budget. The init cost lands in the hook; the per-test 5 s budget measures only the test.

Evidence

Measured with --reporter=verbose (the mechanism; this machine is not loaded enough to cross 5 s):

Test Before After
Scoring > should calculate a score between 0 and 1 220 ms 1 ms
multi-connection provider scores higher… 224 ms 2 ms

Neighbouring pure-computation tests in the same files take ~1 ms. The ~220 ms on an idle machine is the init that grew past 5 s on the reporter's loaded one.

npx vitest run --config vitest.mcp.config.ts tests/unit/autoCombo/ open-sse/services/autoCombo/
# Test Files  27 passed (27) | Tests  261 passed (261)

Note on the formatting diff in tieredRotation.test.ts

This file was never Prettier-clean. Prettier collapses (and on each run further scrambles) the 4-line comment that sat between the arguments of the rotates across all 43 Cerebras connection IDs it() call. That would have happened via the pre-commit hook on any change to the file.

  • I moved that comment, text unchanged, directly above the call. The 60000 timeout argument is untouched.
  • The rest of the diff in that file is Prettier formatting only.

Not changed: maxWorkers in vitest.mcp.config.ts (raised on the issue as worth revisiting). That's a broader runner decision, so I left it for a separate change.

Thanks @zerotraceio for the report and the careful re-measurement that pinned down the two tests.

… can't time out (diegosouzapw#15106)

The first getTaskFitness() call in a worker pays the lazy, synchronous
model-intelligence DB init (queryModelIntelligence). In autoCombo.test.ts
("Scoring > should calculate a score between 0 and 1") and
tieredRotation.test.ts ("Connection Density Factor > multi-connection
provider scores higher...") that call happens inside a pure-computation
test, so under parallel load the init alone could exceed the 5s default.

Add a top-level beforeAll warm-up with its own 30s budget to each file.
No global testTimeout change. Locally the two tests drop from ~220ms to
1-2ms; 27 files / 261 tests pass.

tieredRotation.test.ts was never Prettier-clean: Prettier collapses the
comment that sat between the arguments of the "rotates across all 43
Cerebras connection IDs" it() call. Move that comment, text unchanged,
above the call so the pre-commit formatter is stable; the remaining
diff in that file is formatting.

Closes diegosouzapw#15106
@diegosouzapw
diegosouzapw merged commit 90a663e into diegosouzapw:release/v3.8.52 Oct 2, 2026
15 of 16 checks passed
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @yourspraveen — merged into release/v3.8.52; it ships in the next release.

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.

fix: AutoCombo vitest tests time out at the 5s default under parallel load (first-call taskFitness DB init)

2 participants