From 6982f60f4d1ca2e02f6cd25595ae6476d2f4a2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 25 Oct 2026 07:16:44 +0100 Subject: [PATCH] test(series): seed the unanalysed guard's blood pressure at a fixed hour The guard seeded each day's pair six hours before the clock, with the second source ten minutes later. Run between 05:50 and 06:00 UTC, the newest day's second pair landed just past midnight, alone on a UTC day of its own; the pick rightly chose that source for that day, the old DISTINCT ON statement chose the same, and the assertion that every series row is the first source failed for those ten minutes of the day, on every Postgres major. The pairs now sit at 10:00 and 10:10 UTC from yesterday back, whatever the clock. With the clock pinned to 05:55 UTC the old fixture fails the three series shapes and the new one passes, on 16 and 18 alike. --- .../integration/canonical-source-pick-unanalysed.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/canonical-source-pick-unanalysed.test.ts b/tests/integration/canonical-source-pick-unanalysed.test.ts index f968ae8e5..997abcb1c 100644 --- a/tests/integration/canonical-source-pick-unanalysed.test.ts +++ b/tests/integration/canonical-source-pick-unanalysed.test.ts @@ -95,8 +95,14 @@ function seedRows(): Prisma.MeasurementCreateManyInput[] { unit: type === "PULSE" ? "bpm" : "mmHg", measuredAt: new Date(at), }); + // Blood pressure at 10:00 UTC (the second source at 10:10) from yesterday + // back, never relative to the clock: a reading taken six hours before a run + // at 05:50 to 06:00 UTC put the second source's pair just past midnight, on + // a UTC day of its own, where the pick rightly chose it and the series + // assertion below failed for that ten minutes of the day. + const bpDay = Math.floor(now / DAY) * DAY - DAY + 10 * 3_600_000; for (let d = 0; d < 3000; d += 1) { - const at = now - (d + 0.25) * DAY; + const at = bpDay - d * DAY; push("BLOOD_PRESSURE_SYS", "WITHINGS", 120 + (d % 30), at); push("BLOOD_PRESSURE_DIA", "WITHINGS", 75 + (d % 15), at); if (d % 3 === 0) {