# Migration and Cutover Playbook

## Phase 0: Dual-read validation

1. Keep existing form schema/submission path active.
2. Run SurveyJS-based schema generation in parallel.
3. Compare schema checksum and normalized payload for selected forms.
4. Log mismatches to audit table and dashboard.

## Phase 1: Feature-flag rollout

1. Enable new API route by `tenantId + formCode`.
2. Start with internal tenant and 5% traffic.
3. Track p95 latency, submission error ratio, cache hit rate.
4. Promote gradually until 100% for canary tenants.

## Phase 2: Full cutover

1. Enable all tenants/forms on new path.
2. Disable old path writes.
3. Keep old read path for fallback window only.

## Rollback

1. Flip feature flag to legacy path.
2. Purge redis keys for `schema:*` and `master:*`.
3. Restore last-known-good schema snapshot.
4. Validate new submissions continue through legacy route.
