From 8c3dbafc8631212fd098a9e258b17058c4bbe09c Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Sat, 5 Sep 2026 00:45:38 +0200 Subject: [PATCH] docs(plans): task-by-task plan for the anchored model Nine tasks. One through three are the domain and run in strict order: the clamped month step, the type and signature changes, then the split walk. Four (migration), five (validation) and six (the band) each depend on three. Seven (the split editor) is independent. Eight (the purchase dialog) needs seven and five. Nine is docs and demo data. Task three carries two deletions that belong tidily to tasks five and six. They are done early because deleting wouldAdvancePast breaks compilation in both files, and a task that cannot run its own suite cannot be reviewed. Every expected value was checked by hand rather than derived from the implementation: the 30-day step from 2026-09-12 lands on 2026-10-12 then 2026-11-11; 31 Aug + 6 months clamps to 28 Feb 2027; and 31 Jan + 2 months is 31 March, which only holds if the clamp measures from the original day instead of stepping month by month. That last one is the trap in Task 1 and it has its own test. Flagged as the known risk: making SplitEditor generic touches the purchase dialog, which is unrelated to recurring costs. The claim that PurchaseDraft satisfies SplitTarget structurally is checkable by tsc alone and should be verified before the rest of that task is written. --- ...26-09-05-recurring-costs-anchored-model.md | 1687 +++++++++++++++++ 1 file changed, 1687 insertions(+) create mode 100644 docs/plans/2026-09-05-recurring-costs-anchored-model.md diff --git a/docs/plans/2026-09-05-recurring-costs-anchored-model.md b/docs/plans/2026-09-05-recurring-costs-anchored-model.md new file mode 100644 index 0000000..f77d5b8 --- /dev/null +++ b/docs/plans/2026-09-05-recurring-costs-anchored-model.md @@ -0,0 +1,1687 @@ +# Recurring Costs: The Anchored Model — Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** A `lastCharge` recurring cost stops having slots — its next due date is derived from the latest actual charge, so it can be charged any number of times per cycle and each charge restarts the clock. + +**Architecture:** `occurrencesOf` splits on `cost.anchoring` into two walks that share only `stepFrom`. `calendar` keeps the shipped grid, byte-for-byte. `lastCharge` gains an anchored walk with no slots, no confirmation lookup, and no possibility of stepping backwards — which lets three guards be deleted. Two additive UI changes ride along: a real split editor for recurring costs, and a recurring-cost control in the purchase dialog. + +**Tech Stack:** Bun (runtime, test runner, bundler, package manager), TypeScript, React 19, Tailwind 4, shadcn/ui. No new dependencies. + +**Spec:** `docs/specs/2026-09-05-recurring-costs-anchored-model.md` — read it before Task 1. Where plan and spec disagree, the spec wins and the plan is wrong. + +## Global Constraints + +Copied from `AGENTS.md`. Every task's requirements implicitly include these. + +- **Bun only.** `bun test`, `bun install`, `bun run