fix(insights): gate the tab strip on one presence read

The tab strip on every Insights page read the whole overview (22 KB),
a workouts page, the ECG list and the analytics summaries to learn which
pills to show. GET /api/insights/presence answers just that, for the
record on screen: the reading count per type after the record's module
switches, and whether it has mood entries in the last 90 days, a tracked
scheduled medication, workouts and ECG recordings. A flag whose page a
switched-off module hides is false and its rows are not read. The strip
now reads this and the saved layout; each page keeps loading its own data.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 12:56:16 +01:00
1 parent 05b5eb6942
commit 367fcd5332
12 files changed
+497 -129

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
"count": 2876,
"total": 9172,
"total": 9164,
"entries": {
"__tests__/account-payload-consumer-guard.test.ts": 2,
"__tests__/acting-account-boundary-guard.test.ts": 7,
@@ -982,7 +982,7 @@
"components/insights/hero-strip.tsx": 3,
"components/insights/insight-status-card.tsx": 12,
"components/insights/insights-edit-mode.tsx": 5,
"components/insights/insights-layout-shell.tsx": 11,
"components/insights/insights-layout-shell.tsx": 3,
"components/insights/insights-tab-strip.tsx": 35,
"components/insights/intraday-pulse-chart.tsx": 1,
"components/insights/labs-changes-card.tsx": 1,
@@ -136,11 +136,6 @@ const INVENTORY: Readonly<Record<string, Poll>> = {
cadence:
"25 s, nextAdvisorPollInterval, attempts from the response timeout so the warm can land (advisor); 10 while settling",
},
"components/insights/insights-layout-shell.tsx": {
sites: 1,
shape: "bounded",
cadence: "25 s, nextAdvisorPollInterval, 10 attempts (briefing body)",
},
};
const SITE = /\brefetchInterval\s*:/g;
+13 -1
View File
@@ -1511,6 +1511,10 @@ const DELEGABLE_ROUTES: Record<string, DelegableEntry> = {
domain: "record",
why: "The heaviest SQL aggregation in the product, cached per record; no provider on the path. Reached only through this module's MANAGE arm; the argument for admitting it is the manage literal's reason line, and the entry here is what leg (a) freezes and leg (f) checks the section against.",
},
"app/api/insights/presence/route.ts": {
domain: "record",
why: "Which Insights pages have data: reading counts per type and four presence flags, the gate of the tab strip over the overview. Reached only through this module's MANAGE arm; the argument for admitting it is the manage literal's reason line, and the entry here is what leg (a) freezes and leg (f) checks the section against.",
},
"app/api/insights/correlations/route.ts": {
domain: "record",
why: "Correlations over the record's own series. Reached only through this module's MANAGE arm; the argument for admitting it is the manage literal's reason line, and the entry here is what leg (a) freezes and leg (f) checks the section against.",
@@ -2049,6 +2053,11 @@ const DELEGABLE_MANAGE_ROUTES: Record<string, ManageEntry> = {
conditions: [],
why: "The heaviest SQL aggregation in the product, cached per record; no provider on the path.",
},
"app/api/insights/presence/route.ts": {
domain: "record",
conditions: [],
why: "Counts and flags only, no values, from the cells the overview and the summaries slice already serve; no provider on the path.",
},
"app/api/insights/correlations/route.ts": {
domain: "record",
conditions: [],
@@ -2304,8 +2313,11 @@ const ACTOR_ROUTES: Record<string, string> = {
* list: a standing credential to a third-party calendar is the owner's to
* make, or a managed profile's guardian's, never an adult record's delegate's.
* 276 -> 278.
*
* The Insights presence read joins the record list and the manage literal:
* the tab strip's gate over the overview, counts and flags only. 278 -> 280.
*/
const FROZEN_ENTRY_COUNT = 278;
const FROZEN_ENTRY_COUNT = 280;
/**
* The two surfaces that authenticate a Bearer token outside `requireAuth` —