By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Prompt wp-update@v9 is ready for review. Design the canary and rollback plan: which cohorts, what traffic percentage, how long each stage dwells, which guardrail thresholds apply and exactly what a rollback flips. Then encode the guardrail decision as a function and test it against a passing and a failing sample.
can_promote(metrics) that requires every guardrail to pass.plan = {
"release": "wp-update@v9",
"baseline": "wp-update@v8",
"stages": [
{"traffic": "5%", "cohort": "tier-2 tenants", "dwell_minutes": 60},
{"traffic": "25%", "cohort": "tier-2 tenants", "dwell_minutes": 60},
{"traffic": "100%", "cohort": "all tenants", "dwell_minutes": 1440},
],
"guardrails": {
"eval_score_min": 0.92,
"error_rate_max": 0.01,
"p95_ms_max": 4000,
"approval_bypasses_max": 0,
},
"rollback": {
"action": "flip flag waypoint_prompt_v9 to off",
"restore": "wp-update@v8",
},
"owner": "exception-desk-eng",
}
def can_promote(metrics: dict) -> bool:
gates = plan["guardrails"]
return (
metrics["eval_score"] >= gates["eval_score_min"]
and metrics["error_rate"] <= gates["error_rate_max"]
and metrics["p95_ms"] <= gates["p95_ms_max"]
and metrics["approval_bypasses"] <= gates["approval_bypasses_max"]
)
passing = {
"eval_score": 0.95,
"error_rate": 0.004,
"p95_ms": 3100,
"approval_bypasses": 0,
}
failing = {
"eval_score": 0.93,
"error_rate": 0.006,
"p95_ms": 4700,
"approval_bypasses": 0,
}
print("stage 1 promote:", can_promote(passing))
print("stage 2 promote:", can_promote(failing))
print("rollback restores:", plan["rollback"]["restore"])
print("stages:", len(plan["stages"]))approval_bypasses == 0), which no average can overrule.Key takeaways
A canary plan names cohorts, traffic percentages and dwell times before launch.
Guardrails combine quality, operations and safety thresholds, and every one must pass to promote.
Rollback restores a named baseline in one flag flip and is rehearsed in advance.
Encoding the decision as a function lets you test promote and rollback against fixed samples.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.