docs(mood): state the validation's real leak boundary, drop the unused weekday floor, correct two comments

Four honesty fixes with no behaviour change to the math.

The validation header claimed more than it proves. The ridge FIT is
out-of-sample and no training fold sees ahead — that holds. But feature
SELECTION and per-user standardisation both run over the whole window
before the split, a small documented optimism (measured at about one
part in sixty on the error). The header now says exactly what is and is
not leak-free, and says to nest the screening if the feature set ever
grows or the optimism is ever measured larger.

The per-weekday observation floor had no consumer: no weekday board is
built on this fit, the forecast only publishes seasonalUnlocked and
leaves the weekday view to the insights page, which has its own floors.
Removed rather than left as a number nothing reads, with a note to bring
it back alongside such a board.

Two comments were wrong and are now true: the route's parameter is
declared for the exported type, not to steer a method check the wrapper
resolves from the Next.js request with a GET fallback; and the label
surface imports the key parser from feature-keys.ts, not features.ts.

And the write-surface guard now states its own structural blind spot,
the way the session-surface guard does: the wipe path deletes this table
through a dynamically-resolved delegate the literal matcher cannot see,
which is why that deletion is correctly not counted as a writer.

The Coach staleness fixture moves above the forecast floor, because the
read path now refuses below it: a one-entry account correctly gets an
absence rather than the present forecast that case exercises.
This commit is contained in:
Marc-André Bombeck committed 2026-08-08 15:30:38 +02:00
1 parent d58edc5deb
commit 75c43c74bc
7 files changed
+81 -41

No files matched your search

@@ -23,6 +23,19 @@
* the legitimate writer really does make. `describe("the matcher sees what it
* looks for")` proves the regex against synthetic sources, including the
* broken-across-lines form that defeated an earlier guard in this repository.
*
* **What this guard structurally cannot see, stated like the session-surface
* guard states its own limit.** The matcher keys on a literal `moodPrediction`
* delegate access. The "Delete All Data" wipe DOES delete this table — the
* model is in `WIPE_MODELS` (`src/lib/data-wipe/wipe-plan.ts`) — but it does so
* through a delegate resolved dynamically from the model name (`client[key]
* .deleteMany`), so no `moodPrediction.deleteMany(` literal exists for the
* matcher to catch, and that deletion is correctly NOT counted as a writer.
* The wipe path's own completeness is proven elsewhere, by
* `data-wipe-completeness.test.ts` enumerating the schema; this guard is only
* the one about request-time writers, and it cannot be the gate on a dynamic
* delegate. A future writer that reached the table through a computed property
* would slip this matcher for the same reason.
*/
import { existsSync, readFileSync, readdirSync } from "node:fs";
import { join, sep } from "node:path";