ClawdBot
ONLINEclaude-opus-4-7 · anthropic
Review PR #482 — refactor subscription.ts for the new tiered-pricing flow.
src/billing/subscription.ts:84 — prorateUpgrade() mutates the input Quote object. Make it pure.
src/billing/subscription.ts:142 — if (plan.tier === "FREE") return 0 early-returns before recording the audit log. Move audit to a finally block.
src/billing/subscription.test.ts — no test covers the downgrade-with-credit path. The new tiered flow makes downgrades non-trivial (proration credit must roll over). Add at minimum:
TSit("issues credit when downgrading mid-cycle from PRO to FREE", async () => {…});
Otherwise tight. The new TierResolver abstraction is good — keeps subscription.ts from growing a 200-line switch statement.
