{"record":{"id":"4e15b41333fce421","repo":"affaan-m/ECC","slug":"incomplete-harness-health-evidence-integrity-metad","errorCode":null,"errorMessage":"incomplete harness health evidence integrity metadata","messagePattern":"incomplete harness health evidence integrity metadata","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/session/store.rs","lineNumber":5596,"sourceCode":"        let fields = (\n            &entry.health_evidence_json,\n            &entry.health_evidence_sha256,\n            entry.asserted_health,\n            &entry.health_check_status,\n        );\n        if matches!(fields, (None, None, None, None)) {\n            if entry.legacy_unverifiable\n                || matches!(\n                    entry.event_type.as_str(),\n                    \"initial_activation\" | \"promotion_rejected\"\n                )\n            {\n                return Ok(());\n            }\n            anyhow::bail!(\"missing harness health evidence integrity metadata\");\n        }\n        let (Some(json), Some(digest), Some(asserted), Some(status)) = fields else {\n            anyhow::bail!(\"incomplete harness health evidence integrity metadata\");\n        };\n        if json.len() > 8192 {\n            anyhow::bail!(\"harness health evidence exceeds integrity verification bound\");\n        }\n        let snapshot: HealthEvidenceSnapshot = serde_json::from_str(json)?;\n        let snapshot_candidate_id =\n            Self::resolve_harness_candidate_id(&self.conn, &snapshot.candidate_id)?;\n        if snapshot.canonical_json()? != *json\n            || snapshot.digest()? != *digest\n            || snapshot.asserted_healthy != asserted\n            || snapshot_candidate_id != entry.candidate_id\n        {\n            anyhow::bail!(\"harness health evidence integrity verification failed\");\n        }\n        let event_consistent = match entry.event_type.as_str() {\n            \"promoted\" => status == \"healthy\" && asserted,\n            \"promotion_rolled_back\" => status == \"unhealthy\" && !asserted,\n            \"health_check_error_rolled_back\" => status == \"error\",","sourceCodeStart":5578,"sourceCodeEnd":5614,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/session/store.rs#L5578-L5614","documentation":"Raised when harness health evidence integrity metadata is present but incomplete: the verifier expects all four fields (evidence JSON, SHA-256 digest, asserted-health flag, health check status) via the `fields` tuple, and any None among them triggers this bail. It guarantees no partially-specified evidence can pass verification.","triggerScenarios":"Writing an audit entry with, say, evidence JSON and digest but a missing asserted_health or health_check_status field; a partial migration or manual UPDATE that sets only some evidence columns.","commonSituations":"Schema migrations that added new evidence columns after older rows were written; a bug where one field is written after a failed health check; hand-edited database rows.","solutions":["Ensure all four evidence fields (json, sha256 digest, asserted flag, status) are populated atomically when the audit event is created","Inspect the offending row (SELECT health_evidence_json, health_evidence_sha256, asserted_health, health_check_status FROM harness_evaluations/audit) to find which field is NULL and backfill it","If the evidence is unrecoverable, mark the row as legacy_unverifiable rather than attaching partial evidence"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure all four evidence fields are set atomically before insert\nassert!(json.is_some() && digest.is_some() && asserted.is_some() && status.is_some(),\n        \"health evidence metadata must be complete\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write all evidence columns in a single transaction/statement, never field-by-field","Model evidence as a struct so partial construction is a compile error","Backfill old rows once during migration and flag any that cannot be backfilled"],"tags":["audit","integrity","rust","null"],"backgroundTag":"missing-required-argument","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"}