Skip to content

Commit 6392b9c

Browse files
os-muskos-muskclaude
authored
test(driver-sql): budget the 8th live-cell hook, reached through rawDriver() (#14950)
The `beforeAll` of the `Field.datetime on MySQL (#3942)` suite builds no driver in its own body — it calls the module-level `rawDriver()` helper, which hard-codes `MYSQL_CELL.config()`. That one level of indirection is why the #14213 walk, which read each hook's own `new SqlDriver(...)` argument, reached the three `beforeEach` hooks in this file and not this one. Give it the same explicit `60_000` third argument the seven sites of PR #14629 landed with, plus a note recording why the narrow walk missed it and that a hook inherits `hookTimeout` (measured 10000ms in this package's config, which sets neither timeout), not `testTimeout` (5000ms). Re-running the walk with one level of helper indirection resolved: at `13b520069^` it reports 5 inline-only + 2 inline+helper + 1 indirect-only = 8; at HEAD with this change, 8 budgeted and 0 unbudgeted. No ninth site. Claude-Session: https://claude.ai/code/session_0112hMx9hjJ9BgB28X97DS68 Co-authored-by: os-musk <elon@objectstack.ai> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 77a532d commit 6392b9c

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

packages/drivers/driver-sql/src/sql-driver-datetime-mysql-storage.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,28 @@ describe.skipIf(!URL)('Field.datetime on MySQL (#3942)', () => {
5454
let driver: SqlDriver;
5555
let serverTimeZone = '';
5656

57+
// ── Why this beforeAll carries an explicit 60_000 budget (#14628) ──
58+
// The live cell is one indirection away: this hook builds no driver of its
59+
// own, it calls `rawDriver()` above — which hard-codes `MYSQL_CELL.config()`,
60+
// unconditionally LIVE, not a parametrised `cell.config()` that would be
61+
// SQLite for the sqlite cell. So the probe pays a real live connect, a
62+
// `select @@global.time_zone` round trip and a disconnect against the cell's
63+
// MySQL server. That one level of indirection is the whole reason the #14213
64+
// walk — which read each hook's OWN `new SqlDriver(...)` argument — did not
65+
// reach this site while it did reach the three beforeEach hooks below.
66+
// ⚠️ A hook inherits `hookTimeout`, NOT `testTimeout`. Measured in this
67+
// package's config (which sets neither, so both are vitest's own defaults):
68+
// an unbudgeted hook dies at 10000ms ("Hook timed out in 10000ms"), not at
69+
// the 5000ms an unbudgeted it() gets.
70+
// A beforeAll is the LIGHTEST shape in this class — the cost is paid once
71+
// per suite, not once per test — and ⛔ this is NOT a claim that the hook is
72+
// known to time out: it was found by an AST walk, never by a measured red.
5773
beforeAll(async () => {
5874
const probe = rawDriver();
5975
const rows = await rowsOf(probe, `select @@global.time_zone as tz`);
6076
serverTimeZone = String((rows[0] as any).tz);
6177
await probe.disconnect();
62-
});
78+
}, 60_000);
6379

6480
// ── Why this beforeEach carries an explicit 60_000 budget (#14213) ──
6581
// The driver argument here is `MYSQL_CELL.config()` — unconditionally LIVE,

0 commit comments

Comments
 (0)