# v454 — Hard-Gate Pilot Rollback and Safety Monitoring

## Decision

Reviewed v453 hard billing gate controlled activation and proceeded with v454 hard-gate pilot rollback and safety monitoring before changing payment collection, broker distribution limits, owned portal rules, or internal load-board access.

## What changed

- Added Super Admin API `/api/admin/hard-billing-gates/pilot-safety-monitoring`.
- Added `HardBillingGatePilotSafetyMonitoringService`.
- Added a new **Hard-gate pilot rollback and safety monitoring** panel inside `/admin/subscriptions`.
- Added pilot safety summaries for rollback stop, active pilot workspace count, watch rows, escalation rows, safety evidence, rollback evidence, and pilot identifiers.
- Added row-level pilot safety monitoring states:
  - Stable
  - Watch
  - Escalate
  - Rolled back
  - Standby
  - Locked
- Added a plain rollback plan export that tells Super Admin how to stop the pilot, confirm the allowlist, restart/verify, and record evidence.
- Added CSV exports for pilot safety rows, pilot safety evidence history, and rollback plan.
- Added Super Admin audit evidence recording for:
  - `HARD_BILLING_GATE_PILOT_SAFETY_REVIEWED`
  - `HARD_BILLING_GATE_PILOT_ROLLBACK_RECORDED`
- Added a controlled pilot rollback stop flag to the runtime hard-gate policy:
  - `DISPATCH_SPOT_HARD_BILLING_GATE_PILOT_ROLLBACK_ACTIVE`
- Updated the v453 controlled activation review so the rollback stop is visible in guardrails and blocks controlled pilot activation when active.
- Extended the billing activation master checklist with v454 pilot rollback and safety monitoring evidence.
- Added `.env.example` flags for safety monitoring, rollback recording, rollback stop, rollback reason, and active pilot workspace safety cap.

## What's Visible

### In Super Admin

At `/admin/subscriptions`, Super Admin now sees a **Hard-gate pilot rollback and safety monitoring** panel directly after **Hard billing gate controlled activation**.

The panel shows:

- whether the pilot rollback stop is on or off;
- how many pilot workspaces are actively affected;
- how many rows need watch or escalation;
- how many safety and rollback records exist;
- a rollback plan with clear steps;
- monitored pilot workspace rows with safety status, policy, billing state, access effect, and next step;
- safety review and rollback evidence recording buttons;
- CSV exports for safety rows, history, and rollback plan.

### In Workspace Admin

No Workspace Admin workflow changed.

### In Dispatch Workspace

No dispatch workflow changed.

### In Driver Workspace

No driver workflow changed.

### In Broker Workspace

No broker workflow changed.

### In Company/Fleet Workspace

No company/fleet workflow changed.

## Guardrails

- Payment collection remains off.
- Billing status mutation remains off.
- Broad hard billing gates remain separate.
- Broker distribution limits remain unchanged.
- Owned portal rules remain unchanged.
- Internal load-board access remains unchanged.
- The rollback stop can only reduce controlled pilot hard-gate behavior.
- Recording safety or rollback evidence does not mutate subscriptions, change plans, collect payment, or change downstream access.
- Prisma schema was not changed.

## Validation

- Prisma schema changed: No.
- Local import preflight passed.
- `npm run build` could not run in this sandbox because the uploaded source package does not include `node_modules` and `next` is not installed here.
- Targeted TypeScript parser check was attempted against changed files and only reached expected missing dependency/type errors from the absent install (`react`, `react/jsx-runtime`, `@/` alias modules, and Node `process` types); no changed-file syntax error was surfaced before dependency resolution stopped.
