{"record":{"id":"a68b2f3eaa2303ef","repo":"affaan-m/ECC","slug":"model-failed-promotion-gates-failures","errorCode":null,"errorMessage":"Model failed promotion gates: {failures}","messagePattern":"Model failed promotion gates: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/mle-workflow/SKILL.md","lineNumber":287,"sourceCode":"    \"calibration_error\": (\"max\", 0.04),\n    \"p95_latency_ms\": (\"max\", 80),\n}\n\n\ndef assert_promotion_ready(metrics: dict[str, float]) -> None:\n    missing = sorted(name for name in PROMOTION_GATES if name not in metrics)\n    if missing:\n        raise ValueError(f\"Model promotion metrics missing required gates: {missing}\")\n\n    failures = {\n        name: value\n        for name, (direction, threshold) in PROMOTION_GATES.items()\n        for value in [metrics[name]]\n        if (direction == \"min\" and value < threshold)\n        or (direction == \"max\" and value > threshold)\n    }\n    if failures:\n        raise ValueError(f\"Model failed promotion gates: {failures}\")\n```\n\nUse offline metrics as gates, not guarantees. When the model changes product behavior, plan shadow evaluation, canary rollout, or A/B testing before full rollout.\n\n### 5. Package for Serving\n\nAn ML artifact is production-ready only when the serving contract is testable:\n\n- Model artifact includes version, training data reference, config, and preprocessing\n- Input schema rejects invalid, stale, or out-of-range features\n- Output schema includes model version and confidence or explanation fields when useful\n- Serving path has timeout, batching, resource limits, and fallback behavior\n- CPU/GPU requirements are explicit and tested\n- Prediction logs avoid PII and include enough identifiers for debugging and label joins\n- Integration tests cover missing features, stale features, bad types, empty batches, and fallback path\n\nNever let training-only feature code diverge from serving feature code without a test that proves equivalence.\n","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/mle-workflow/SKILL.md#L269-L305","documentation":"Illustrative gate check from the mle-workflow skill: all required metrics were present, but at least one violated its direction/threshold (e.g. auc below 0.82 or p95 latency above 80ms), so assert_promotion_ready raises listing the failed metrics. This is the deliberate 'do not ship' outcome.","triggerScenarios":"Thrown at skills/mle-workflow/SKILL.md:287 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Block the release pipeline on gate failure rather than overriding manually","Review failing gates for regressions vs. over-strict thresholds","Keep threshold changes in review like code changes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d8409a4b0813771235555e32e3d8046a73988bfa","analyzedAt":"2026-08-26T12:15:34.022Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}