# v438 — Soft Billing Warnings and Hard-Gate Readiness Checklist

## Decision

Proceed with soft billing warnings and a hard-gate readiness checklist before lifecycle-sync audit-note hardening, payment collection, customer portal sessions, webhook subscription mutation, trial-to-paid conversion, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access.

## What changed

- Added Super Admin-only API route `/api/admin/billing-gates/readiness`.
- Added Workspace-authenticated API route `/api/subscriptions/billing-warning`.
- Added `BillingGateReadinessService` to review workspace billing warning state, hard-gate readiness, plan-limit pressure, add-on price readiness, lifecycle warning coverage, provider sync posture, and billing guardrail environment flags.
- Extended `/admin/subscriptions` with a new **Soft warnings and hard-gate readiness** panel.
- Super Admin can now review:
  - overall hard-gate readiness status;
  - workspace rows that are ready, need review, blocked, or locked;
  - soft warning count and urgent warning count;
  - missing subscription coverage;
  - trial, past-due, paused, canceled, and provider-sync warning signals;
  - plan over-limit counts and missing add-on price readiness;
  - workspace type/account class readiness for public paid workspaces;
  - payment collection, customer portal, webhook mutation, trial conversion, broker distribution, owned portal, and internal load-board guardrails;
  - first-fix guidance for each checklist row and workspace row.
- Added CSV exports for hard-gate workspace readiness rows and readiness checklist rows.
- Added a plain Workspace Admin **Subscription notice** card inside `/billing` for soft billing warnings.
- Adjusted the shared entitlement evaluator so past-due, paused, canceled, and over-limit states remain soft warnings while `DISPATCH_SPOT_HARD_BILLING_GATES_ENABLED` is not true.
- Added `.env.example` guardrails for soft warnings, hard billing gates, billing mutation, Stripe payment collection, customer portal, webhook mutation, trial conversion, broker distribution, owned portal rules, and internal load-board access.
- Kept this build review-only and warning-only.

## Visible result

### In Super Admin

At `/admin/subscriptions`, Super Admin now sees **Soft warnings and hard-gate readiness** after the subscription lifecycle review panel. The panel summarizes gate readiness, shows checklist cards, lets Super Admin filter workspace readiness rows, and exports readiness CSVs.

### In Workspace Admin

At `/billing`, a Workspace Admin may see a simple **Subscription notice** card when the workspace has trial, lifecycle, provider-sync, missing-plan, or over-limit conditions. The notice clearly says work can continue and that it does not collect payment, open a payment page, change subscription status, or block Billing Records.

### In Dispatch Workspace

No dispatch workflow is blocked. Existing feature gates still protect features that are not included in the plan, but billing lifecycle states are not treated as hard blocks unless a later approved build turns on the hard-gate environment flag.

### In Driver, Broker, Company/Fleet, and Carrier Workspaces

No workspace-specific workflow change was introduced beyond the shared billing warning/entitlement posture already described.

## Guardrails

- Prisma schema changed: No
- Payment collection activated: No
- Customer portal sessions activated: No
- Webhook subscription mutation activated: No
- Trial-to-paid conversion activated: No
- Billing status mutation activated: No
- Hard billing gates activated: No
- Broker distribution limits changed: No
- Owned portal rules changed: No
- Internal load-board access changed: No
- Workspace Admin technical/provider details exposed: No

## Next recommended check-in

```text
Current baseline on server is v438

review v438 soft billing warnings and hard-gate readiness checklist, then decide whether to proceed with v439 lifecycle sync audit-note hardening and warning acknowledgement history or first harden Workspace Billing warning copy/status coverage before changing payment collection, customer portal sessions, webhook subscription mutation, trial-to-paid conversion, hard billing gates, broker distribution limits, owned portal rules, or internal load-board access
```
