From f0a0551a80d655a1cc1401e11f442c5e0d6f56b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 21 May 2026 11:40:34 +0200 Subject: [PATCH] fix(rollups): filter deletedAt in measurement-rollup readers `probeRollupCoverage` discovers the set of types the user has logged by selecting `DISTINCT "type" FROM measurements`. A type whose every row has been tombstoned would still surface, force the read path to demand rollup coverage for it, and silently push the request onto the live aggregator branch. Add `"deleted_at" IS NULL` so the discovery only returns types the user can still see. The rollup-read modules (`rollup-read`, `rollup-read-wmy`, `rollup-read-cumulative`) read from `measurement_rollups` which is already populated from the filtered writer in the previous commit, so they need no additional filter. --- src/lib/measurements/rollup-coverage.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/measurements/rollup-coverage.ts b/src/lib/measurements/rollup-coverage.ts index 5706bfe7a..76724d89d 100644 --- a/src/lib/measurements/rollup-coverage.ts +++ b/src/lib/measurements/rollup-coverage.ts @@ -55,6 +55,7 @@ export async function probeRollupCoverage( SELECT DISTINCT "type" FROM measurements WHERE user_id = ${userId} + AND "deleted_at" IS NULL ) m LEFT JOIN measurement_rollups r ON r.user_id = ${userId}