From ca77d507f62c14e8fab58495b773b62c807d39d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 25 Oct 2026 06:51:51 +0100 Subject: [PATCH] test(rollups): compare migration 0372's untouched columns right after it ran A later case in the file folds the rollups again, and a fold sums in the order its plan reads, so the second fold's sums could differ from the first's in the last bit; the comparison read the table after that fold. --- .../integration/pulse-hourly-mean-migration.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/integration/pulse-hourly-mean-migration.test.ts b/tests/integration/pulse-hourly-mean-migration.test.ts index 053c22c77..1ca206083 100644 --- a/tests/integration/pulse-hourly-mean-migration.test.ts +++ b/tests/integration/pulse-hourly-mean-migration.test.ts @@ -102,6 +102,13 @@ const readRows = () => `; let before: Row[] = []; +/** + * The rows right after the migration. "Matches what the writer stores now" + * folds the rollups again, and a fold sums in whatever order the plan reads, + * so its sums can differ from the first fold's in the last bit; what the + * migration left is compared from here. + */ +let migrated: Row[] = []; beforeAll(async () => { await truncateAllTables(prisma); @@ -121,6 +128,7 @@ beforeAll(async () => { `; before = await readRows(); await runMigration(); + migrated = await readRows(); }, 120_000); const meanOf = (all: Row[], type: string, granularity: string, at?: number) => @@ -187,10 +195,9 @@ describe("migration 0372", () => { } }); - it("leaves every column but mean alone", async () => { - const after = await readRows(); + it("leaves every column but mean alone", () => { const strip = ({ mean: _mean, ...rest }: Row) => rest; - expect(after.map(strip)).toEqual(before.map(strip)); + expect(migrated.map(strip)).toEqual(before.map(strip)); }); it("is idempotent", async () => {