From 087c8868cfdd546e1c7182af10be3f35cdb3c199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 31 Oct 2026 10:00:39 +0100 Subject: [PATCH] test: type the off-spec WHOOP profile and drop a version-stamped comment The realism ratchet counts as-never casts and the version-stamp ratchet refuses comment lines that open with a release; both caught the previous commits. --- src/app/api/whoop/callback/__tests__/route.test.ts | 5 ++++- src/lib/google-health/account-id-heal.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/api/whoop/callback/__tests__/route.test.ts b/src/app/api/whoop/callback/__tests__/route.test.ts index 251b5298b..d467bfccf 100644 --- a/src/app/api/whoop/callback/__tests__/route.test.ts +++ b/src/app/api/whoop/callback/__tests__/route.test.ts @@ -1,4 +1,5 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; +import type { WhoopProfile } from "@/lib/whoop/wire-types"; // Single-use claiming is covered against Postgres in // tests/integration/oauth-callback-single-use.test.ts. Here the state row is @@ -182,7 +183,9 @@ describe("GET /api/whoop/callback custom-scheme redirect", () => { returnScheme: null, }); const { fetchProfile } = await import("@/lib/whoop/client"); - vi.mocked(fetchProfile).mockResolvedValueOnce({} as never); + // An off-spec body: the wire type says user_id is always there. + const offSpec: Partial = {}; + vi.mocked(fetchProfile).mockResolvedValueOnce(offSpec as WhoopProfile); const res = await GET(makeReq("nonce-noid")); diff --git a/src/lib/google-health/account-id-heal.ts b/src/lib/google-health/account-id-heal.ts index bbad106ca..a596d1f6b 100644 --- a/src/lib/google-health/account-id-heal.ts +++ b/src/lib/google-health/account-id-heal.ts @@ -56,9 +56,9 @@ export async function healGoogleHealthAccountId( } /** - * The sync cycle's hook: after a clean cycle, a connection from before - * v1.46.4 (no account id since migration 0491) reads its id back. A - * connection that has one is left alone, so the profile is read once. + * The sync cycle's hook: after a clean cycle, a connection that migration + * 0491 left without an account id reads it back. A connection that has one + * is left alone, so the profile is read once. */ export async function healUnknownGoogleHealthAccountId( userId: string,