Files
orca/cloud/apps/billing/migrations
Neil ec8cfe5dac feat(cloud): ENTITLEMENTS-A plans catalog, entitlement grants and resolver in billing D1 (shadow on dev)
- migration 0008: plans, immutable plan_versions, plan_prices (Stripe mirror), entitlement_grants,
  entitlement_audit, entitlement_shadow_diffs, stripe_sync_state; subscriptions.seat_price_id
- catalog/catalog.json (catalog-as-code: Team, Enterprise, Trial; no prices) + scripts/catalog-apply.ts
- typed entitlement registry (entitlement-keys.ts) with sum/max/union/or aggregation
- grants.ts: idempotent projection of each subscription (Stripe mirror) and trial into grants,
  hold/release/revoke, out-of-order guard, terminal revocation, audit; manual/promo grants
- entitlements.ts: one builder fed by legacy terms or grant terms; ENTITLEMENTS_MODE off|shadow|on;
  shadow records every disagreement; lazy re-projection; cron backfill
- trial hours come from the catalog's trial plan when on (granted trials keep their hours)
- the whole suite runs in legacy, shadow (zero diffs enforced) and on modes
2026-11-11 22:11:18 -08:00
..