Skip to main content

verify_log_messages

Function verify_log_messages 

Source
pub fn verify_log_messages(
    log: &ReductionLog,
    sidecar_messages: &[ChatMessage],
) -> Result<(), ReductionError>
Expand description

Verify every reduction in log resolves against sidecar — the same hash-verify path invert/invert_one walk before ever substituting content back in, without needing an actual reduced view to substitute into. This is the user-facing detector for a broken transparency invariant (C2 contract 3): sessions show-reductions (C4) and convert (C7) both call this before doing anything else with a reduced session, so a corrupt/tampered/stale sidecar is reported — naming the offending record id — before any output is produced, rather than surfacing as a confusing downstream failure (or, worse, silently substituting the wrong content).

Returns the first offending record’s error (which names its id); Ok means every record in log resolves and hash-verifies cleanly.