Repo B Shadow Mode Execution Guide
Purpose
Guide for running Repo B in shadow mode and validating dashboard parity.When to run this
- Before Repo B cutover
- After data/logic changes that may impact dashboard parity
- During parity incident investigation
Prerequisites
-
Environment Setup:
-
Required Files:
- Repo B Stage1_Raw CSV files for June-September 2025
- Repo B Stage3_Full_Detail CSV files for June-September 2025
- Location:
data/outputs/repo_b/dashboard_data/{YYYY-MM}/dashboard_csvs/
Inputs
- Periods to backfill (June-September 2025 baseline in this guide)
- Tenant (
creative_benefit_strategiesin examples) - Repo B output CSV files
- Shadow validation output file path (for example
parity_results.json)
Procedure
Last Updated
2025-12-19Overview
Shadow mode allows Repo B to write to parallel datasets (payroll_raw_shadow, payroll_processed_shadow, payroll_analytics_shadow) without affecting production data. This enables safe validation of Repo B output before cutover.
1) Shadow backfill (June-September 2025)
Upload Single Period
Batch Upload Script
Createscripts/shadow_backfill_june_september.sh:
Verification
After upload, verify shadow datasets:2) Create shadow analytics views
Deploy Views
Verification
3) Run parity validation
Basic Execution
With JSON Output
Example Output
Interpreting Results
-
[PASS]: Metric matches within tolerance- Counts: exact match (diff = 0)
- Money: abs diff ≤ $0.05
- Rankings: identical ordered list
-
[FAIL]: Metric mismatch- Check diff values in output
- Review JSON output for detailed comparison
- Investigate root cause before proceeding
Common Issues
-
Missing Shadow Data:
- Error:
No shadow data found for {period} - Fix: Run shadow backfill for the missing period
- Error:
-
View Not Created:
- Error:
Table not found: payroll_analytics_shadow.{view_name} - Fix: Deploy shadow views (Step 2)
- Error:
-
Money Tolerance Exceeded:
- Error:
abs_diff > 0.05 - Fix: Investigate rounding differences or calculation logic
- Error:
-
Ranking Mismatch:
- Error:
prod != shadow(ordered lists differ) - Fix: Check business/agent name normalization
- Error:
4) Review parity results
JSON Output Structure
Review Checklist
- All MTD checks pass for June-September
- All MoM checks pass for Jul↔Jun, Aug↔Jul, Sep↔Aug
- All QTD checks pass for July, August, September
- No money diffs exceed $0.05
- All rankings match exactly
- All counts match exactly
Verification
- Shadow datasets contain expected row counts for all target periods
- Shadow analytics views are deployed and queryable
- Parity validator completes and reports pass/fail breakdown
- Any failing metrics are documented with root-cause notes
Failure modes & fixes
Issue: is_tpa Column Missing
Error:
- Regenerate Stage3 CSV with Repo B engine
- Ensure
is_tpacolumn is included in CSV export
Issue: Shadow Mode Not Active
Error:Issue: Period Not in Shadow Allowlist
Error:- Add period to
ALLOWED_PERIODS_SHADOWinrepo_b/upload_to_bq.py - Or use
--forceflag (dangerous, only for testing)
Artifacts produced
- Shadow backfill execution logs
- Shadow view deployment results
- Parity output (console and optional
parity_results.json) - Review checklist with pass/fail status
Related docs
docs/runbooks/engine_cutover_repoB.mddocs/shadow_mode_final_alignment.mddocs/runbooks/STAGE3_KICKOFF.md
Supporting reference
Next steps
After successful parity validation:- Review Results: Ensure all checks pass
- Document Findings: Note any minor diffs or edge cases
- Proceed to Cutover: Follow
docs/runbooks/engine_cutover_repoB.md
Support
For issues or questions:- Check
docs/shadow_mode_final_alignment.mdfor architecture details - Review
docs/runbooks/engine_cutover_repoB.mdfor cutover procedure - Contact Data Engineering team