fix(insights): report every correlation through the significance gate

The /insights envelope (weight x BP, mood x BP, mood x weight, mood x
pulse, BP medication continuity) and the AI feature payload computed
their coefficients with an ungated Pearson that banded |r| above five
pairs, so five days of noise sloping the right way read as a strong
correlation there while every other surface refused the same points.
Both now use `significantPearsonCorrelation` (n >= 20 and p < 0.05,
through the engine's exact p-value), and the ungated function is gone.
The allowlist guard that tracked its remaining callers becomes a guard
that there is one Pearson implementation.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 03:41:54 +02:00
1 parent 04855b1a67
commit a22bf91311
9 files changed
+150 -269

No files matched your search

@@ -159,7 +159,7 @@ describe("GET /api/insights/comprehensive — server cache", () => {
// A tight fixture: 5 paired BP readings + 5 weight rows + 5 mood
// entries spread across 5 distinct days. Enough to populate every
// correlation block (n >= 5 is the pearsonCorrelation gate).
// correlation key (each is null below the significance bar).
const now = Date.now();
const DAY_MS = 24 * 60 * 60 * 1000;
const dayDates = Array.from(