7bddc50a53
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.0 KiB
4.0 KiB
PLAN-W3: Web settle up
1. Goal
Build the web client's settle-up page (W-7) and settlement detail (W-8) in web/src/features/settle/, on W0's foundation, mirroring S-9 and S-10 (SPEC §15.6), with tests.
2. Read first
- SPEC §15 (all), FR-21, FR-11 (AC-11.1 to AC-11.8), FR-12 (AC-12.4), §9.3, §9.4 (allocation proposal), §9.6, §9.8, §14.5.2 (
proposeAllocation,validateSettlement,overSettledAccounts), §14.4.3 to §14.4.6, §13.3 rows S-9 and S-10, D-052, D-074, D-080, D-093. docs/ux/design-spec.mdS-9 and S-10 sections and the components they use;docs/ux/strings.csvkeyssettle_*and shared ones.web/README.mdand W0's report (module map).- Files:
web/src/{app,api,lib,components,i18n}/**(read only),web/src/features/settle/**(W0's placeholder). CLAUDE.md.
3. Already established
- W0 owns everything shared; this plan edits only
web/src/features/settle/. Missing shared pieces are requests to the orchestrator. - Settle up (W-7, mirrors S-9): global from Home (
/app/settle) or per account (/app/settlewith the account; one fixed row, direction swap kept, editable amount, D-052); the direction defaults to "the user who owes pays" with a swap control; the amount defaults per AC-11.3; the proposal from W0'sproposeAllocationover all non-deleted accounts increated_atorder with nets fromcomputeBalances(excluding the settlement being edited); allocation rows with account debt, editable amount and the over-settle warning (overSettledAccounts, AC-11.5); the remaining-to-allocate indicator; "Add account"; date; note; when editing, the saved rows count as edited and "Föreslå igen" re-proposes; the info line on untouched accounts perSettleState.untouched's rule (D-093). Confirm validates withvalidateSettlementand writes onePOST /syncmutation (§15.5); Cancel with the discard dialog (no body, D-080). Computed in the browser as the phone does; E-33 is not needed. - Settlement detail (W-8, mirrors S-10): payer, recipient, amount, date, note, allocations per account, the timeline (AC-12.4); Edit (W-7 with the settlement) and Delete (soft delete, confirmation).
- A rejection from
POST /syncshows its §14.4.6 reason and reloads; nothing is queued.
4. Owned paths
From SPEC §14.7: web/src/features/settle/**. web/package.json only for a dependency line. Nothing else.
5. Deliverables
- W-7 (global, per account, edit) and W-8 (loaded, deleted, missing) with every state of §15.6.
- Tests: proposal defaults in both directions, per-account variant, over-settle warning, remaining indicator, "Föreslå igen", untouched info line, validation errors (§14.5.3 tokens mapped to text), write success and rejection, delete.
6. Steps
- Worktree: from
/Users/jhag/projects/kvitt,git worktree add .claude/worktrees/agent-w3 -b agent-w3 main; in itgit reset --hard main,tools/install-git-hooks.sh,cd web && npm ci. - Read §2. Confirm W0 has landed; if not, stop and report.
npm outdated; record it. No new library is expected.- W-7, then W-8, with tests.
- Manual check (optional): a throwaway server,
npm run dev, record and delete a settlement. Never the owner's development stack or the Pi. - Gate (§7). Commit on
agent-w3,git rebase main, rerun the gate. Never merge, push or remove the worktree.
7. Gate
The web gate, from web/: npm run check. Green: every step passed in this session; Vitest summary quoted.
8. HUMAN steps
From SPEC §11.2: record and delete a settlement in a browser (yes/no), relayed after landing.
9. Out of scope
- Home, accounts (W1); expenses, search (W2); analytics (W4); settings (W5); edits outside
web/src/features/settle/.
10. Report
- Branch
agent-w3, head commit after rebasing; gate lines; Vitest counts. - Pages × states covered;
web_keys added (en, sv); strings missing fromstrings.csv; design-spec mismatches. - Requests for W0's modules; proposed decision entries (numbered from the brief); open questions with SPEC section numbers.
11. Numbering
Assigned in the start prompt; use TODO(spec) if none was given.