docs(coach): say what the labs block reads since it covers the whole record

The labs block reads the whole record, or up to the lookback limit, not just
recent readings, and a named read also comes back empty when no marker
matches. The header of the labs snapshot and the note at its call site
still described the earlier twelve-month window.
This commit is contained in:
Marc-André Bombeck committed 2026-10-25 12:12:15 +01:00
1 parent 72d90282d5
commit f85035a8ec
2 files changed
+5 -4

No files matched your search

+3 -2
View File
@@ -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 {
+2 -2
View File
@@ -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