From 61208da6ecd88f0a5c45a7efefc71b78a19ec331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 17 May 2026 23:55:44 +0200 Subject: [PATCH] test(rollups): force synchronous recompute before reading the aggregate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.4.37.1 read-path hotfix changed `ensureUserRollupsFresh` from an awaited populator to a fire-and-forget. On a cold testcontainer the integration test inserts measurements and immediately reads through `buildComprehensiveAggregate`, which now no longer waits for the rollup-write path to land — the coverage probe sees no buckets and the `dailyByType` branch returns an empty object. Calls `recomputeUserRollups(user.id)` explicitly in the test setup so the rollup-driven branch is exercised deterministically. Matches the production warm-cache contract (the test was always asserting the rollup-fed shape, just no longer racing against it). --- tests/integration/measurement-rollups.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration/measurement-rollups.test.ts b/tests/integration/measurement-rollups.test.ts index 297df4b5c..b61790003 100644 --- a/tests/integration/measurement-rollups.test.ts +++ b/tests/integration/measurement-rollups.test.ts @@ -419,6 +419,13 @@ describe("measurement rollups — integration", () => { } await prisma.measurement.createMany({ data: rows }); + // v1.4.37.1 — the aggregator now fires `ensureUserRollupsFresh` + // and-forgets; on a cold testcontainer that means the rollups are + // not yet present when the aggregate reads. Force a synchronous + // recompute here so the rollup-driven `dailyByType` branch is + // exercised (matches the production warm-cache path). + await recomputeUserRollups(user.id); + const aggregate = await buildComprehensiveAggregate(user.id); // Parallel live aggregation — same shape the legacy SQL emitted.