mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
chore(release): v1.4.49 — audit-backlog closure + server reminder suppression + diagnostic endpoint + analytics cold-path fix
Bundles the deferred v1.4.47 Mediums + Lows with the v1.4.48-deferred items into a single release. Headline: server-side suppression of MEDICATION_REMINDER APNs for iOS clients that own their local reminders (closes GH #206), a push_attempts table backing /api/admin/notifications/diagnostic, and a sweep of v1.4.48 QA forward-findings. Performance (the user-visible win): - /api/analytics cold-fallback path splits the heavy single-statement aggregate into two parallel queries. The linearly composable columns (count / min / max / mean) keep the full-partition scan; the windowed 7 / 30 / 90-day avg / slope / r² columns take a 90-day outer cap so the planner does an index range scan on (user_id, type, measured_at) instead of a full-partition sequential scan. Output is bit-identical; cold slim slice drops from multi-second to sub-second on tenants with large measurement partitions. Server-side notifications: - GET + PATCH /api/auth/me/notification-prefs with deep-merge semantics. Initial category medication.clientManaged: boolean (default false). Cron medicationReminderJob skips dose-due APNs when the flag is true, emitting a medication_reminder.suppressed_client_managed wide-event annotation per skip. - push_attempts table backs the diagnostic endpoint. Every APNS / Web-Push / Telegram / NTFY sender writes a fire-and-forget row. Daily 03:35 Europe/Berlin cleanup prunes rows older than 90 days. - /api/admin/notifications/diagnostic — admin-only endpoint surfacing device APNs token presence (masked), channel config presence, and recent push attempts. Registered in OpenAPI. - Per-channel APNs "Send test" button now fires with eventType: "MEDICATION_REMINDER" so the dispatcher's time-sensitive + priority-10 branch runs. A successful self-test now exercises the exact path production reminders take; an unsuccessful one points the user at iOS Settings → Time Sensitive Notifications rather than appearing to be a server-side bug. Withings reliability: - OAuth callback consumes the nonce atomically (delete-first with P2025 catch for the replay branch). The previous read-then-delete pattern allowed a race between two concurrent callbacks. - ?reason=state redirect differentiated into csrf1 / replay / expired / cross_user so operators can tell mismatch types apart without DB shell access. - connect endpoint rate-limited to 10/60s/user; row-create failures redirect to a consistent error surface. Observability hardening: - redactSensitiveFields(body) denylist helper covers password / token / secret / apiKey / authorization / csrfState / nonce, recursive, case-insensitive. Caught: /api/devices invalid_format issues were echoing apnsToken values verbatim into the audit log. - sanitiseZodIssues(issues, { stripValuesFromMessage: true }) overload applied to 14 audit-log sites. Migrations: 0079 (notification_prefs), 0080 (push_attempts). Tests: 4815 → 5272 unit + integration. Workout-batch integration suite that had been red on main since v1.4.45 (three release commits shipped through it) now green again — updated to match v1.4.42 cross-source dedup semantics. Resolves PR #207.
This commit is contained in:
1 parent
30ab2112db
commit
f92e644154
87 files changed
+7939
-2950
No files matched your search
@@ -219,7 +219,7 @@ describe("parkIntegrationAtReauth — silent scope-skip park (v1.4.27 F20)", ()
|
||||
});
|
||||
// The whole point of the helper: counter is not in the update set.
|
||||
// v1.4.47 W1 — the legacy `consecutiveFailures` column was dropped
|
||||
// (migration 0076); the per-kind bucket is the live counter now.
|
||||
// (migration 0077); the per-kind bucket is the live counter now.
|
||||
// Neither field appears in the update payload — the existing
|
||||
// bucket values are preserved exactly.
|
||||
expect(upsertArgs.update).not.toHaveProperty("consecutiveFailures");
|
||||
@@ -279,7 +279,7 @@ describe("parkIntegrationAtReauth — silent scope-skip park (v1.4.27 F20)", ()
|
||||
// genuine transient burst still has the full 3-strike runway.
|
||||
// v1.4.47 W1 — counter is now the per-kind bucket payload (the
|
||||
// legacy `consecutiveFailures` column was dropped in migration
|
||||
// 0076); a zero envelope is the equivalent seed.
|
||||
// 0077); a zero envelope is the equivalent seed.
|
||||
vi.mocked(prisma.integrationStatus.findUnique).mockResolvedValueOnce(null);
|
||||
vi.mocked(prisma.integrationStatus.upsert).mockResolvedValueOnce(
|
||||
{} as never,
|
||||
|
||||
@@ -98,7 +98,7 @@ describe("recordSyncSuccess", () => {
|
||||
// v1.4.43 W14 — success clears every per-kind bucket so the
|
||||
// next failure starts from zero in its own bucket.
|
||||
// v1.4.47 W1 — the legacy `consecutiveFailures` column was
|
||||
// dropped (migration 0076); the bucket reset is the only
|
||||
// dropped (migration 0077); the bucket reset is the only
|
||||
// counter write now.
|
||||
consecutiveFailuresByKind: {
|
||||
transient: 0,
|
||||
@@ -482,7 +482,7 @@ describe("markReauthRequired / markDisconnected / markReconnected", () => {
|
||||
lastError: null,
|
||||
// v1.4.43 W14 — disconnect must clear the per-kind buckets too.
|
||||
// v1.4.47 W1 — legacy `consecutiveFailures` column dropped
|
||||
// (migration 0076); the bucket reset is the only counter write.
|
||||
// (migration 0077); the bucket reset is the only counter write.
|
||||
consecutiveFailuresByKind: {
|
||||
transient: 0,
|
||||
reauth_required: 0,
|
||||
@@ -505,7 +505,7 @@ describe("markReauthRequired / markDisconnected / markReconnected", () => {
|
||||
// v1.4.43 W14 — reconnect clears the per-kind buckets so the
|
||||
// next sync starts on a clean slate.
|
||||
// v1.4.47 W1 — legacy `consecutiveFailures` column dropped
|
||||
// (migration 0076); the bucket reset is the only counter write.
|
||||
// (migration 0077); the bucket reset is the only counter write.
|
||||
consecutiveFailuresByKind: {
|
||||
transient: 0,
|
||||
reauth_required: 0,
|
||||
@@ -687,7 +687,7 @@ describe("recordSyncFailure — v1.4.43 W14 per-kind buckets", () => {
|
||||
|
||||
it("seeds a fresh zero envelope when the row has no bucket payload yet", async () => {
|
||||
// v1.4.47 W1 — the legacy `consecutiveFailures` column was dropped
|
||||
// (migration 0076). A row that has never written a bucket payload
|
||||
// (migration 0077). A row that has never written a bucket payload
|
||||
// (`consecutiveFailuresByKind: null`) starts from a zero envelope
|
||||
// on the next failure; the matching bucket ticks to 1 in a single
|
||||
// write.
|
||||
@@ -725,9 +725,9 @@ describe("recordSyncFailure — v1.4.43 W14 per-kind buckets", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── v1.4.47 W1 — migration 0076 down-script reversibility ──────────────
|
||||
// ── v1.4.47 W1 — migration 0077 down-script reversibility ──────────────
|
||||
//
|
||||
// Migration 0076 drops `consecutive_failures` and documents a down-script
|
||||
// Migration 0077 drops `consecutive_failures` and documents a down-script
|
||||
// that restores the legacy column via
|
||||
//
|
||||
// SET "consecutive_failures" = COALESCE(
|
||||
@@ -818,7 +818,7 @@ describe("resumeIntegrationFromPark", () => {
|
||||
state: "connected",
|
||||
lastError: null,
|
||||
// v1.4.47 W1 — legacy `consecutiveFailures` column dropped
|
||||
// (migration 0076); the bucket reset is the only counter write.
|
||||
// (migration 0077); the bucket reset is the only counter write.
|
||||
consecutiveFailuresByKind: {
|
||||
transient: 0,
|
||||
reauth_required: 0,
|
||||
|
||||
Reference in new issue
Block a user