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

harness health evidence exceeds integrity verification bound

Error message

harness health evidence exceeds integrity verification bound

What it means

The serialized health evidence JSON in an audit row exceeds the 8192-byte integrity-verification bound, so the store refuses to verify it (a bound this large suggests untrimmed payload rather than legitimate evidence).

Source

Thrown at ecc2/src/session/store.rs:5599

            entry.asserted_health,
            &entry.health_check_status,
        );
        if matches!(fields, (None, None, None, None)) {
            if entry.legacy_unverifiable
                || matches!(
                    entry.event_type.as_str(),
                    "initial_activation" | "promotion_rejected"
                )
            {
                return Ok(());
            }
            anyhow::bail!("missing harness health evidence integrity metadata");
        }
        let (Some(json), Some(digest), Some(asserted), Some(status)) = fields else {
            anyhow::bail!("incomplete harness health evidence integrity metadata");
        };
        if json.len() > 8192 {
            anyhow::bail!("harness health evidence exceeds integrity verification bound");
        }
        let snapshot: HealthEvidenceSnapshot = serde_json::from_str(json)?;
        let snapshot_candidate_id =
            Self::resolve_harness_candidate_id(&self.conn, &snapshot.candidate_id)?;
        if snapshot.canonical_json()? != *json
            || snapshot.digest()? != *digest
            || snapshot.asserted_healthy != asserted
            || snapshot_candidate_id != entry.candidate_id
        {
            anyhow::bail!("harness health evidence integrity verification failed");
        }
        let event_consistent = match entry.event_type.as_str() {
            "promoted" => status == "healthy" && asserted,
            "promotion_rolled_back" => status == "unhealthy" && !asserted,
            "health_check_error_rolled_back" => status == "error",
            _ => false,
        };
        if !event_consistent {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Trim the HealthEvidenceSnapshot to essential, bounded fields before serializing.
  2. Store large evidence externally (object store / file) and embed only a reference plus its digest in the snapshot.
  3. Compress or summarize metrics so the canonical JSON stays well under 8192 bytes.
Defensive patterns

Strategy: validation

Validate before calling

let health_json = health_evidence.canonical_json()?;
if health_json.len() > 8192 {
    return Err(anyhow::anyhow!(
        "health evidence JSON is {} bytes; trim the snapshot to stay under 8192", health_json.len()
    ));
}

Type guard

fn health_evidence_within_bound(he: &HealthEvidenceSnapshot) -> bool {
    he.canonical_json().map(|j| j.len() <= 8192).unwrap_or(false)
}

Try / catch

match verify_audit_entry(&store, &entry) {
    Ok(()) => { /* ok */ }
    Err(e) if e.to_string().contains("exceeds integrity verification bound") => {
        // rebuild the snapshot with trimmed/referenced payloads and rewrite the row
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Verifying an audit entry where health_evidence_json.len() > 8192.

Common situations: The HealthEvidenceSnapshot was built with large/unbounded payloads (full metric arrays, complete traces, raw logs); verbose JSON serialization; a snapshot that embedded an entire evaluation report.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/24786abceb69304a. Report an issue: GitHub.