Billing usage-plan migration
orq-os Pinned · 3- Done: tier schema merged (#409), plan-tiers branch rebased, integration suite green (41 tests), PR #412 merged.
- In flight: webhook retry handling — agent is adding idempotency keys before retrying failed invoice events.
- Decision: proration runs at period end, not mid-cycle (see pinned message).
- Blocked: staging Stripe keys still pending — using mock gateway in tests meanwhile.
Recommendation: run proration at period end rather than mid-cycle. Mid-cycle proration doubles the invoice-event volume and every provider webhook becomes order-sensitive. Period-end keeps the ledger append-only.
Agreed, period end. Make sure the webhook consumer is idempotent before we flip the flag.
Added idempotency keys to the invoice-event consumer: events are hashed on (event_id, attempt) and replays short-circuit. Retry with exponential backoff lands in webhooks/retry.ts. 12 new tests, all green.