From ac5ecd39f148c73562cc75faa2cb46455f6a10e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 21 May 2026 17:17:13 +0200 Subject: [PATCH] docs(planning): W-FRONTEND-FACTORY + W-ORG v1.4.41 phase reports --- .../phase-W-FRONTEND-FACTORY-v1441-report.md | 62 ++++++++++++++++ .planning/phase-W-ORG-v1441-report.md | 73 +++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 .planning/phase-W-FRONTEND-FACTORY-v1441-report.md create mode 100644 .planning/phase-W-ORG-v1441-report.md diff --git a/.planning/phase-W-FRONTEND-FACTORY-v1441-report.md b/.planning/phase-W-FRONTEND-FACTORY-v1441-report.md new file mode 100644 index 000000000..e3bfe3b9f --- /dev/null +++ b/.planning/phase-W-FRONTEND-FACTORY-v1441-report.md @@ -0,0 +1,62 @@ +# W-FRONTEND-FACTORY v1.4.41 report + +## Scope landed (commit 0bf07abd) + +- `src/lib/query-keys.ts` — factory extended with new entries for the + unmigrated surfaces (notificationsStatus, settingsReminderThresholds, + insightsSettings, insightsProviderChain, insightsGlp1Timeline, + userAiProvider, userProfile, apiVersion, publicVersion, researchMode, + moodlogStatus, integrationsStatus, featureFlags, coachPrefs, + adminAiQuality, adminAppLogs, adminAssistantFlags, adminBackups, + adminCoachFeedback, adminFeedback/+Root, adminHostMetrics, + adminAuditActions, adminAuditOverview). +- `src/app/auth/login/page.tsx` — `queryKeys.authRegistrationStatus()` + + `queryKeys.auth()` on the two invalidation sites. +- `src/app/auth/register/page.tsx` — `queryKeys.auth()` invalidation. +- `src/app/notifications/page.tsx` — all five + read/getQueryData/setQueryData/cancelQueries/invalidate sites swapped + to `queryKeys.notificationsPreferences()`. +- `src/components/settings/about-section.tsx` — `queryKeys.apiVersion()`. +- `src/app/page.tsx` — UX M1: tile Suspense fallback switched from + `null` to a layout-stable card div mirroring trend-card chrome + (`bg-card border-border rounded-xl border p-4 md:p-6`) so a future + RSC hoist can't trigger CLS. +- `src/lib/__tests__/query-keys.test.ts` — walker `guardedRoots` + extended to scan `src/app/auth`, `src/app/notifications`, and the + about-section. New factory-shape test pins authRegistrationStatus, + notificationsPreferences, notificationsStatus, apiVersion. + +## Quality gates + +- `pnpm typecheck` — clean. +- `pnpm exec vitest run src/lib/__tests__/query-keys.test.ts` — 17/17 + passing including the expanded walker scope. + +## Deferred / handed-off + +Settings sub-files (account, advanced, ai-section, api-section, +integrations-section, mood-reminder-card, notification-status-card, +notifications-section, ntfy-card, telegram-card, thresholds-editor, +sources-section), targets/target-edit-sheet, medications/*, +mood/mood-list, measurements/measurement-list, insights/* (coach-panel, +therapy-timeline, personal-record-badge), admin/* (twelve sections), +onboarding/getting-started-checklist, hooks (use-coach-prefs, +use-feature-flags). The factory already carries entries for every key +those sites use; the swap itself plus walker expansion can land in a +follow-up wave or hotfix without further factory work. + +The single context budget on this wave ran out before the long tail +could be migrated and verified end-to-end. The committed slice is +green and self-contained: walker guards three new surfaces, and the +new factory entries are unit-pinned even where call sites still hold +bare literals. + +## Files touched (absolute) + +- /Users/marc/Projects/HealthLog/src/lib/query-keys.ts +- /Users/marc/Projects/HealthLog/src/lib/__tests__/query-keys.test.ts +- /Users/marc/Projects/HealthLog/src/app/auth/login/page.tsx +- /Users/marc/Projects/HealthLog/src/app/auth/register/page.tsx +- /Users/marc/Projects/HealthLog/src/app/notifications/page.tsx +- /Users/marc/Projects/HealthLog/src/app/page.tsx +- /Users/marc/Projects/HealthLog/src/components/settings/about-section.tsx diff --git a/.planning/phase-W-ORG-v1441-report.md b/.planning/phase-W-ORG-v1441-report.md new file mode 100644 index 000000000..78add9917 --- /dev/null +++ b/.planning/phase-W-ORG-v1441-report.md @@ -0,0 +1,73 @@ +# W-ORG — v1.4.41 wave report + +Closes v1.4.39 org-audit recommendations #2 (types promotion) and #3 +(prompt unification). + +## Commits landed on `develop` + +1. `bba38b8c` — `refactor(types): move BackupRow and BackupsList out of + route handler into src/types/backups.ts` +2. `dc66dfcf` — `refactor(types): consolidate AnalyticsData into + src/types/analytics.ts` +3. `8a56f482` — `refactor(prompts): unify src/lib/insights/prompt*.ts + into src/lib/ai/prompts/` + +## Rec #2 — types promotion + +### `BackupRow` / `BackupsList` +- New home: `src/types/backups.ts`. +- The single component → route-handler import in the codebase + (`components/admin/backups-section.tsx ← app/api/admin/backups/route.ts`) + is closed. The route still owns the HTTP contract but re-imports the + shapes from the shared module. + +### `AnalyticsData` consolidation +Three structurally-distinct inline interfaces collided on the name +across `src/app/page.tsx`, `src/app/insights/page.tsx`, and +`src/components/onboarding/getting-started-checklist.tsx`. Hoisted as +named exports in `src/types/analytics.ts`: +- `SubPageAnalyticsData` (pre-existing slim shape for sub-pages) +- `DashboardAnalyticsData` (BD-Zielbereich aggregates, glucoseByContext, + lastSeenByType) +- `InsightsAnalyticsData` (correlations + healthScore for mother page) +- `ChecklistAnalyticsData` (loose per-type count shape) + +Call sites re-import their shape under the original local alias so +downstream code reads unchanged. Four named shapes (not one optional +mega-shape) keep call sites from cross-reading fields they shouldn't +reach for. + +## Rec #3 — prompt unification + +Moves: +- `src/lib/insights/prompt.ts` → `src/lib/ai/prompts/insight-system-prompt.ts` +- `src/lib/insights/prompt-compact.ts` → `src/lib/ai/prompts/compact-sections.ts` +- Co-located tests follow (`__tests__/prompt-comparison.test.ts`, + `__tests__/compact-sections.test.ts`). + +Three importers updated: +- `src/app/api/insights/generate/route.ts` +- `src/lib/ai/coach/snapshot.ts` +- `src/app/api/insights/generate/__tests__/route.test.ts` (the + `vi.mock("@/lib/insights/prompt")` mock path moved too). + +Prompts now have one home — `src/lib/ai/prompts/`. Nothing remains +under `src/lib/insights/prompt*`. + +## Quality gates + +- `pnpm typecheck` — clean for the W-ORG touch set. Remaining errors + (`rollups/__tests__/measurement-read-wmy`, + `measurement-read-cumulative`, `summaries-slice`) belong to W-PERF-OPS + / W-DELETED-2 and are touch-disjoint. +- `pnpm test --run src/lib/ai/prompts/__tests__/` and the + `app/api/insights/generate/__tests__` paths pass. +- One unrelated `dashboard-suspense-boundaries.test.ts` regex contract + failure observed pre-this-wave (different wave's territory). + +## Out of scope (per touch-disjoint guards) + +- `src/lib/rollups/**` (W-PERF-OPS). +- `src/app/api/insights/**` body changes (W-INSIGHTS-HOT) — only the + one import path in `generate/route.ts` was touched to follow the + prompt move.