From f2c3db4424aec269ca268b1a7b7f5c3a6d2771ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 23 May 2026 10:10:08 +0200 Subject: [PATCH] chore(comments): correct stale migration 0076 references The W1 column-drop migration was renumbered 0076 -> 0077 during the cherry-pick reconcile and Withings OAuth state took the 0076 slot. 12 in-code references still pointed at 0076. consecutiveFailures sites now read 0077; disable-coach sites read 0078. Comment-only sweep, no behavioural change. Closes M5 in v1.4.48 backlog. --- prisma/schema.prisma | 2 +- src/app/api/auth/me/disable-coach/route.ts | 2 +- src/app/api/auth/me/route.ts | 2 +- src/lib/integrations/__tests__/admin-alert.test.ts | 4 ++-- src/lib/integrations/__tests__/status.test.ts | 14 +++++++------- src/lib/integrations/status.ts | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 509ffb1a2..8a0033e80 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1409,7 +1409,7 @@ model IntegrationStatus { lastAttemptAt DateTime? @map("last_attempt_at") lastError String? @map("last_error") // AES-256-GCM encrypted (may contain token-fragment metadata) // v1.4.47 W1 — legacy single-column `consecutiveFailures` integer was - // dropped (migration 0076). The per-kind bucket below is now the + // dropped (migration 0077). The per-kind bucket below is now the // sole source of truth for the alert ladder. consecutiveFailuresByKind Json? @map("consecutive_failures_by_kind") // v1.4.43 W14 — { transient, reauth_required, persistent } persistentFailureStartedAt DateTime? @map("persistent_failure_started_at") // v1.4.43 W14 — start of the current persistent streak (drives >24h park) diff --git a/src/app/api/auth/me/disable-coach/route.ts b/src/app/api/auth/me/disable-coach/route.ts index 87f2c352e..79fd7f4cd 100644 --- a/src/app/api/auth/me/disable-coach/route.ts +++ b/src/app/api/auth/me/disable-coach/route.ts @@ -9,7 +9,7 @@ * * The toggle is reachable from Settings → Insights as a `` * labelled "Hide Coach" / "Coach ausblenden". Default `false` (Coach - * visible) — see migration `0076_v1447_user_disable_coach` for the + * visible) — see migration `0078_v1447_user_disable_coach` for the * column-level documentation. * * Idempotent. The endpoint always returns the resolved next-state diff --git a/src/app/api/auth/me/route.ts b/src/app/api/auth/me/route.ts index c83ac18f5..00d0ba227 100644 --- a/src/app/api/auth/me/route.ts +++ b/src/app/api/auth/me/route.ts @@ -34,7 +34,7 @@ export const GET = apiHandler(async () => { lastReportPracticeName: user.lastReportPracticeName ?? null, // v1.4.47 W3 — per-user Coach opt-out. Default `false` if the // column is absent (partial-deploy rollback safety, see migration - // 0076 commentary). Every Coach mount point on the client checks + // 0078 commentary). Every Coach mount point on the client checks // `user.disableCoach` BELOW the operator-level `flags.coach` // short-circuit; both gates must agree to paint the affordance. disableCoach: user.disableCoach ?? false, diff --git a/src/lib/integrations/__tests__/admin-alert.test.ts b/src/lib/integrations/__tests__/admin-alert.test.ts index 846e149e7..9f1c9479b 100644 --- a/src/lib/integrations/__tests__/admin-alert.test.ts +++ b/src/lib/integrations/__tests__/admin-alert.test.ts @@ -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, diff --git a/src/lib/integrations/__tests__/status.test.ts b/src/lib/integrations/__tests__/status.test.ts index 4f7a5ae80..93070beaf 100644 --- a/src/lib/integrations/__tests__/status.test.ts +++ b/src/lib/integrations/__tests__/status.test.ts @@ -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, diff --git a/src/lib/integrations/status.ts b/src/lib/integrations/status.ts index 9bd533dba..cff5dd0f7 100644 --- a/src/lib/integrations/status.ts +++ b/src/lib/integrations/status.ts @@ -250,7 +250,7 @@ export async function recordSyncSuccess( // v1.4.43 W14 — a success resets ALL per-kind buckets back to zero // and clears the persistent-streak start timestamp. // v1.4.47 W1 — the legacy `consecutiveFailures` column was dropped - // (migration 0076), so the bucket reset is the only counter write. + // (migration 0077), so the bucket reset is the only counter write. await prisma.integrationStatus.upsert({ where: { userId_integration: { userId, integration } }, create: { @@ -304,7 +304,7 @@ export interface RecordSyncFailureInput { * ONLY its own bucket; a transient hiccup followed by a persistent * failure no longer masks the persistent streak's true age. * v1.4.47 W1 — the legacy single-column `consecutiveFailures` integer - * was dropped (migration 0076); the bucket is now the sole counter + * was dropped (migration 0077); the bucket is now the sole counter * and the back-fill branch is gone. */ export async function recordSyncFailure( @@ -448,7 +448,7 @@ export async function recordSyncFailure( // a row with a 3-deep persistent streak still pages even when the // transient bucket sat at 0. // v1.4.47 W1 — the legacy `consecutiveFailures` column was dropped - // (migration 0076); the bucket max is now the sole alert signal. + // (migration 0077); the bucket max is now the sole alert signal. const threshold = getPersistentFailureThreshold(); const alertSignal = Math.max(...Object.values(buckets)); if (alertSignal >= threshold) { @@ -635,7 +635,7 @@ export async function markReauthRequired( message: string, ): Promise { // v1.4.47 W1 — the legacy `consecutiveFailures` column was dropped - // (migration 0076). Out-of-band reauth detection (proactive token + // (migration 0077). Out-of-band reauth detection (proactive token // refresh) seeds the `reauth_required` bucket at 1 on a first-ever // row so subsequent reauth detections accumulate against the same // bucket the alert ladder reads.