Files
HealthLog/src/lib/query-keys/settings.ts
T
Marc-André Bombeck e9d28b399e fix(copy): make delete confirmations, sleep-debt labels, and the glucose band honest
Three surfaces where the words no longer matched the code, plus the missing
web control for a preference the server already honours.

Delete confirmations. Four dialogs promised permanence on surfaces that
render an Undo: the measurements and mood bulk bodies, the lab-result body,
and the illness-episode body (which said "cannot be undone" sixty lines
below the code that fires the Undo toast). All four now use the same
sentence the single-row measurement and mood dialogs already used. A sweep
of every other confirmation in the tree found the rest accurate — the
biomarker cascade, the mood-tag purge, and the account purge keep their
warning because those deletes really are unrecoverable.

Sleep debt. v1.19.0 replaced the summed shortfall with a running balance
that credits catch-up sleep; the labels still described the old sum, so the
word contradicted the number for anyone who slept in after a short night.
Corrected in all six locales, plus the places the old semantics had
propagated: the Coach system prompt, the OpenAPI field descriptions the
native client reads, and four module docblocks.

Glucose reference band. `hasDiabetes` selects the tighter reference band and
grounds the Coach, but no web surface set it — a web-only account was pinned
to the non-diabetic scale with no way out. The control goes on Targets,
above the per-metric editor, because it answers the same question that page
answers and the two are ordered: it picks the default band, an override
below beats it. The copy says what it is — a reference band, not a
diagnosis, never inferred from a reading, no clinical action taken on it.

The passkey list was reported as always reading "never used". It does not
reproduce: the column is selected by the list route and stamped on every
verified assertion, both since v1.23.0. Pinned with tests on both halves so
the contract cannot quietly regress.
2026-07-19 12:28:05 +02:00

67 lines
2.8 KiB
TypeScript

/**
* Query keys — settings + notification surfaces, version/meta reads,
* gamification, share links, and feature flags.
* Part of the centralized factory; aggregated in `./index.ts`.
*/
export const settingsKeys = {
gamificationAchievements: () => ["gamification", "achievements"] as const,
notificationsPreferences: () => ["notifications", "preferences"] as const,
notificationsStatus: () => ["notifications", "status"] as const,
settingsGlobalServices: () => ["settings", "global-services"] as const,
settingsNtfy: () => ["settings", "ntfy"] as const,
/** v1.17.1 — generic-webhook channel config. */
settingsWebhook: () => ["settings", "webhook"] as const,
/** v1.17.1 — SMTP / email channel config. */
settingsEmail: () => ["settings", "email"] as const,
settingsReminderThresholds: () =>
["settings", "reminder-thresholds"] as const,
/** v1.8.5 — user-level injection-site preferences (global exclusion). */
injectionSitePrefs: () => ["settings", "injection-site-prefs"] as const,
/**
* The declared diabetes opt-in behind `GET/PATCH /api/auth/me/diabetes`.
* Selects which reference band glucose readings are judged against, so the
* toggle also invalidates `insightsTargets()` — the resolved band rides
* on that payload.
*/
diabetesPref: () => ["settings", "diabetes"] as const,
/**
* v1.18.0 — the per-user module enable/disable map behind
* `GET/PATCH /api/auth/me/modules`. Used as the Module-hub mutation key;
* the resolved map itself rides on `authMe()` (the `/auth/me` payload),
* so the toggle mutation invalidates `authMe()` to re-gate the nav,
* Insights pills, and dashboard tiles in lockstep.
*/
modulesPrefs: () => ["settings", "modules"] as const,
apiVersion: () => ["api", "version"] as const,
publicVersion: () => ["public", "version"] as const,
/** v1.15.12 H1 — admin overview "update available" check against the
* latest GitHub release tag (best-effort, day-stale). */
versionUpdateCheck: () => ["version", "update-check"] as const,
researchMode: () => ["research-mode"] as const,
/**
* v1.23 — the Data & Privacy dashboard's read-only retention + encryption
* summary behind `GET /api/settings/privacy-summary`.
*/
privacySummary: () => ["settings", "privacy-summary"] as const,
/** v1.11.0 — owner's clinician share links (Settings → Sharing). */
shareLinks: () => ["share-links"] as const,
featureFlags: () => ["feature-flags"] as const,
/**
* The account's standing AI consent receipt (`GET /api/consent/ai/latest`).
* Keyed by kind because the endpoint answers per kind and a shared key
* across kinds would serve one kind's receipt for another.
*/
aiConsentReceipt: (kind: string) =>
["consent", "ai", "latest", kind] as const,
};