{"record":{"id":"75f571fc880e8513","repo":"affaan-m/ECC","slug":"score-must-be-finite-and-between-0-and-1","errorCode":null,"errorMessage":"score must be finite and between 0 and 1","messagePattern":"score must be finite and between 0 and 1","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/harness_eval.rs","lineNumber":436,"sourceCode":"    #[cfg(test)]\n    pub fn calls(&self) -> &[(String, u64)] {\n        &self.calls\n    }\n}\n\nimpl Evaluator for RecordedEvaluator {\n    fn name(&self) -> &str {\n        &self.name\n    }\n\n    fn evaluate(&mut self, candidate_id: &str, seed: u64) -> Result<f64> {\n        self.calls.push((candidate_id.to_string(), seed));\n        let score = *self\n            .scores\n            .get(&(candidate_id.to_string(), seed))\n            .with_context(|| format!(\"missing recorded score for {candidate_id} seed {seed}\"))?;\n        if !score.is_finite() || !(0.0..=1.0).contains(&score) {\n            bail!(\"score must be finite and between 0 and 1\");\n        }\n        Ok(score)\n    }\n\n    fn health_check(&mut self, candidate_id: &str) -> Result<bool> {\n        if self\n            .health_candidate\n            .as_deref()\n            .is_some_and(|expected| expected != candidate_id)\n        {\n            bail!(\"health evidence does not match promoted candidate\");\n        }\n        Ok(self.health_ok)\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct PairedSample {","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/ecc2/src/harness_eval.rs#L418-L454","documentation":"RecordedEvaluator::evaluate looks up the pre-recorded score for the (candidate_id, seed) pair and validates it is a finite number in [0,1]. The error fires for stored scores that are NaN, infinite, or outside the valid range — a corruption guard on recorded evidence, not on live evaluation.","triggerScenarios":"Thrown at ecc2/src/harness_eval.rs:436 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp or normalize the score into the [0, 1] range before recording it.","Guard against NaN/Infinity from division by zero in the scoring computation."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}