mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
feat(coach): goal / if-then plan memory + locale-keyed dashboard snapshot
Add a CoachPlan model: durable, user-scoped if-then implementation plans the Coach proposes and the user confirms. The background memory-refresh pass extracts plans the user agreed to and writes them as "proposed"; only the user-facing PATCH on /api/coach/plans/[id] activates one. The free-text cue / action / target are encrypted at rest with the shared Bytes codec; metric, status and dates stay plain so the injection picker ranks without a per-row decrypt. Active plans fold into the Coach snapshot's memory block and survive the prompt-budget drop alongside facts. List, confirm and soft-delete routes are Coach-gated and narrow the owner from the session. Key the dashboard-snapshot query cell by locale so a locale switch reads freshly localised tile copy on its own cell instead of serving the prior locale's prose until the slot goes stale. The zero-arg key stays byte-identical, so every prefix-based invalidation keeps reaching the locale-keyed cells; the offline-banner and preloader match on the prefix. Migration 0194 (additive CREATE TABLE). Encryption-rotation registry and script cover the three new Bytes columns.
This commit is contained in:
1 parent
ee704cacab
commit
dcbac63fdf
20 files changed
+2162
-14
No files matched your search
@@ -34,8 +34,20 @@ export const dashboardKeys = {
|
||||
* `src/lib/cache/invalidate.ts`; the client read carries the same
|
||||
* 60 s `staleTime` as `DASHBOARD_QUERY_OPTS` so a warm return-to-
|
||||
* dashboard is a free cache hit.
|
||||
*
|
||||
* v1.21.3 (b) — optional `locale` segment so a locale switch lands the
|
||||
* server-rendered prose (the snapshot carries localised tile copy /
|
||||
* narrative text) on its own cache cell instead of serving the prior
|
||||
* locale's prose until the slot goes stale. Mirrors the `analytics(slice?)`
|
||||
* optional-segment precedent above: a ZERO-ARG call stays byte-identical to
|
||||
* the legacy `["dashboard","snapshot"]` literal, so every prefix-based
|
||||
* invalidation bundle (`measurementDependentKeys`, `medicationDependentKeys`)
|
||||
* and zero-arg reader keeps prefix-matching the locale-keyed cells.
|
||||
*/
|
||||
dashboardSnapshot: () => ["dashboard", "snapshot"] as const,
|
||||
dashboardSnapshot: (locale?: string) =>
|
||||
locale
|
||||
? (["dashboard", "snapshot", locale] as const)
|
||||
: (["dashboard", "snapshot"] as const),
|
||||
|
||||
/**
|
||||
* v1.4.22 W5 reconcile (Code-LOW-5) — `["user", "dashboardWidgets"]`
|
||||
|
||||
Reference in new issue
Block a user