{"record":{"id":"ad62133ba536a657","repo":"affaan-m/ECC","slug":"audit-health-evidence-does-not-match-its-evaluatio","errorCode":null,"errorMessage":"audit health evidence does not match its evaluation","messagePattern":"audit health evidence does not match its evaluation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/session/store.rs","lineNumber":5635,"sourceCode":"        if !event_consistent {\n            anyhow::bail!(\"harness health evidence is inconsistent with audit outcome\");\n        }\n        if let Some(evaluation_id) = entry.evaluation_id {\n            let evaluation: (Option<String>, Option<String>, Option<bool>, Option<String>, bool) = self.conn.query_row(\n                \"SELECT health_evidence_json, health_evidence_sha256, asserted_health, health_check_status, legacy_unverifiable FROM harness_evaluations WHERE id = ?1\",\n                [evaluation_id],\n                |row| Ok((row.get(0)?, row.get(1)?, row.get(2)?, row.get(3)?, row.get(4)?)),\n            )?;\n            if evaluation\n                != (\n                    Some(json.clone()),\n                    Some(digest.clone()),\n                    Some(asserted),\n                    Some(status.clone()),\n                    false,\n                )\n            {\n                anyhow::bail!(\"audit health evidence does not match its evaluation\");\n            }\n        }\n        Ok(())\n    }\n\n    #[cfg(test)]\n    fn connection_for_test(&self) -> &Connection {\n        &self.conn\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use chrono::{Duration as ChronoDuration, Utc};\n    use std::fs;\n\n    struct TestDir {","sourceCodeStart":5617,"sourceCodeEnd":5653,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/session/store.rs#L5617-L5653","documentation":"When the audit entry references an evaluation (entry.evaluation_id), the verifier loads that evaluation's own health evidence metadata and re-runs the same integrity verification on it. If the evaluation's evidence fails verification, the audit entry's evidence is deemed inconsistent with its source evaluation.","triggerScenarios":"An audit event whose evidence snapshot was generated independently of (or differs from) the evidence stored on the linked harness_evaluation row; the evaluation's evidence failing any of the prior checks (missing, oversized, digest mismatch).","commonSituations":"Copying audit rows between evaluations; regenerating an evaluation's evidence after the audit event was written; partial updates where evaluation evidence changed but audit evidence did not.","solutions":["Ensure audit events attach the exact snapshot stored on their evaluation (same JSON, digest, asserted flag, status)","Re-run the promotion/audit flow so both records are written together from one health check result","Inspect the harness_evaluations row for the evaluation_id and reconcile or regenerate its evidence to match"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Reuse the evaluation's stored evidence when writing the audit entry\nlet (json, digest, asserted, status) = load_evaluation_evidence(evaluation_id)?;\nattach_audit_evidence(entry, json, digest, asserted, status);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write the audit event and its evaluation's evidence in the same transaction from one snapshot","Never copy audit rows between evaluations","If evaluation evidence is regenerated, rewrite the linked audit evidence in the same change"],"tags":["audit","integrity","consistency","rust"],"backgroundTag":"checksum-mismatch","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"}