From 28244c5f43239d44358ce234fbf5fb6a3ea3046e Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Fri, 1 May 2026 06:07:14 +0000 Subject: [PATCH] Fix capture-baseline.ts: postgres-js returns rows directly db.execute() with drizzle-orm/postgres-js returns rows as an array, not wrapped in a .rows property (that's node-postgres style). Writing qpTotals.rows etc. produced undefined and tripped writeFileSync. Co-Authored-By: Claude Opus 4.7 --- scripts/capture-baseline.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/capture-baseline.ts b/scripts/capture-baseline.ts index 838f83f..ce2d46a 100644 --- a/scripts/capture-baseline.ts +++ b/scripts/capture-baseline.ts @@ -56,9 +56,9 @@ async function main() { writeFileSync( join(OUT_DIR, "qp-totals-pre-phase1.json"), - JSON.stringify(qpTotals.rows, null, 2) + JSON.stringify(qpTotals, null, 2) ); - console.log(` Wrote ${qpTotals.rows.length} rows → qp-totals-pre-phase1.json`); + console.log(` Wrote ${qpTotals.length} rows → qp-totals-pre-phase1.json`); // ─── 2. Capture event_results with qualifying_points_awarded ───────────────── @@ -75,9 +75,9 @@ async function main() { writeFileSync( join(OUT_DIR, "event-results-pre-phase1.json"), - JSON.stringify(eventResults.rows, null, 2) + JSON.stringify(eventResults, null, 2) ); - console.log(` Wrote ${eventResults.rows.length} rows → event-results-pre-phase1.json`); + console.log(` Wrote ${eventResults.length} rows → event-results-pre-phase1.json`); // ─── 3. Capture participant_surface_elos ────────────────────────────────────── @@ -93,9 +93,9 @@ async function main() { writeFileSync( join(OUT_DIR, "surface-elos-pre-phase1.json"), - JSON.stringify(surfaceElos.rows, null, 2) + JSON.stringify(surfaceElos, null, 2) ); - console.log(` Wrote ${surfaceElos.rows.length} rows → surface-elos-pre-phase1.json`); + console.log(` Wrote ${surfaceElos.length} rows → surface-elos-pre-phase1.json`); // ─── 4. Capture simulator output for in-flight qualifying-points seasons ───── @@ -135,9 +135,9 @@ async function main() { } console.log(`\n✓ Baseline capture complete!`); - console.log(` ${qpTotals.rows.length} QP totals`); - console.log(` ${eventResults.rows.length} event results`); - console.log(` ${surfaceElos.rows.length} surface elo rows`); + console.log(` ${qpTotals.length} QP totals`); + console.log(` ${eventResults.length} event results`); + console.log(` ${surfaceElos.length} surface elo rows`); console.log(` ${simCount} simulator outputs (non-deterministic)`); console.log(`\nOutput: ${OUT_DIR}`);