{"record":{"id":"ff3131b552b82289","repo":"affaan-m/ECC","slug":"recorded-evidence-exceeds-bounded-score-or-candida","errorCode":null,"errorMessage":"recorded evidence exceeds bounded score or candidate limits","messagePattern":"recorded evidence exceeds bounded score or candidate limits","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/harness_eval.rs","lineNumber":380,"sourceCode":"impl RecordedEvaluator {\n    #[cfg(test)]\n    pub fn new(scores: BTreeMap<(String, u64), f64>, health_ok: bool) -> Self {\n        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();","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/harness_eval.rs#L362-L398","documentation":"from_evidence constructs a recorded evaluator from RecordedEvidence and enforces bounded, well-formed input. This error is thrown when the evidence contains more than 20,000 total recorded scores or any candidate id in the scores map is not exactly 64 characters long. The library enforces these bounds to keep memory usage bounded and to ensure candidate ids are sha256-style hex identifiers.","triggerScenarios":"Calling RecordedEvaluator::from_evidence with a RecordedEvidence whose scores map contains more than 20,000 (candidate_id, seed) entries in total, or whose scores keys include a candidate id whose length differs from exactly 64 characters.","commonSituations":"Generating recorded evidence programmatically with placeholder or short candidate ids instead of real 64-char hashes; aggregating scores from a huge multi-candidate sweep without truncation; deserializing an evidence file produced by a different tool version that used shorter ids.","solutions":["Check the recorded evidence before conversion: total score count must be <= 20000 and every key in evidence.scores must be exactly 64 characters.","Regenerate candidate ids as proper 64-character hashes (e.g. sha256 hex) when recording evidence.","Split or trim the evidence so it covers at most 20000 recorded scores, or run multiple evidence files.","Verify the tool/version that produced the evidence file matches the schema this library expects."],"exampleFix":"// before\nlet mut evidence = RecordedEvidence::default();\nfor i in 0..30000 {\n    evidence.scores.entry(format!(\"cand-{i}\")).or_default();\n}\nlet eval = RecordedEvaluator::from_evidence(evidence)?; // bails\n\n// after\nlet evidence = build_evidence_with_hash_ids_max_20k_scores();\nassert!(evidence.scores.len() <= 20_000);\nassert!(evidence.scores.keys().all(|id| id.len() == 64));\nlet eval = RecordedEvaluator::from_evidence(evidence)?;","handlingStrategy":"validation","validationCode":"let score_count: usize = evidence.scores.values().map(|s| s.len()).sum();\nif score_count > 20_000 || evidence.scores.keys().any(|id| id.len() != 64) {\n    return Err(\"evidence exceeds bounded score/candidate limits\");\n}","typeGuard":"fn is_valid_candidate_id(id: &str) -> bool { id.len() == 64 }","tryCatchPattern":null,"preventionTips":["Always generate candidate ids as 64-character hashes (sha256 hex).","Cap recorded score volume at 20000 when building evidence; split runs otherwise.","Validate evidence shape before calling from_evidence."],"tags":["validation","input-limits","rust"],"backgroundTag":"value-out-of-range","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"}