From bb3a68648a66c4049fcd4125a096b51b3c45a01a Mon Sep 17 00:00:00 2001 From: implementer Date: Sun, 30 Aug 2026 01:24:14 +0000 Subject: [PATCH] fix: inject the ledger into MigrationRunner (type-only import) so probes load the committed module under type stripping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node's type stripping does not rewrite './ledger.js' to './ledger.ts', so the runner's runtime import of the ledger could not resolve when the behavioral probes execute the committed runner.ts directly (CI failure on Node 24). The ledger is now imported type-only and the caller passes the instance (new MigrationLedger(pool)) — the probes already do. runner.ts has no runtime imports left, so type stripping erases them and the committed module loads as-is. --- packages/database-postgres/src/runner.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/database-postgres/src/runner.ts b/packages/database-postgres/src/runner.ts index 8d65f0a..f2f36c5 100644 --- a/packages/database-postgres/src/runner.ts +++ b/packages/database-postgres/src/runner.ts @@ -33,7 +33,7 @@ */ import type { Pool } from 'pg'; -import { MigrationLedger } from './ledger.js'; +import type { MigrationLedger } from './ledger.js'; /** * A single migration step: an identifier (recorded in the ledger once the @@ -136,14 +136,17 @@ export class MigrationRunner { private readonly migrations: readonly Migration[]; /** - * @param pool The package-owned PostgreSQL pool (`pg.Pool`). + * @param pool The package-owned PostgreSQL pool (`pg.Pool`), handed to each + * migration's `up`. * @param migrations The migrations to run, in apply order (oldest first). - * @param ledger The migration ledger; defaults to one sharing `pool`. + * @param ledger The migration ledger (E00-S03-T03) the runner reads applied + * versions from and records applied migrations into; constructed by the + * caller from the same pool (`new MigrationLedger(pool)`). */ - constructor(pool: Pool, migrations: readonly Migration[], ledger?: MigrationLedger) { + constructor(pool: Pool, migrations: readonly Migration[], ledger: MigrationLedger) { this.pool = pool; this.migrations = migrations; - this.ledger = ledger ?? new MigrationLedger(pool); + this.ledger = ledger; } /**