diff --git a/src/lib/ai/coach/labs-snapshot.ts b/src/lib/ai/coach/labs-snapshot.ts index bb030f516..5d606dd35 100644 --- a/src/lib/ai/coach/labs-snapshot.ts +++ b/src/lib/ai/coach/labs-snapshot.ts @@ -48,8 +48,9 @@ * `userId` is narrowed from the authenticated session by the caller and feeds * the Prisma `where` field-by-field; it is never an input. Unlike the illness * block, Labs is intentionally NOT module-gated (mirrors `/api/labs` — the data - * is always owner-scoped and safe to read), so the block is `null` only when the - * account has no recent readings. + * is always owner-scoped and safe to read). The block is `null` only when no + * reading falls inside the lookback limit (the whole record when there is + * none), or, for a named read, when no marker matches the analyte. */ import { sameLabUnit } from "@/lib/labs/unit-normalise"; import { diff --git a/src/lib/ai/coach/snapshot.ts b/src/lib/ai/coach/snapshot.ts index b572218a7..7e884a756 100644 --- a/src/lib/ai/coach/snapshot.ts +++ b/src/lib/ai/coach/snapshot.ts @@ -668,8 +668,8 @@ async function buildCoachSnapshotImpl( // scope-gated metric: attached without a `registerBlock` so the budget // degrader never sheds it, and Labs is intentionally not module-gated (the // helper reads owner-scoped rows directly, mirroring `/api/labs`). The block - // carries the most-recent resolved reading per biomarker (last 12 months, - // capped) so the Coach can answer "what was my LDL" without re-deriving. + // carries the latest resolved reading per biomarker (whole record or the + // lookback limit, capped) so the Coach can answer "what was my LDL". const labsBlockPromise = buildLabsSnapshotBlock(userId, now, reach); // v1.38 — doctor-visit context. Like illness/labs it is attempted always (a