Prewarm front backend before GCP cutover

Merged
LA
4mo ago
+2224-132

Starts held Codex sessions before migration preparation, keeps the front backend referenced through an unadvertised canary host, and requires five minutes of public canary plus backend-health evidence before active route changes. Also fixes RSS sampler waiting in a subshell.

Tests: go test -p 1 ./...; focused URL-map and golden harness regressions; shell syntax and shellcheck.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Prewarms the front backend through a hidden, authenticated canary route, hard-binds routing selectors to the target instance, and continuously samples front readiness (public canary + backend health) before switching GCP URL‑map routes. Requires five minutes of uninterrupted evidence before changing the active route.

  • New Features

    • Added url-map-routing.py to keep a dedicated canary host/matcher, switch only the active route, retain the warm canary across switches, and assert URL‑map state.
    • Added canary-security-policy.py to render/verify a Cloud Armor policy that authenticates the canary via a token; migration scripts apply and pin this policy per instance.
    • Added wait-for-front-readiness.py and probe-front-readiness.sh to sample public canary responses tied to backend health; the probe forwards the canary token; shared parsing moved to backend_health.py.
    • Extended evidence with routing.active_matcher and routing.canary (host, security policy, attempts, sessions, density, timings); validators pin matcher names, canary host, and security policy per instance and ensure routing.canary.backend_url equals the front URL; migration scripts assert selectors, require a held Codex session before prepare, and run the continuous readiness probe during prewarm.
  • Bug Fixes

    • Reject retargeted selectors, wrong/smuggled/forged canary proofs, missing/partial or gapped canary evidence, and mismatched URL‑map reference counts.
    • Tie backend‑health samples to successful public canary responses.

Summary by CodeRabbit

  • New Features

    • Added safer canary routing controls for staged migrations, including preparation, active-route switching, rollback, and route-state verification.
    • Added validation for canary hostnames, backend health, session continuity, routing evidence, and minimum stability duration.
    • Added support for instance-specific staging and production migration targets.
  • Bug Fixes

    • Prevented invalid, incomplete, or hijacked canary routing from being accepted.
    • Improved migration checks to ensure legacy routes remain correctly controlled during cutover.
  • Tests

    • Expanded end-to-end coverage for canary preparation, cutover, rollback, continuity, and invalid routing scenarios.