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
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,16 @@ describe('live-dialect matrix — the driver can SEE its own isolated schema (#9
driver = undefined;
});

// ── Why the two it() blocks below carry an explicit 60_000 budget (#14100) ──
// Both construct a FRESH `new SqlDriver(PG_CELL.config())` against the live
// Postgres cell inside their own body and then drive `initObjects(...)`, so
// the connect cycle plus schema-sync DDL and catalog read-back are paid PER
// TEST rather than once in a beforeAll. With no third argument vitest applies
// its own 5000ms default — a number nobody chose for that work, and one that
// reddens unrelated PRs when the runner is merely a bit slow. Sized to match
// this package's live-DDL siblings (#13902 / #13688). ⛔ NOT a claim that
// these tests are known to be slow: they were found by an AST walk over the
// package, never by a measured timeout here.
it.skipIf(!PG_CELL.available)(
'postgres: index introspection reports the indexes that exist in the file’s schema',
async () => {
Expand Down Expand Up @@ -309,6 +319,7 @@ describe('live-dialect matrix — the driver can SEE its own isolated schema (#9
expect(seen.some((i: any) => i.primary)).toBe(true);
expect(seen.some((i: any) => i.unique && !i.primary)).toBe(true);
},
60_000,
);

it.skipIf(!PG_CELL.available)(
Expand All @@ -320,5 +331,6 @@ describe('live-dialect matrix — the driver can SEE its own isolated schema (#9
const introspected = await driver.introspectSchema();
expect(Object.keys(introspected.tables ?? {})).toContain(TABLE);
},
60_000,
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ describe(`sql-driver — attemptWithoutPoisoning (${pgCell.available ? 'live pos
// The mechanism itself, pinned directly: this is what makes the SECOND
// speculative site (`SELECT … FOR UPDATE`, which has no `ON CONFLICT` form)
// safe as well. Postgres-only for the same reason as above.
// ── Why the it() below carries an explicit 60_000 budget (#14100) ──
// It constructs a FRESH `new SqlDriver(pgCell.config())` against the live
// Postgres cell inside its own body, then creates and drops a probe table, so
// the connect cycle and its DDL are paid PER TEST rather than once in a hook.
// With no third argument vitest applies its own 5000ms default — a number
// nobody chose for that work, and one that reddens unrelated PRs when the
// runner is merely a bit slow. Sized to match this package's live-DDL
// siblings (#13902 / #13688). ⛔ NOT a claim that this test is known to be
// slow: it was found by an AST walk over the package, never by a measured
// timeout here.
it.skipIf(!pgCell.available)(
'leaves the surrounding transaction usable after a statement error',
async () => {
Expand Down Expand Up @@ -195,5 +205,6 @@ describe(`sql-driver — attemptWithoutPoisoning (${pgCell.available ? 'live pos
await driver.disconnect();
}
},
60_000,
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,23 @@ function declareSweep(cell: DialectCell): void {
describe(`[#8931] driver-sql — the terminal backend-fault envelope (${cell.label})`, () => {
let driver: SqlDriver;

// ── Why this beforeAll carries an explicit 60_000 budget (#14100) ──
// The it() blocks in this file are deliberately NOT budgeted: each only sends
// a query or two down a connection this hook already opened, so their cost
// model really is the fast one. But the live cost did not disappear — it
// lives HERE: a full connect cycle, two drops, `initObjects(...)` schema-sync
// DDL and two inserts, all against the cell's live server. ⚠️ A hook inherits
// `hookTimeout`, NOT `testTimeout` — measured in this package's config, an
// unbudgeted hook dies at 10000ms ("Hook timed out in 10000ms"), not at the
// 5000ms an unbudgeted it() gets. Ten seconds is still the wrong ceiling for
// this much live work, and the third argument does lift it (measured).
// Budgeting the it() blocks would have been wrong;
// leaving the hook unbudgeted just moved the exposure one scope outward.
// Budgeting hooks is established practice in this package (see the beforeAll
// hooks in sql-driver-diagnostic-value-probe, sql-driver-12380-json-roundtrip,
// sql-driver-13567-audit-stamp-materialisation and
// sql-driver-value-roundtrip-conformance). ⛔ NOT a claim that this hook is
// known to time out: it was found by an AST walk, never by a measured red.
beforeAll(async () => {
driver = new SqlDriver(cell.config());
await driver.execute(`drop table if exists ${TABLE}`).catch(() => {});
Expand All @@ -166,7 +183,7 @@ describe(`[#8931] driver-sql — the terminal backend-fault envelope (${cell.lab
]);
await driver.create(TABLE, { id: 't1', title: 'Design', rank: 1 }, { bypassTenantAudit: true });
await driver.create(TABLE, { id: 't2', title: 'Build', rank: 2 }, { bypassTenantAudit: true });
});
}, 60_000);

afterAll(async () => {
await driver.execute(`drop table if exists ${TABLE}`).catch(() => {});
Expand Down Expand Up @@ -340,14 +357,19 @@ declareDialectCell(PG, 'backend-fault envelope — the pg-only rows', (cell) =>
describe('[#8931] postgres — the dotted route and the value-bearing diagnostic', () => {
let driver: SqlDriver;

// ── Why this beforeAll carries an explicit 60_000 budget (#14100) ──
// Same reasoning as the hook in `declareSweep` above, on the Postgres-only
// pair: a live connect, a drop, `initObjects(...)` DDL and an insert, none of
// which the two it() blocks below repeat. ⛔ NOT a claim that this hook is
// known to time out — found structurally, not by a measured red.
beforeAll(async () => {
driver = new SqlDriver(cell.config());
await driver.execute(`drop table if exists ${TABLE}_pg`).catch(() => {});
await driver.initObjects([
{ name: `${TABLE}_pg`, fields: { title: { type: 'string' }, rank: { type: 'integer' } } },
]);
await driver.create(`${TABLE}_pg`, { id: 't1', title: 'Design', rank: 1 }, { bypassTenantAudit: true });
});
}, 60_000);

afterAll(async () => {
await driver.execute(`drop table if exists ${TABLE}_pg`).catch(() => {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ describe.skipIf(!PG_URL)('#10995 — live Postgres, driver told about the object

// ── §3 The other posture with the same empty registry: DDL REFUSED ───────

// ── Why the it() below carries an explicit 60_000 budget (#14100) ──
// Unlike §1–§2, which reuse the connection the beforeAll opened, §3 builds a
// SECOND live driver (`guest`) inside its own body and runs an out-of-band
// `create table` through it — a full connect cycle plus DDL, paid by this
// test alone. With no third argument vitest applies its own 5000ms default —
// a number nobody chose for that work, and one that reddens unrelated PRs
// when the runner is merely a bit slow. Sized to match this package's
// live-DDL siblings (#13902 / #13688). ⛔ NOT a claim that this test is known
// to be slow: it was found by an AST walk over the package, never by a
// measured timeout here.
it('§3 a datasource we are a guest in registers its objects even though DDL is refused', async () => {
// `schemaMode !== 'managed'` (ADR-0015): `initObjects` must still refuse the
// DDL — and must no longer leave the driver ignorant of the objects it was
Expand All @@ -188,7 +198,7 @@ describe.skipIf(!PG_URL)('#10995 — live Postgres, driver told about the object
} finally {
await guest.disconnect();
}
});
}, 60_000);
});

// ── §4 The SQLite path is unchanged ────────────────────────────────────────
Expand Down
Loading