Files
budget2.0/src/domain/index.ts
T
Lucas WintherandClaude Opus 5 b41b219d94 feat(domain): project recurring occurrences, never store them
A walk rather than a per-month query: under lastCharge anchoring, where a
series sits in a given month depends on every confirmation before it, so the
projection starts at startDate and steps forward. Bounded by upToMonth, which
the caller supplies — the domain still reads no clock.

The data-cap behaviour is one line. `from` is the confirmation's own date
under lastCharge, so confirming a slot early moves every later occurrence with
it. Confirm the 2026-01-31 slot with a purchase dated the 12th and the next
lands on 2026-02-11, not 2026-03-02.

The walk throws if a step fails to advance. n >= 1 is enforced at both write
boundaries so this should be unreachable, but a hang is worse than a throw and
dropping a bill silently is worse than both.

Rewrote the "deleting the confirming purchase" test per controller ruling: the
brief's version was byte-identical to the unconfirmed-series test above it and
asserted nothing new. It now walks the phone cost with the capHit
confirmations, then walks the same cost with an empty map, and asserts the
dates differ and match the unconfirmed series — which is what "deleting the
purchase restores the series" actually means.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-03 03:47:21 +02:00

15 lines
379 B
TypeScript

export const DOMAIN_READY = true;
export * from "./types.ts";
export * from "./money.ts";
export * from "./months.ts";
export * from "./days.ts";
export * from "./fx.ts";
export * from "./allocation.ts";
export * from "./charges.ts";
export * from "./occurrences.ts";
export * from "./fold.ts";
export * from "./views.ts";
export * from "./seed.ts";
export * from "./plans.ts";