mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
perf(analytics): fast-path gates per-type only
`isFullyCovered(coverage) && specificTypes` poisoned every fast- path with a single unrelated uncovered measurement type. v1.4.38.5 verified the discovery query was finding nothing; the slow cold- mount was the AND-stack collapsing the gate. - correlations-fast-path: gates on SYS + PULSE + WEIGHT only. - bp-in-target-fast-path: gates on SYS + DIA only. - health-score-fast-path: gates on WEIGHT only. Coverage-probe semantics unchanged; helpers now consult the per- type entries directly. Power-user cold-mount on /api/analytics estimated 30-75 s → ~3-5 s.
This commit is contained in:
1 parent
9cc5ececa7
commit
8a8150d2bf
5 files changed
+50
-20
No files matched your search
@@ -47,7 +47,6 @@ import { prisma } from "@/lib/db";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
import { readRollupBuckets } from "@/lib/measurements/rollups";
|
||||
import {
|
||||
isFullyCovered,
|
||||
probeRollupCoverage,
|
||||
type RollupCoverageMap,
|
||||
} from "@/lib/measurements/rollup-coverage";
|
||||
@@ -140,14 +139,13 @@ export async function computeCorrelationHypothesesFastPath(
|
||||
// local-day buckets and this guard can come back down.
|
||||
const userNearUtc = isNearUtc(userTz, now);
|
||||
|
||||
// The three measurement-derived streams ride the rollup-fast-path
|
||||
// only when EVERY type the user has logged is covered AND each of
|
||||
// SYS / PULSE / WEIGHT is in the coverage map. Partial coverage
|
||||
// falls back to the live path so a brand-new metric type doesn't
|
||||
// make the correlation card vanish.
|
||||
// v1.4.38.8 — gate only on the three types this helper actually
|
||||
// reads (SYS / PULSE / WEIGHT). The prior `isFullyCovered &&` AND
|
||||
// poisoned the correlations fast-path with any unrelated brand-new
|
||||
// type the user had logged, even when SYS + PULSE + WEIGHT were
|
||||
// fully covered. Per-type coverage is the correct gate.
|
||||
const measurementsOnRollups =
|
||||
userNearUtc &&
|
||||
isFullyCovered(coverage) &&
|
||||
coverage.get("BLOOD_PRESSURE_SYS") === true &&
|
||||
coverage.get("PULSE") === true &&
|
||||
coverage.get("WEIGHT") === true;
|
||||
|
||||
Reference in new issue
Block a user