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.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 11:40:34 +02:00
1 parent db2d864a8e
commit f0a0551a80
1 file changed
+1
+1
View File
@@ -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}