{"record":{"id":"b74e03755d312434","repo":"rohitg00/ai-engineering-from-scratch","slug":"quantile-must-be-between-zero-and-one","errorCode":null,"errorMessage":"quantile must be between zero and one","messagePattern":"quantile must be between zero and one","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/14-evals-testing-debugging-and-observability/code/main.py","lineNumber":95,"sourceCode":"\n\ndef classify_error(exc: Exception) -> str:\n    if isinstance(exc, TimeoutError):\n        return \"transport_timeout\"\n    if isinstance(exc, PermissionError):\n        return \"policy_denial\"\n    if isinstance(exc, json.JSONDecodeError):\n        return \"contract_parse_error\"\n    if isinstance(exc, ValueError):\n        return \"application_validation_error\"\n    return \"unexpected_application_error\"\n\n\ndef percentile(values: list[float], quantile: float) -> float:\n    if not values:\n        return 0.0\n    if not 0 <= quantile <= 1:\n        raise ValueError(\"quantile must be between zero and one\")\n    ordered = sorted(values)\n    index = round((len(ordered) - 1) * quantile)\n    return ordered[index]\n\n\ndef validate_release_gate(gate: dict[str, Any]) -> list[str]:\n    \"\"\"Validate severe-case, regression, trace, and failure-class coverage.\"\"\"\n    errors: list[str] = []\n    thresholds = gate.get(\"thresholds\")\n    required_thresholds = {\n        \"severeCasePassRate\",\n        \"maximumOverallRegressionPoints\",\n        \"maximumSliceRegressionPoints\",\n        \"maximumP95LatencyIncreasePercent\",\n        \"maximumMeanCostIncreasePercent\",\n    }\n    if not isinstance(thresholds, dict) or required_thresholds - set(thresholds):\n        errors.append(\"thresholds are incomplete\")","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/14-evals-testing-debugging-and-observability/code/main.py#L77-L113","documentation":"Error \"quantile must be between zero and one\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at certifications/claude/lessons/14-evals-testing-debugging-and-observability/code/main.py:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}