Skip to content

[finding] driver-sql: an 8th unbudgeted live-cell hook, reached through the rawDriver() helper rather than an inline argument (found by the #14213 walk, deliberately not fixed there) #14628

Description

@os-musk

Recording only — unassigned. Found while implementing #14213, and deliberately not folded into its PR: that card's dispatch bounded the file surface to the seven sites it names and its lineage explicitly rules out silent package-wide creep. The seat decides what happens next.

The site

packages/drivers/driver-sql/src/sql-driver-datetime-mysql-storage.test.ts — the beforeAll of the Field.datetime on MySQL (#3942) suite (line 57 on origin/main at 79c71d29d, unchanged by #14213's PR):

const rawDriver = () => new SqlDriver(MYSQL_CELL.config());   // line 51
...
  beforeAll(async () => {
    const probe = rawDriver();
    const rows = await rowsOf(probe, `select @@global.time_zone as tz`);
    serverTimeZone = String((rows[0] as any).tz);
    await probe.disconnect();
  });                                                          // no third argument

Why #14213's walk classified it as a different shape

#14213 enumerates hooks whose own new SqlDriver(...) argument is unconditionally live. This hook has no new SqlDriver(...) in its body at all — it calls the module-level one-liner rawDriver(), which hard-codes MYSQL_CELL.config(). So it is unconditionally live in effect, one indirection away, and it does pay a real live cost: a full connect cycle against the cell's MySQL server, a select @@global.time_zone round trip and a disconnect.

Two of the seven sites #14213 does fix (the beforeEach hooks of the #3942 migration and #3954 migrate plan suites) also call rawDriver(), but they additionally construct a driver inline, which is why the narrow walk caught them and not this one.

Measurement

A third scan resolving one level of helper indirection over all 160 test files in the package finds exactly one such indirect-only site — this one. Reproduced on origin/main:

Scan Definition Count
Narrow (the #14213 population) hook's own new SqlDriver(...) argument is PG_CELL.config() / MYSQL_CELL.config(), no budget 7
Superset unbudgeted hook naming a live cell constant anywhere in its body 7 (same set)
Indirect unbudgeted hook reaching a live driver through a module-level helper 3, of which 1 is not already in the seven

Note on severity, not a claim of urgency

Per #14213's own measurement, an unbudgeted hook inherits hookTimeout (measured 10000ms in this package's config, which sets neither timeout), not testTimeout (5000ms). This is a beforeAll, so the cost is paid once per suite rather than per test — the lightest shape in the class. It has never been observed to time out; it was found by an AST walk, never by a measured red.

If someone budgets it, the mechanical form is the established one: a third argument of 60_000 plus a short note, matching sql-driver-backend-fault-envelope.test.ts (#14100 / PR #14212) and the seven sites in #14213's PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions