mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
A Coach retrieval tool that read the window and found nothing returned `reason: "no_data"` — the same code for two situations that have nothing in common: the record holds nothing for that metric, and the record holds a substantial history for it, all of it older than the window that was searched. Nothing downstream could tell them apart, so the Coach said the honest-sounding sentence for the wrong case, and then, having been told there was nothing there, changed the subject. Someone with a year of imported glucose readings was told the readings did not exist, on the same account whose glucose page was showing them. The window cap stays. It exists because a multi-year history does not fit a prompt budget, and widening it would only move the same failure. What was missing is the ability to say a different true sentence. - `tools/availability.ts` — one grouped aggregate per miss, no rows materialised, resolving four states: `no_data` (probe confirmed empty), `outside_window` (rows exist, older than the searched window; carries the count, the date range in the user's own timezone, and a bounded per-series mean/min/max), `unavailable_in_scope` (rows exist inside the window and the domain still produced none — a module is off), and `no_data_unconfirmed` (the probe itself failed; absence was never established, so it is not asserted). - Every empty read in the executor routes through it. A bare `no_data` can no longer be returned without the record having been checked. - The DATA INVENTORY carries the same distinction, so a domain the window cannot reach is advertised with what it holds instead of as absent — the model no longer skips the fetch, and a vague follow-up keeps the subject. - Both instructions that told the model to report absence and move on now branch on the reason code, and forbid answering about one metric by reporting another. - The out-of-window aggregate joins the authoritative set for the prose verifier, so the sentence the fix exists to make sayable is not elided. - A cross-cutting narration block that throws is now counted rather than vanishing into a `null` that looks like honest absence. - The medication-compliance page tells a failed read apart from an account with no medications, instead of inviting someone to re-enter what it already holds. Refs #648