refactor(medications): drop the compliance rollup table that nothing reads

medication_compliance_rollups lost its last reader when compliance moved
to the schedule-anchored computation, yet every dose write still upserted
it, a boot backfill refolded it, and the wipe and backup plans carried it.

The per-dose hook keeps the one derived row that still hangs off a dose
day, the supplement nutrients, under dose-day-refresh. The pending-row
mints (today projection, reminder) no longer call it, since an untaken
dose adds no nutrients. The import job finishes without its per-day
recompute phase; its progress keeps touchedDays and rollupProcessed on
the wire, inert and documented as deprecated. The backfill queue is
retired on boot and migration 0414 drops the table under a bounded lock
wait.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 13:01:45 +02:00
1 parent b90c82cba3
commit 41de0ca126
71 files changed
+314 -2027

No files matched your search

@@ -1355,13 +1355,15 @@ export const medicationImportProgress = z
touchedDays: z
.array(z.string())
.describe(
"Local calendar days (YYYY-MM-DD) touched so far, driving the chunked rollup recompute behind the write.",
"Deprecated and inert: always `[]` on a job admitted from v1.43.8, when the per-day compliance rollup it drove was removed. A job admitted earlier keeps the days it recorded. Kept for clients that decode it; do not read it.",
),
rollupProcessed: z
.number()
.int()
.min(0)
.describe("Of `touchedDays`, how many have had their rollup recomputed."),
.describe(
"Deprecated and inert: always `0` on a job admitted from v1.43.8. Kept for clients that decode it; do not read it.",
),
})
.meta({
id: "MedicationImportProgress",
+1 -1
View File
@@ -2326,7 +2326,7 @@ export const profilePaths: NonNullable<ZodOpenApiObject["paths"]> = {
summary: "Set the account timezone",
description:
"Lifted out of the profile patch so the picker can send one field without round-tripping the rest. Accepts any zone the running engine's `Intl` knows; anything else is 422 rather than stored, so the resolver never has to defend against a poisoned column. Audit-logged with the old and new zone.\n\n" +
"A change is not only a display preference. The medication-compliance rollup keys its rows by the LOCAL day a dose fell on, minted under whatever zone was in force at write time, so moving the zone re-buckets that history and the stored keys go stale — and the coverage probe compares counts rather than keys, so it cannot notice. The route therefore enqueues a re-fold of the trailing window whenever the zone actually changes. Best-effort and de-duplicated, so rapid re-picks collapse into one.",
"A change is not only a display preference. The supplement nutrient rows key on the LOCAL day a dose fell on, minted under whatever zone was in force at write time, so moving the zone re-buckets them. The route therefore enqueues a recompute of the account's supplement nutrients whenever the zone actually changes. Best-effort and de-duplicated, so rapid re-picks collapse into one.",
requestBody: {
required: true,
content: { "application/json": { schema: timezonePutRequest } },