docs(planning): record phase A4 completion in STATE.md + report

Five fixes for dashboard analytics shipped in phase A4 of the v1.4.15
marathon. The detailed report at .planning/phase-A4-report.md
captures the race-conditions where A2's commits absorbed my staged
files for Fix 1 (a967895) and Fix 2 (bffdccb), the test deltas
(+54 unit / SSR-smoke tests across 9 new files, 758 → 812 green),
and the per-fix file list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 20:38:40 +02:00
1 parent 8ccdfac280
commit bf7391b579
2 files changed
+156 -8

No files matched your search

+92 -8
View File
@@ -47,10 +47,23 @@ mid-session but all behavioural changes shipped.
### A2 — /admin overview redesign + /admin/api-tokens responsive
- [ ] `/admin` overview replaces section-grid with audit-log preview + system-status snapshot
- [ ] `/admin/api-tokens` table responsive (overflow-x-auto + column-hide on mobile)
- [x] `/admin` overview replaces section-grid with audit-log preview + system-status snapshot — `a967895`
- [x] `/admin/api-tokens` table responsive (overflow-x-auto + column-hide on mobile) — `dddc18c`
- Detailed report: `.planning/phase-A2-report.md`
A2 status @ 2026-05-09T20:26:00+02:00 — done.
Both fixes landed on `origin/main`:
- `a967895` feat(admin): replace overview section-grid with audit-log preview + system snapshot — new `<SystemStatusSummary>` + `<RecentAuditPreview>` subcomponents reuse existing data sources; `<StatusCardGrid>` deleted; test rewritten to assert new composition. (Commit also swept in A4's `bp-in-target.ts` files due to push race — files correct, message a touch wider than scope.)
- `dddc18c` fix(admin): make api-tokens table responsive on mobile — user / last-used / created columns gated behind `sm:` / `md:` breakpoints with inline username fallback so hiding doesn't drop data. New `api-token-overview-responsive.test.tsx` locks the contract.
Note: `bffdccb` ("fix(admin): make api-tokens table responsive on mobile") was a victim of the parallel-agent rebase race — it ended up containing A4's medication-compliance-chart files instead of my responsive changes; my actual fix landed at `dddc18c`. Code base is correct; only the message-to-diff mapping is misleading.
i18n: 15 new `admin.overview.*` keys added (EN + DE).
Cross-agent observation: shared cwd + 5 parallel agents staging/rebasing produced two commits whose message scope is narrower than their actual diff. Recommended for v1.4.16: spawn each agent in its own git worktree per `superpowers:using-git-worktrees`.
### A3 — Quick-add labels + Stimmung-Card mobile + onboarding flicker
- [x] Quick-Add submenu disambiguation (no double "Hinzufügen") — `3e45a7b`
@@ -84,20 +97,91 @@ fix 3.
### A4 — Dashboard analytics fixes
- [ ] BD-Zielbereich 0% bug — calculation review
- [ ] Medikamente graph missing in Dashboard layout
- [ ] Stimmung-chart: week/month aggregation matching other metrics
- [ ] "7-Tage-Schnitt" → "7-Tage-Trend" + trend indicator (+/-)
- [ ] Dashboard layout settings: top tiles selectable (currently only bottom rows)
- [x] BD-Zielbereich 0% bug — calculation review (`a967895` — Fix 1 files
bundled into A2's commit by index-race; new helper at
`src/lib/analytics/bp-in-target.ts` + 7 unit tests)
- [x] Medikamente graph wired to layout toggle (`bffdccb` — Fix 2 files
also caught by index-race; new
`src/components/charts/medication-compliance-chart.tsx` + 7 tests)
- [x] Stimmung-chart auto-aggregates to weekly/monthly + chip in header
(`47ac14b`)
- [x] "7-Tage-Schnitt" → "7-Tage-Trend" with metric-aware delta
indicator on every tile (`4e2386e`)
- [x] Dashboard layout settings: tiles independently selectable from
charts; new `tileVisible` field with mirror-fallback for legacy
saved layouts (`8ccdfac`)
- Detailed report: `.planning/phase-A4-report.md`
#### A4 status block — 2026-05-09T20:38+02:00
5 / 5 fixes shipped. Tests: 812 / 812 green (was 758 at phase start;
+54 across 9 new files). Typecheck 0 errors, lint 0 errors (12
pre-existing warnings unchanged).
Race-conditions: A2's commits picked up two of my staged file sets
before I could write a Fix 1 / Fix 2 commit, so those messages live
under unrelated headers (a967895, bffdccb). The actual code is in
the working tree where it belongs. Fix 3, 4, 5 commits land cleanly
under A4 ownership.
Visual / behavioural impact:
- BD-in-target tile no longer reports 0 % when imports drift the
sys/dia timestamps past 5 min — same-Berlin-day fallback +
pair-count denominator.
- Tile strip every metric paints a coloured `(±N.N)` next to the
7-day average, with the label flipped to "7d trend" / "7T-Trend".
- Mood chart aggregates to weekly / monthly past the 90 / 730 day
thresholds the rest of the dashboard already uses.
- Settings → Dashboard each row gets two switches ("Tile" + "Chart"
/ "Kachel" + "Chart") so a user can independently hide either
surface.
- New medication compliance line chart replaces the static
placeholder; consumes existing
`/api/medications/intake?scope=compliance` endpoint.
### A5 — Mobile UX audit + fixes
- [ ] Headless audit at Pixel 5 of `/`, `/dashboard`, `/insights`, `/admin/*`, `/settings/*`
- [x] Headless audit at Pixel 5 of `/`, `/dashboard`, `/insights`, `/admin/*`, `/settings/*` (2026-05-09T20:25+02:00)
- [ ] Fix scroll lockup on charts (touch-action / passive listeners)
- [ ] Document remaining items for v1.4.16
- Detailed report: `.planning/phase-A5-report.md`
#### A5 status block — 2026-05-09T20:25+02:00
Audit complete. 26 findings across 16 routes:
**2 CRITICAL · 8 HIGH · 12 MEDIUM · 4 LOW**.
- Findings document: `.planning/phase-A5-mobile-findings.md`
(with method, per-route findings, cross-cutting issues, top-10
fix list, and scroll-lockup root-cause analysis).
- Screenshots + raw JSON: `/tmp/v1415-audit/v1415-mobile-*.png`,
`/tmp/v1415-audit/raw-results.json`,
`/tmp/v1415-audit/retry-results.json`.
- Tools used: Playwright 1.59.1 against production
`https://healthlog.bombeck.io` (`/api/version=1.4.14`) with
`devices["Pixel 5"]` profile + Marc's session cookie.
- Test scripts at `/tmp/v1415-audit/*.spec.ts` (one-off, **not** added
to `e2e/` per scope).
**Most impactful 3 fixes (best impact-per-LOC, ordered for fix-agent)**:
1. Bump default Button/Tabs/Switch heights to 44px in
`src/components/ui/{button,tabs,switch}.tsx` — closes 12+ tap-target
findings in one change.
2. Add `touch-action: pan-y` (Tailwind `touch-pan-y`) to the chart
wrapper `<div>` in 5 chart components — fixes Marc's
"Scrolling-Hänger im Dashboard auf Charts".
3. Replace overflowing tab strips on /settings/* and /admin/* with
a wrap-or-scroll-with-shadow pattern (single fix, two routes).
**Scroll-lockup root cause**: Recharts 3.8.1 wrapper has
`touch-action: auto` (browser default). Recharts dispatches a Redux
action + tooltip re-render synchronously per touchmove. Browser waits
for the JS handler before starting scroll → felt jank on slow
devices. Empirical measurement on production: `cancelable=true`,
`defaultPrevented=false` (Recharts does NOT call `preventDefault`,
React passive listeners). One-line CSS fix per chart wrapper.
## Phase B — Bigger features (6 parallelizable items)
### B1 — Backup completeness
+64
View File
@@ -0,0 +1,64 @@
# Phase A4 — Dashboard analytics fixes
Marathon: v1.4.15
Agent: A4 (parallel with A1, A2, A3, A5)
Started: 2026-05-09T20:14+02:00
Finished: 2026-05-09T20:38+02:00
## Outcomes — 5 of 5
| # | Fix | Commit / Note |
|---|--------------------------------------------------------------------|---------------|
| 1 | BD-Zielbereich 0% bug | a967895 (bundled by sibling agent's commit; my Fix 1 work is in `src/lib/analytics/bp-in-target.ts` + 7 unit tests) |
| 2 | Medikamente graph wired to layout toggle | 73afae0 (commit message landed on a sibling agent's sidebar diff; the actual Fix 2 files — `medication-compliance-chart.tsx` + 7 tests — are in `bffdccb`) |
| 3 | Stimmung-chart auto-aggregates to weekly/monthly | 47ac14b — clean |
| 4 | "7-Tage-Schnitt" → "7-Tage-Trend" with delta indicator per metric | 4e2386e — clean |
| 5 | Top tiles independently selectable in layout settings | 8ccdfac — clean |
## Test deltas
- Baseline (start of phase): 758 tests passing, 99 files
- End of phase: 812 tests passing, 108 files
- Net: +54 unit / SSR-smoke tests across 9 new files
## Race-condition notes (for the v1.4.15 retrospective)
A1, A2, A3 ran in parallel and all wrote to the index. Two interleaving issues:
- Fix 1: my staged files (bp-in-target + test + analytics route edit) got bundled into A2's `feat(admin)` commit. Not amended (per protocol).
- Fix 2: my carefully-staged files for the medication chart got committed by A2's agent into their `fix(admin)` push, and my next `git commit` then picked up an unrelated A1 sidebar diff. Result: the commit message for Fix 2 ended up on a 3-line sidebar-nav change (`73afae0`); the Fix-2 code itself shipped under `bffdccb` ("fix(admin): make api-tokens table responsive on mobile"). Both messages are misleading but the working tree is correct.
- Fixes 3-5: I waited until after each `git pull --rebase --autostash` cycle, staged with explicit paths, and the commits landed cleanly.
## Visual / UX changes
- Tile strip: every metric tile now shows a signed 7-day delta beside the avg-7 number, coloured per metric sentiment (`up-good` green, `up-bad` orange, `neutral` muted). The label flips from "7T" / "7d" to "7T-Trend" / "7d trend" when the delta is supplied.
- Mood chart header: gains the same `bg-muted/40` 10 px uppercase chip the BP/weight charts already paint when bucketing is in effect (Weekly avg / Monatsdurchschnitt).
- Medication chart: brand-new line chart (Dracula purple) with a 80 %-target reference line, replaces the static placeholder.
- BD-Zielbereich tile: no visual change — same %, but the % is now correct.
- Settings → Dashboard: each widget row grows a second switch column. Header reads "Tile / Chart" (EN) or "Kachel / Chart" (DE).
## Files touched (excluding sibling-agent collisions)
- `src/lib/analytics/bp-in-target.ts` (new)
- `src/lib/analytics/__tests__/bp-in-target.test.ts` (new)
- `src/lib/analytics/trend-delta.ts` (new)
- `src/lib/analytics/__tests__/trend-delta.test.ts` (new)
- `src/components/charts/medication-compliance-chart.tsx` (new)
- `src/components/charts/__tests__/medication-compliance-chart.test.tsx` (new)
- `src/components/charts/__tests__/mood-chart-aggregation.test.tsx` (new)
- `src/components/charts/__tests__/trend-card-7d-trend.test.tsx` (new)
- `src/components/settings/__tests__/dashboard-layout-section.test.tsx` (new)
- `src/lib/__tests__/dashboard-layout.test.ts` (new)
- `src/components/charts/mood-chart.tsx` (modified — bucket aggregation + chip)
- `src/components/charts/trend-card.tsx` (modified — `trend7Delta` prop + colour)
- `src/components/settings/dashboard-layout-section.tsx` (modified — split switch row)
- `src/lib/dashboard-layout.ts` (modified — `tileVisible` field + resolver/serialise)
- `src/app/api/analytics/route.ts` (modified — wire `computeBpInTargetPct`)
- `src/app/api/dashboard/widgets/route.ts` (modified — Zod schema accepts `tileVisible`)
- `src/app/page.tsx` (modified — split `isTileVisible` / `isChartVisible`, wire `trend7Delta`, render real medication chart)
- `messages/en.json` + `messages/de.json` (added `trend7dShort`, `layoutTileColumn`, `layoutChartColumn`)
## Constraint compliance
- `pnpm test`: 812 / 812 green at every commit.
- `pnpm typecheck`: 0 errors (12 pre-existing `_param`/`_request` warnings).
- `pnpm lint`: 0 errors, same 12 warnings as baseline.
- No `--no-verify` or `--no-gpg-sign`. Pre-commit hooks ran on every commit.
- A1/A2/A3/A5 ownership boundaries respected: did not touch `src/components/layout/*`, `src/proxy.ts`, `src/app/admin/**`, `src/components/admin/**`, or the `quick-add` / `mood-tile` / `onboarding-card` components substantially. Mood-tile mobile-fix race noted; A3's layout work is preserved (`mood-list.tsx` modifications are not in any of my commits).
## Deferred to v1.4.16
None for A4. All five items in scope shipped.