github MBombeck/HealthLog v1.4.35.1
v1.4.35.1 — Auto-converging rollup backfill on worker boot

latest release: v1.4.36
4 hours ago

Follow-on to v1.4.35. Removes the operator action that was implicit in the foundation release: instead of self-hosters having to run pnpm tsx scripts/backfill-rollups.ts after upgrading, the worker boot now discovers any account with measurements but no rollup coverage and enqueues a one-shot full fold via pg-boss. Idempotent across reboots and zero reader-path impact (serial concurrency, runs in the background).

What changed

  • New rollup-full-backfill queue (concurrency = 1) carrying { userId, enqueuedAt }. The handler invokes recomputeUserRollups(userId) with the default 5-year window across all four granularities — equivalent to the manual CLI run, but inside the worker process so no tsx install gymnastics in production images.
  • enqueueBootTimeRollupBackfill runs once at startReminderWorker boot after every boss.work subscription is in place. The discovery query finds users with at least one row in measurements and zero rows in measurement_rollups, then sends one job per uncovered account with singletonKey: boot-backfill|{userId} so a fast restart while a fold is queued doesn't pile up duplicates.
  • Best-effort: any error during discovery is captured in the return value and logged through workerLog; the worker boot never fails because the backfill missed.

Why this matters for self-hosters

v1.4.35 shipped a scripts/backfill-rollups.ts CLI for the one-shot historical fold, but running it on a production container requires pnpm dlx tsx plus a manual symlink for the Prisma client (devDeps + pnpm symlink layout aren't part of the Next.js standalone image). This release moves that work onto the worker boot so the activation path is genuinely zero-touch.

Tests

  • 5 new unit cases pin the helper's contract (silent no-op without boss, one job per uncovered user, singleton-key coalesce counted as skipped, error surfacing, zero-users path).
  • 2 new integration cases verify against a real Postgres testcontainer: only the uncovered user lands on the queue when a third already-folded user co-exists; zero jobs enqueued when every account is already covered.
  • Unit suite 4280 → 4285. Integration suite 228 → 230. pnpm typecheck + pnpm lint clean.

Don't miss a new HealthLog release

NewReleases is sending notifications on new releases.