diff --git a/.gitignore b/.gitignore index f70ee99c..23a3b8d4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ app/.DS_Store gradle/.DS_Store .DS_Store .kotlin/ +.claude/worktrees/ diff --git a/AGENTS.md b/AGENTS.md index b2fad66b..e4a90922 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1160,7 +1160,8 @@ their data. Each rule fails silently if broken: `ArchivedSettings`** — a restore on a new phone must start off with nothing paired. - **Off by default, foreground while on, never back by itself**: `START_NOT_STICKY`, no boot receiver, auto-off after the chosen hours (default 8), and stopping for any reason clears the - switch. The notification's tap stops it. Type `dataSync` (Android 15 ends it at its daily + switch. On Android 15+ the choices stop at 6 h and a stored 8 reads as 6 + (`McpConfig.autoOffHours`): a `dataSync` service gets about 6 h a day there. The notification's tap stops it. Type `dataSync` (Android 15 ends it at its daily limit through `onTimeout`; keep that override). - **The `instructions` say it is not a diagnostic tool** and the numbers are estimates — the same rule the coach follows. Keep them in step with the coach's prompt. @@ -1399,8 +1400,8 @@ serving, AI-estimate source); changing a number marks it `userEdited`, as a barc source file. The tracked caps label over a card or section is `PulseType.eyebrow` (12sp, 1sp tracking, `textSecondary`) everywhere — don't hand-roll another letter-spacing. - **Mint is the brand and the thing to tap, nothing else.** `success` (good, in range, - connected) is its own green, REM is cyan, connecting is amber. The readiness ring keeps the - brand colour on purpose: it is the headline score. + connected) is its own green, REM is cyan, connecting is amber. The readiness and activity + score rings are coloured by their band (the score's own meaning), not by the brand colour. - **One card radius: 8dp.** Tiles and vital cards used to be 20/30dp. - **Every button is a `PulseButton`** (`ui/components/PulseButton.kt`, v2.11.57): one composable with a style (Filled, Tonal, Outlined, Text) that holds the design system's button rules — 52dp diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 12e24f6a..1e61a210 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,8 @@ + + A{Add} + A -->|saved| S[Snackbar: Workout added · card leaves] + A -->|error| F[Snackbar: Couldn't add… · card stays] + P[Settings › Add ring] --> Q[Pairing with top bar] -->|Back| P + C[Trend chart] --> Z[Zoom − / + buttons or pinch] --> R[Reset] +``` + +| # | Question | Result | +|---|---|---| +| 1 | Job | Pass | +| 2 | Entries | Pass: no new doors. Customize cards keeps its target | +| 3 | Happy path | Pass: no step added to a common action | +| 4 | Branches | Pass: Add has a success and a failure branch | +| 5 | States | Pass: success and failure for Add, both zoom limits, Android 15 hours | +| 6 | Errors | Pass: the silent failure is gone | +| 7 | Control | Pass: Back on pairing; zoom out and reset | +| 8 | Progress and resume | Not applicable | +| 9 | Memory | Pass: a stored 8 h is clamped, not lost | +| 10 | Exits | Pass | +| 11 | Conventions | Pass: Snackbar, `PulseTopBar`, PulseButton Text link | +| 12 | Speed | Pass | +| 13 | Accessibility | Pass: Snackbars are announced, single-pointer zoom, roles, 48dp | +| 14 | Ethics | Pass | +| 15 | Evidence | Unit tests (MCP clamp, PhoneFormat clock, accuracy day note, MCP rebind); CI | + +## impeccable (native audit) + +| Dimension | Before (v2.11.59) | After | +|---|---|---| +| Accessibility | 3–4 | 4 | +| Performance | 3–4 | 4 | +| Appearance & theming | 3–4 | 4 | +| Platform conformance | 3–4 | 4 | +| Adaptivity | 3 | 4 | +| **Total** | **17/20** | **20/20** | + +No open P0 to P2 in the app's own code. The only items left are the three in the table above +that no code change here can close. + +## graphic-design-fundamentals (§13) + +| # | Question | Result | +|---|---|---| +| 1–3 | Brief, concept, hierarchy | Pass: Customize cards drops to the end; the snackbar doesn't push layout | +| 4, 8 | Contrast, colour | Pass: no mint on anything you can't tap; the snackbar has no mint | +| 5–7 | Alignment, spacing, typography | Pass: spacing on the scale, `PulseType` titles, 20dp icons | +| 9–10 | Consistency, simplicity | Pass: one card surface in Settings, one top bar, one filled button per screen | +| 11–12 | Real size, accessibility | Pass (by reading) | +| 13 | Production | Pass: every `tr()` key has a pt-BR entry (script-checked), every `Icons.*` is imported, no off-scale `fontSize`, no direct Material button | + +## less-is-more + +| Element | Question | Action | +|---|---|---| +| "Customize cards" at full weight above the cards | 5 (rare action) | Moved to a quiet link at the end | +| Second filled button on Record | 2 | Outlined | +| Mint bullets and progress | 1 | Neutral | +| Snackbar on Add | 1 (feedback) | Added: it replaces a silent result, not a step | + +| Dimension | 0–4 | +|---|---| +| Elements per screen, compared with before | 4 | +| Duplicates left | 4 | +| Text to read when tired | 4 | +| Taps on the common actions (must not rise) | 4 (none rose) | + +## Verdict + +Merge. **Green:** there is no open P0, P1, P2 or P3 in the app's code. Three items remain outside +the code: a measurement on the owner's phone, two design-system decisions, and the canvas sync. +They are listed above with who acts. diff --git a/docs/mcp-threat-model.md b/docs/mcp-threat-model.md index d15a459f..f1c3233a 100644 --- a/docs/mcp-threat-model.md +++ b/docs/mcp-threat-model.md @@ -42,7 +42,7 @@ the coach's context packet but drops its labs, postpartum, drinks and goal-plan | Threat | Mitigation | |---|---| | Left on by accident | Off by default. Never started on boot; Android doesn't restart it (`START_NOT_STICKY`). While it runs an ongoing notification says "Sharing your health data with paired AI tools on this network. Tap to stop.", and a tap stops it. It turns itself off after 1, 4 or 8 hours (default 8; Android 15 ends a `dataSync` service sooner, at its daily limit, through `onTimeout`). Stopping for any reason clears the switch. | -| Reached from the internet or over mobile data | Listens only on Wi-Fi, Ethernet, hotspot and Tailscale (`tun`) interfaces, never `rmnet`/`ccmni`. Binds only addresses `McpNet.allowedPeer` accepts: loopback, 10/8, 172.16/12, 192.168/16, link-local, 100.64/10 (Tailscale/CGNAT), IPv6 ULA. Each connection's peer is checked again and closed before anything is read. | +| Reached from the internet or over mobile data | Listens only on Wi-Fi, Ethernet, hotspot and Tailscale (`tun`) interfaces, never `rmnet`/`ccmni`, re-checked on every network change while it runs. Binds only addresses `McpNet.allowedPeer` accepts: loopback, 10/8, 172.16/12, 192.168/16, link-local, 100.64/10 (Tailscale/CGNAT), IPv6 ULA. Each connection's peer is checked again and closed before anything is read. | | Someone else on the same Wi-Fi | Every request needs `Authorization: Bearer `. Each paired tool has its own token: 32 random bytes, base64url, shown once. Only its SHA-256 is stored, compared in constant time against every pairing. Tokens are revoked one by one. | | A web page in a browser on the network (CSRF, DNS rebinding) | Any request with an `Origin` header is refused (403) before the token is even looked at. MCP clients don't send one; browsers do on cross-origin POSTs. The token is required anyway. | | Changing or deleting data | Only allowlisted read tools are listed or callable, and they run with `CoachFeatureFlags(writeToolsEnabled = false, liveMeasurementsEnabled = false, webSearchEnabled = false)` and `coordinator = null`, so even a misrouted call has no ring to talk to. `McpAllowlistTest` fails if a write tool's name reaches the allowlist, or if a new coach tool appears that nobody has classified. | @@ -61,8 +61,16 @@ the coach's context packet but drops its labs, postpartum, drinks and goal-plan including the token. Turn it off there, or use Tailscale. - **The paired tool** sees what it asks for, and its own data policy then applies to that health data. A cloud-backed assistant sends it to its provider. -- **The address can change.** The server binds the addresses it found at start; after a Wi-Fi - change it must be turned off and on again. +- **The address can change, and the server follows it.** While it runs, `McpService` watches + the phone's networks (a `ConnectivityManager.NetworkCallback`, VPNs included) and, a second + after a change settles, re-reads `McpNet.localAddresses` and calls `McpServer.rebind`: it stops + listening on an address the phone lost, binds a new one under the same `allowedPeer` rule, and + leaves unchanged ones alone. The settings screen's address list follows. Off every network it + keeps running with no listener until one comes back. The rule is unchanged: the address set + still comes only from Wi-Fi, Ethernet, hotspot and `tun` interfaces, never mobile data, and a + public address is never bound. A paired tool configured with the old address still needs the + new one; and a hotspot the phone serves reports no network change, so its address is picked + up at the next change or start. - **The notification can be hidden.** If notifications are denied, Android 13+ still runs the service but may not show its card; the switch on the settings screen still shows the truth. - **Readings may be demo rows.** The tools read what the screens read (real rows win once the