Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .changeset/service-datasource-vitest-testtimeout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@objectstack/service-datasource": patch
---

fix(service-datasource): give this package's vitest run a 60s `testTimeout` — close the #4856 coverage hole that let the merge queue evict unrelated PRs (#6044)

`packages/services/service-datasource` had no `vitest.config.ts` at all, so
every case ran under vitest's **5000ms** default. #4856 fixed this class of
flake by setting per-package timeouts in each package's own `vitest.config.ts`
— a structure that cannot reach a package with no config file to carry it.

The cases that build a REAL driver pay a one-time `@objectstack/driver-sql`
(knex) import inside the first case that reaches it. In
`datasource-pool-support.test.ts` the pool rejections throw before that import,
so "sqlite WITHOUT a pool still builds exactly as before" is the first case
through it: measured idle it runs ~1.1s while its neighbours run 0-2ms (the
postgres/mysql cases ride the module cache at 31/82ms). ~4.6x headroom against
5000ms holds on a PR branch and not on a merge-queue runner building several
PRs' batches at once — the observed signature: intermittent reds only in queue
full builds, evicting PRs that never touched this package (#5999 twice, #5973
once, 2026-08-06).

`testTimeout: 60_000` reuses #4856's value rather than inventing a new number,
set at the config layer so future cases are covered on arrival. Isolation was
reviewed rather than assumed (the #6044 triage forbade a timeout-only closure):
the flaky case builds `:memory:`, unprobed on the production path, never opens
a connection or loads the native addon, and every factory-door case destroys
its knex handle; the boot and wizard doors run on per-case fakes. No temp
files, no ports, no shared mutable state across cases — the red was load
variance on a real one-time import, not a leak.

No runtime, schema or public API change — test configuration only.
21 changes: 21 additions & 0 deletions packages/services/service-datasource/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
environment: 'node',
// This package had no vitest config at all, so every case ran under
// vitest's 5000ms default — the structural hole #4856 could not cover
// (it set per-package timeouts in each package's own vitest.config.ts,
// and this package had none). The cases that build a REAL driver pay a
// one-time `@objectstack/driver-sql` (knex) import inside the first case
// that reaches it: measured idle that case runs ~1.1s
// (datasource-pool-support "sqlite WITHOUT a pool"), leaving ~4.6x
// headroom that a loaded merge-queue runner eats — the #6044 signature
// (green on every PR branch, intermittently red only in queue full
// builds). 60s reuses #4856's value rather than inventing a new number,
// set at the config layer so future cases are covered on arrival.
testTimeout: 60_000,
},
});
Loading