Testing Billing Systems — Simulated Clocks and Golden Invoices
Billing's defining property — post 1 called it time-dominance — makes it nearly untestable by ordinary means: the interesting behavior happens at renewals, trial expiries, grace-window closures, and anniversary boundaries, none of which occur during a test run unless the test controls time itself. The teams that trust their billing systems all converged on the same answer: make the clock an injectable dependency, simulate months in milliseconds, and pin correctness with golden invoices.
Billing becomes testable when time becomes an injected dependency: simulated clocks drive month-long lifecycles in milliseconds, golden invoices pin the money to the cent with diffs as review artifacts, re-derivation audits check production continuously, and property tests cover the proration arithmetic.