Repo B Engine Cutover Runbook
Purpose: Safe, reversible cutover from Repo A to Repo B for dashboard data pipeline. Last Updated: 2025-12-19Status: Pre-Cutover (Shadow Mode Validation Phase)
Preconditions Checklist
Before proceeding with cutover, verify ALL of the following:-
Parity Validation Complete
- MTD validation passed for June, July, August, September 2025
- MoM validation passed for Jul↔Jun, Aug↔Jul, Sep↔Aug
- QTD validation passed for July, August, September 2025 (baseline = Jul 1)
- All parity checks show
[PASS]status - No critical diffs (counts exact, money within $0.05 tolerance)
-
Shadow Datasets Populated
-
payroll_raw_shadow.stage1_snapshotscontains data for June-September 2025 -
payroll_processed_shadow.stage3_snapshotscontains data for June-September 2025 - Row counts match production datasets for validation periods
-
-
Shadow Views Created
-
payroll_analytics_shadow.ceo_snapshotview exists and queries successfully -
payroll_analytics_shadow.top_businessesview exists and queries successfully -
payroll_analytics_shadow.top_agentsview exists and queries successfully -
payroll_analytics_shadow.business_growth_lossview exists and queries successfully
-
-
Environment Configuration
- Repo B upload scripts tested in shadow mode (
BQ_SHADOW_MODE=1) - Repo B can successfully write to shadow datasets
- No production dataset writes occurred during shadow mode testing
- Repo B upload scripts tested in shadow mode (
-
Backup & Rollback Plan
- Production datasets backed up (or verified recent backups exist)
- Rollback procedure documented and tested
- Team notified of cutover window
Cutover Steps
Step 1: Disable Repo A Writers
Action: Stop or disable all Repo A ingestion processes that write to:payroll_raw.stage1_snapshotspayroll_processed.stage3_snapshots
Step 2: Enable Repo B Production Writers
Action: Configure Repo B to write to production datasets.-
Set environment variable:
Or ensure
BQ_SHADOW_MODEis unset/not equal to “1”. -
Verify configuration:
-
Run Repo B upload for current period:
source_file = 'repo_b_upload' and pipeline_version = 'repo_b_v1'.
Step 3: Post-Cutover Verification
Run parity validator (prod vs shadow for validation months):-
CEO Dashboard:
- Total businesses matches expected value
- Total employees matches expected value
- Gross payout matches expected value
- Chargebacks match expected value
- Net payout matches expected value
- Agent commissions match expected value
-
Top Businesses Widget:
- Top 10 businesses match expected list
- Gross payout values match expected amounts
- Employee counts match expected values
-
Top Agents Widget:
- Top 10 agents match expected list
- Commission totals match expected amounts
- Employee counts match expected values
-
Growth/Loss Widget:
- MoM changes match expected values
- New/lost business counts match expected values
- Employee deltas match expected values
Rollback Procedure
If issues are detected during or after cutover:Step 1: Re-enable Repo A Writers
Action: Restart Repo A ingestion processes. Verification:Step 2: Disable Repo B Production Writers
Action: Set shadow mode or stop Repo B uploads.Step 3: Clean Up Repo B Production Data (Optional)
WARNING: Only if Repo B data is incorrect and needs removal.remaining_repo_b_rows = 0 (if cleanup performed).
Post-Cutover Monitoring
Monitor the following for 48 hours after cutover:-
Dashboard Load Times:
- CEO dashboard loads within expected time (< 5 seconds)
- No timeout errors in dashboard API
-
Data Freshness:
- New period data appears within expected time window
- No gaps in period coverage
-
Data Quality:
- No unexpected null values
- Financial totals match expected ranges
- Business/employee counts match expected ranges
-
Error Logs:
- No BigQuery query errors
- No upload failures
- No schema mismatches
Emergency Contacts
- On-Call Engineer: Contact Data Engineering team
- Data Engineering Lead: Contact Data Engineering team
- Product Owner: Contact Product team
Notes
- Shadow datasets (
payroll_raw_shadow,payroll_processed_shadow,payroll_analytics_shadow) will remain for historical validation. - Repo B shadow mode can be re-enabled at any time by setting
BQ_SHADOW_MODE=1. - Production view logic is unchanged; only data source (writers) changes.
Status: ✅ Ready for cutover (pending preconditions verification)