New SPEC §15 Web client and FR-21; §1, §2, G-5, AC-14.1 revised; §8.5 and §10.5.2 gate lines for /app/, the invite accept and bearer requests (except /health, /setup/, /i/, /apk/) plus the /app/ CSP via $kvitt_csp, identical in infra/npm/kvitt.conf and infra/README.md step 4 (checked with nginx 1.31.7); §10.3, §10.6, §11.1 to §11.3 (rows W0 to W7), §14.7 ownership; change log is now §16. PLAN-W0..W7 and prompts/W0..W7; HANDOFF numbering D-139 / v0.30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
4.6 KiB
PLAN-W6: Android Insights (advanced analytics from the server)
1. Goal
Show the server's advanced analytics (D-133: per-category averages and trends per month, the 2-month forecast per account) in the Android app as an "Insights" section on S-11, online only (§9.9), consuming W7's /analytics/* endpoints. This is a UI-contract change (:core:model is a contract file, §14.8) with the data layer, fakes, the feature and goldens.
2. Read first
- SPEC §15.8 and the server agent's D-135 to D-138 (SPEC v0.29: endpoint names, shapes, rounding), AC-14.1 (as revised), FR-14, §9.9, §14.2.4 (the UI contract:
AnalyticsRepository,AnalyticsState,OnlineResult), §14.8, §6.2 (layering), §13.3 row S-11, D-128 (v0.27), D-133. contracts/openapi.yaml/analytics/*andcontracts/examples/for them (W7).docs/ux/design-spec.mdS-11 section, §3.10 (charts), §3.6 (offline hints);docs/ux/strings.csv(analytics_*).- Files:
android/core/model/**(analytics types,AnalyticsRepository),android/data/**(KvittApi, DTOs, the analytics repository),android/core/fakes/**(fake analytics repository and scenarios),android/feature/analytics/**,android/core/design/**(read only),android/README.md. CLAUDE.md(Android gate, layering, anti-patterns, screenshots, the phone).
3. Already established
- The numbers are the server's; the app neither computes nor caches them across process restarts beyond what the brief allows (no Room table: a schema change would need its own decision). Offline, the section shows the "Needs connection" hint (
common_needs_connection, §9.9) and S-11's own offline analytics stay as they are (AC-14.1). :core:modelgains the Insights types and repository members (names proposed by this plan, recorded as a decision);:datacalls the endpoints throughKvittApiwith the common headers (§14.3.1, D-126's app key included) and maps errors as other online reads do;:core:fakesgets scenarios for loaded, empty, offline, error and long content;:feature:analyticsrenders the section below S-11's charts (or as the design-spec placement the report proposes) with strings in both languages.- New strings are proposed for
docs/ux/strings.csvin the report (the docs agent records them;docs/ux/**is not this plan's). - Goldens for every new state in the three variants (D-098); open every changed PNG.
4. Owned paths
From SPEC §14.7 (row W6): android/feature/analytics/**, and as a contract-change plan android/core/model/**, android/data/**, android/core/fakes/**. Catalog entries only if needed (android/gradle/**). Nothing in server/**, contracts/**, web/**, docs/**.
5. Deliverables
- The
:core:modeladditions withContractTestupdated; the:dataclient and repository with tests over the contract examples; fakes; the S-11 Insights section; screenshot tests and goldens; unit tests of the state holder.
6. Steps
- Worktree: from
/Users/jhag/projects/kvitt,git worktree add .claude/worktrees/agent-w6 -b agent-w6 main; in itgit reset --hard main; copyandroid/local.propertiesandandroid/app/google-services.jsonfrom the main checkout (never commit);tools/install-git-hooks.sh. - Read §2. Confirm W7 has landed (
/analytics/incontracts/openapi.yamlonmain) and SPEC v0.29 records it; if not, stop and report. python3 tools/dependency-report/latest.py; record the lines.- Model, data, fakes, feature, goldens.
- Gate (§7). Commit on
agent-w6,git rebase main, rerun the gate. Never merge, push or remove the worktree. The phone only if the brief names this agent for it.
7. Gate
The Android gate, from android/: PATH=/opt/homebrew/opt/openjdk@25/bin:$PATH ../tools/gradle-serial.sh check. Green: BUILD SUCCESSFUL in this session, test counts from fresh XML, screenshot verification passing.
8. HUMAN steps
From SPEC §11.2: look at S-11's Insights on the phone (yes/no), after the orchestrator installs the build and the server image with W7 is deployed.
9. Out of scope
- The endpoints (W7); the web's W-11 (W4); a Room cache of the insights; any change to S-11's offline analytics or to D-128's line chart.
10. Report
- Branch
agent-w6, head commit after rebasing; gate lines; tests; goldens added (names). - Proposed decision entry and §14.2.4 spec text for the contract additions (numbered from the brief); proposed
strings.csvrows (en, sv). - Dependency-report lines; open questions with SPEC section numbers.
11. Numbering
Assigned in the start prompt (a decision and a spec version for the UI-contract change); use TODO(spec) if none was given.