{"record":{"id":"3611e07fae83796b","repo":"affaan-m/ECC","slug":"samples-cannot-be-empty","errorCode":null,"errorMessage":"samples cannot be empty","messagePattern":"samples cannot be empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/harness_eval.rs","lineNumber":522,"sourceCode":"\nimpl PromotionPolicy {\n    pub fn validate(self) -> Result<()> {\n        if self.min_samples == 0 {\n            bail!(\"minimum samples must be positive\");\n        }\n        if !self.min_mean_delta.is_finite() {\n            bail!(\"minimum mean delta must be finite\");\n        }\n        if !self.min_win_rate.is_finite() || !(0.0..=1.0).contains(&self.min_win_rate) {\n            bail!(\"minimum win rate must be between 0 and 1\");\n        }\n        Ok(())\n    }\n\n    pub fn compare(self, samples: &[PairedSample]) -> Result<Comparison> {\n        self.validate()?;\n        if samples.is_empty() {\n            bail!(\"samples cannot be empty\");\n        }\n        if samples\n            .iter()\n            .map(|sample| sample.seed)\n            .collect::<BTreeSet<_>>()\n            .len()\n            != samples.len()\n        {\n            bail!(\"sample seeds must be unique\");\n        }\n        if samples.iter().any(|s| {\n            !s.candidate_score.is_finite()\n                || !s.baseline_score.is_finite()\n                || !(0.0..=1.0).contains(&s.candidate_score)\n                || !(0.0..=1.0).contains(&s.baseline_score)\n        }) {\n            bail!(\"scores must be finite and between 0 and 1\");\n        }","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/ecc2/src/harness_eval.rs#L504-L540","documentation":"PromotionPolicy::compare rejects an empty samples slice after validating the policy itself. A promotion decision cannot be made without paired samples, so an empty result set from evaluation is an error rather than a silent pass.","triggerScenarios":"Thrown at ecc2/src/harness_eval.rs:522 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply at least one sample before requesting the evaluation.","Verify the sampling step ran and did not filter out every sample."],"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"}