{"record":{"id":"81d0399a4f93bc13","repo":"affaan-m/ECC","slug":"exactly-one-candidate-keyed-health-assertion-is-re","errorCode":null,"errorMessage":"exactly one candidate-keyed health assertion is required","messagePattern":"exactly one candidate-keyed health assertion is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/harness_eval.rs","lineNumber":383,"sourceCode":"        Self {\n            name: \"recorded-v1\".into(),\n            scores,\n            health_ok,\n            health_candidate: None,\n            calls: Vec::new(),\n        }\n    }\n\n    pub fn from_evidence(evidence: RecordedEvidence) -> Result<Self> {\n        if evidence.evaluator != \"recorded-v1\" {\n            bail!(\"CLI evidence evaluator must be recorded-v1\");\n        }\n        let score_count = evidence.scores.values().map(BTreeMap::len).sum::<usize>();\n        if score_count > 20_000 || evidence.scores.keys().any(|id| id.len() != 64) {\n            bail!(\"recorded evidence exceeds bounded score or candidate limits\");\n        }\n        if evidence.health.len() != 1 {\n            bail!(\"exactly one candidate-keyed health assertion is required\");\n        }\n        let (health_candidate, health_ok) = evidence\n            .health\n            .into_iter()\n            .next()\n            .context(\"candidate-keyed health evidence is required\")?;\n        let scores = evidence\n            .scores\n            .into_iter()\n            .flat_map(|(id, values)| {\n                values\n                    .into_iter()\n                    .map(move |(seed, score)| ((id.clone(), seed), score))\n            })\n            .collect();\n        Ok(Self {\n            name: evidence.evaluator,\n            scores,","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/harness_eval.rs#L365-L401","documentation":"from_evidence requires the health map of RecordedEvidence to contain exactly one candidate-keyed health assertion. This error is thrown when the evidence has zero health entries (missing assertion) or more than one (multiple candidates asserted healthy). The recorded evaluator supports only a single promoted candidate's health result.","triggerScenarios":"Calling RecordedEvaluator::from_evidence with evidence.health being an empty map, or with health entries for two or more distinct candidate ids.","commonSituations":"Recording evidence without running any health check; merging evidence from multiple candidates into one RecordedEvidence; building the evidence struct by hand and populating health for every candidate instead of only the promoted one.","solutions":["Ensure evidence.health contains exactly one entry: the candidate id that will be promoted.","Remove extra health entries for non-promoted candidates before calling from_evidence.","Run the health check during evidence recording and record its single boolean result.","Validate the evidence struct (health.len() == 1) before passing it to from_evidence."],"exampleFix":"// before\nevidence.health.insert(candidate_a.clone(), true);\nevidence.health.insert(candidate_b.clone(), false); // two entries -> bails\nlet eval = RecordedEvaluator::from_evidence(evidence)?;\n\n// after\nevidence.health.clear();\nevidence.health.insert(promoted_candidate_id.clone(), true);\nassert_eq!(evidence.health.len(), 1);\nlet eval = RecordedEvaluator::from_evidence(evidence)?;","handlingStrategy":"validation","validationCode":"if evidence.health.len() != 1 {\n    return Err(\"exactly one candidate-keyed health assertion is required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Record health only for the single promoted candidate.","Never merge health maps from multiple evidence runs.","Assert health.len() == 1 as an invariant when constructing RecordedEvidence."],"tags":["validation","evidence","rust"],"backgroundTag":"schema-validation-failed","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}