{"record":{"id":"8dd191137b1c77b7","repo":"affaan-m/ECC","slug":"model-promotion-metrics-missing-required-gates-m","errorCode":null,"errorMessage":"Model promotion metrics missing required gates: {missing}","messagePattern":"Model promotion metrics missing required gates: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/mle-workflow/SKILL.md","lineNumber":277,"sourceCode":"- Primary metric aligned to product behavior\n- Guardrail metrics for latency, calibration, fairness slices, cost, and error concentration\n- Slice metrics for important cohorts, geographies, devices, languages, or data sources\n- Confidence intervals or repeated-run variance when metrics are noisy\n- Failure examples reviewed by a human for high-impact models\n- Explicit \"do not ship\" thresholds\n\n```python\nPROMOTION_GATES = {\n    \"auc\": (\"min\", 0.82),\n    \"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","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/mle-workflow/SKILL.md#L259-L295","documentation":"Illustrative gate check from the mle-workflow skill: assert_promotion_ready first verifies every metric named in PROMOTION_GATES is present in the metrics dict; any missing key (auc, calibration_error, p95_latency_ms, ...) aborts promotion before threshold comparison. An incomplete evaluation report is the input at fault.","triggerScenarios":"Thrown at skills/mle-workflow/SKILL.md:277 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fail CI when the metrics artifact is missing any declared gate","Compute all gate metrics in the same evaluation run that produces them","List required gates in the promotion config schema so omissions surface early"],"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"}