diff --git a/.planning/round-audit-marathon-closure.md b/.planning/round-audit-marathon-closure.md index 9c90fef6a..7515266e3 100644 --- a/.planning/round-audit-marathon-closure.md +++ b/.planning/round-audit-marathon-closure.md @@ -16,6 +16,11 @@ Shipped: 2026-05-17 → 2026-05-18 (thirteen consecutive releases — capped by | v1.4.38.2 | Mood-reminder hotfix bundle + Settings toggle — six-axis QA on PR #190 surfaced enough real bugs that the feature could not have been used safely (locale resolver demoted 4 of 6 locales to English; ledger committed BEFORE delivery, so a transient APNs blip silently nuked the day's nudge AND blocked retries; DST arithmetic drifted the local-22:00 baseline by an hour twice a year; APNs payload forwarded Telegram `replyMarkup` to Apple + lockscreen; **no Settings UI to opt in** = dead opt-in). v1.4.38.2 closes all of the above plus adds `MoodReminderCard` Switch, `dispatchNotification` outcome bubble, `localHmAsUtc` DST-safe helper, APNs metadata allowlist, per-user `try` wrapper, 90-day retention sweep, dead-code drop, CHANGELOG `EVENT_DEFAULT_ENABLED` identifier-leak scrub. Unit suite 4565 → 4551 (mood-reminder.test.ts rewrite for new contract, not coverage loss). | [v1.4.38.2](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.2) | | v1.4.38.3 | CI green-up + chunk-load auto-recover — three pre-existing main reds closed (TODO marker on correlations `degraded` sentinel, rollup integration test racing the v1.4.37.1 fire-and-forget rollup populator, e2e drift after the v1.4.37 doctor-report hero refactor + the dashboard touch-target gate + `measurement-flow` mock missing `unit`/`source`). Plus new `AppError` branch detects the chunk-load error family and auto-reloads the SPA once per session — closes the stale-shell paper-cut after every deploy. Squash skipped: six atomic Marc-Voice commits landed directly on main, then back-merged to develop. | [v1.4.38.3](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.3) | | v1.4.38.4 | Pro-active stale-shell self-heal — Marc reported `healthlog.bombeck.io` "nicht erreichbar" on the v1.4.38.3 PWA; live curl was 100 % healthy (`/api/version` + `/api/health` both 200), so the symptom traced to a cached pre-v1.4.38.3 shell that never tripped the new `AppError` reload path. v1.4.38.4 layers three fixes so future deploys self-heal without user action: `` client component mounted in `` polls `/api/version` every 60 s and on mismatch unregisters every SW, wipes CacheStorage, and `window.location.reload()`s (sessionStorage-gated to once per session); `next.config.ts` injects `NEXT_PUBLIC_APP_VERSION` from `package.json` at build time so the running shell knows which release it was built against; service worker `CACHE_VERSION` now keys to the release tag so the precached chunk graph is evicted on the next SW install. Tag re-pushed once after the editor-race dropped the `package.json` bump from the first release commit; the docker-publish workflow was cancelled mid-build and re-run from the correct commit. | [v1.4.38.4](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.4) | +| v1.4.38.5 | Analytics fast-path restored on long-running accounts — boot-time backfill discovery widened to find every user that lacks DAY-bucket coverage for a measurement type they actually have, not only the empty-rollup case. The post-v1.4.38 backfill had only discovered users with zero rollup rows total, leaving every long-running account stranded on the live-SQL path. New discovery query is per-(user, type) so any single uncovered type triggers a full fold. | [v1.4.38.5](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.5) | +| v1.4.38.6 | Boot-backfill discovery SQL fix — the widened v1.4.38.5 LEFT JOIN keyed on `bucket_start IS NULL` as the "no row" sentinel because `measurement_rollups` has no `id` column (composite PK). Without this fix the LEFT JOIN matched on the wrong key and the boot fold ran zero work. Single-line correctness fix; perf-verify continued into v1.4.38.7. | [v1.4.38.6](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.6) | +| v1.4.38.7 | Rollup recompute observability + admin trigger — `POST /api/admin/rollups/recompute` lets the operator synchronously fold one user or re-trigger boot-discovery without restarting the container. Adds `fallback_reason` + `missing_types` annotates on the slim-summaries live-fallback path so a slow `/api/analytics` cold mount maps to the responsible type in the wide-event. Boot-discovery now logs every result (including the silent "no users to backfill" case). | [v1.4.38.7](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.7) | +| v1.4.38.8 | Analytics fast-path gates per-type only — `isFullyCovered(coverage) && specificTypes` was poisoning every fast-path: a single uncovered orphan type (e.g. an iOS-pushed brand-new `ACTIVITY_FLIGHTS`) flipped the AND false and stranded the entire helper on live SQL across the full measurement table. `correlations-fast-path` now gates on `BLOOD_PRESSURE_SYS + PULSE + WEIGHT`; `bp-in-target-fast-path` on `BLOOD_PRESSURE_SYS + BLOOD_PRESSURE_DIA`; `health-score-fast-path` on `WEIGHT`. Cold-mount `/api/analytics` on power-user accounts drops from 30–75 s to ~3–5 s. Coverage-probe semantics unchanged. | [v1.4.38.8](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.38.8) | +| v1.4.39 | Mood + medication-compliance + cumulative-sum rollup tiers — extends the v1.4.38 fast-path posture to the two remaining cold-mount hot spots. New `mood_entry_rollups` (per-(user, granularity, bucket) mood stats) eliminates the unbounded `MoodEntry.findMany` walk on `/api/mood/analytics` (12.7 s → ~200 ms expected). New `medication_compliance_rollups` (per-(user, medication, day) scheduled / taken / skipped ledger anchored to user-tz `YYYY-MM-DD`) eliminates the unbounded intake-event walk on `/api/medications/intake?scope=compliance` (3.2 s → ~200 ms expected). New nullable `measurement_rollups.sum_value` column lets cumulative metrics (`ACTIVITY_STEPS / FLIGHTS_CLIMBED / WALKING_RUNNING_DISTANCE / TIME_IN_DAYLIGHT / ACTIVE_ENERGY`) skip per-type JS aggregation in the dashboard sparkline + `groupBy=day` paths. Defense-in-depth `since` cap on the `/api/analytics` live-fallback path (~347 k rows → ~5 k rows; 425 d window preserves `summary.avg30LastYear`). New WEEK / MONTH / YEAR reader helpers ready for the v1.5 multi-year trend card. Five wave agents in parallel + six QA reviewers + nine reconcile fixes (race-safe atomic upsert, partial-coverage probe, fire-and-forget worker enqueue, multi-entry-day summarize parity, DST-boundary test pin, user-scoped backfill enqueue, …). Tests 4 524 → 4 640 (+116). Squash to main clean. | [v1.4.39](https://github.com/MBombeck/HealthLog/releases/tag/v1.4.39) | ## Audit waves diff --git a/.planning/round-v1439-perf-verify.md b/.planning/round-v1439-perf-verify.md new file mode 100644 index 000000000..d03cde1ab --- /dev/null +++ b/.planning/round-v1439-perf-verify.md @@ -0,0 +1,68 @@ +# v1.4.39 — Post-deploy perf verification + +Live deploy: 2026-05-21T05:46:56Z — Coolify deploy uuid +`ujgsxpa46esyzybjldgxjeox`, commit hash +`d84922cdc3bfd118b10b74e6b8664a784837fe58`. + +Migrations applied at boot: + +``` +Applying migration `0070_v1439_mood_rollups` +Applying migration `0071_v1439_medication_compliance_rollups` +Applying migration `0072_v1439_rollup_sum_value` +All migrations have been successfully applied. +``` + +## Unauthenticated probes (from this orchestrator) + +| Endpoint | n | Median | Max | +| --- | --- | --- | --- | +| `GET /api/version` | 10 | **86 ms** | 104 ms | +| `GET /api/health` (Uptime-Kuma) | per-log | 18–78 ms | — | + +The 60 s response cache wrap is not yet warm for the authenticated +heavy endpoints — perf-verify on `/api/mood/analytics`, +`/api/medications/intake?scope=compliance`, +`/api/dashboard/summary`, `/api/analytics` waits for Marc's next +browser session against the live deploy. The current open-internet +probes confirm the public-surface contract is fast. + +## Coolify production log excerpt (boot) + +- App container boots in ~1.5 s after migrations. +- Reminder worker registered. +- `host_metric_sample` background job running every 30 s without + pressure. +- No 4xx / 5xx in the first ~2 min of logs. + +## What gets verified by Marc's first authenticated session + +For each of the four read-path swaps, the wide-event annotates +`meta..path = "rollup"` on the rollup-fast-path or +`path = "live"` on the fall-through. Marc loading the dashboard / +analytics page populates the 60 s LRU; a second mount within 60 s +hits warm cache (< 50 ms). The audit-predicted cold targets: + +| Endpoint | Pre-v1.4.39 cold | Expected v1.4.39 cold | +| --- | --- | --- | +| `/api/mood/analytics` | 12.7 s (live) | ~200 ms (rollup) | +| `/api/medications/intake?scope=compliance` | 3.2 s (live) | ~200 ms (rollup) | +| `/api/dashboard/summary` cumulative sparkline | ~500 ms | ~300 ms | +| `/api/analytics` full slice live-fallback row cap | 347 k rows | ~5 k rows (425 d) | + +## Self-heal verification + +`/api/version` returns `1.4.39` end-to-end (curl + 10× burst). The +`VersionPoller` from v1.4.38.4 will pick up the new version-string at +the next 60 s tick on Marc's browser shell; the cached pre-v1.4.39 +shell evicts CacheStorage + unregisters every SW + reloads +exactly once per session. + +## Next perf-verify checkpoint + +After Marc's first authenticated session, capture the wide-event +`path` annotates on each of the four endpoints from Coolify logs +and update this file with the live cold-mount numbers. v1.4.40 +backlog already covers the carry-over consumers +(`health-score-fast-path` swap, `/api/analytics` A2 cumulative skip, +slope90 monthly bucket).