affaan-m/ECC · error · anyhow::Error

invalid canonical health evidence snapshot

Error message

invalid canonical health evidence snapshot

What it means

HealthEvidenceSnapshot::verify rejects snapshots whose schema_version is not 1, whose evaluator is not "recorded-v1", or whose candidate_id is not exactly 64 lowercase-hex characters. It is the structural integrity gate for recorded health evidence before it is digested or trusted.

Source

Thrown at ecc2/src/harness_eval.rs:348

    pub fn canonical_json(&self) -> Result<String> {
        self.verify()?;
        Ok(serde_json::to_string(self)?)
    }

    pub fn digest(&self) -> Result<String> {
        Ok(sha256_hex(self.canonical_json()?.as_bytes()))
    }

    pub fn verify(&self) -> Result<()> {
        if self.schema_version != 1
            || self.evaluator != "recorded-v1"
            || self.candidate_id.len() != 64
            || !self
                .candidate_id
                .bytes()
                .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
        {
            bail!("invalid canonical health evidence snapshot");
        }
        Ok(())
    }
}

pub struct RecordedEvaluator {
    name: String,
    scores: BTreeMap<(String, u64), f64>,
    health_ok: bool,
    health_candidate: Option<String>,
    calls: Vec<(String, u64)>,
}

impl RecordedEvaluator {
    #[cfg(test)]
    pub fn new(scores: BTreeMap<(String, u64), f64>, health_ok: bool) -> Self {
        Self {
            name: "recorded-v1".into(),

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Re-serialize the health evidence snapshot using the canonical encoder before submission.
  2. Ensure the snapshot was produced by the expected recorder version and not hand-edited.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ecc2/src/harness_eval.rs:348 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/3c20b814080ad804. Report an issue: GitHub.