//! End-to-end: build a small contract, run the verifier against //! synthetic evidence, print the verdict. use jouleclaw_contract::{ verify, Acceptance, Assertion, AssertionCheck, Evidence, EvidenceItem, Feature, Priority, ValidationContract, }; fn main() { let assertions = vec![ Assertion { id: "A-001".into(), title: "All cargo tests pass".into(), rationale: "Workspace `cargo test` exits 0".into(), priority: Priority::MustHave, check: AssertionCheck::Command { command_hash: "test".into(), expected_exit: 0, }, }, Assertion { id: "A-002".into(), title: "Run journal written".into(), rationale: "Receipt stream produced".into(), priority: Priority::MustHave, check: AssertionCheck::Artifact { path: "receipts/run.jsonl".into(), expected_hash: None, }, }, ]; let features = vec![ Feature { id: "F-001".into(), title: "Cascade dispatch".into(), description: String::new(), claims: vec!["A-001".into()], }, Feature { id: "F-002".into(), title: "Receipt stream".into(), description: String::new(), claims: vec!["A-002".into()], }, ]; let contract = ValidationContract::seal( "Cascade + receipts demo", "did:key:zSample", assertions, features, Acceptance::default(), ) .expect("contract seals"); let mut evidence = Evidence::new(); evidence.push(EvidenceItem::CommandRun { command_hash: "test".into(), exit_code: 0, }); evidence.push(EvidenceItem::ArtifactPresent { path: "receipts/run.jsonl".into(), hash: "cafebabe".into(), }); let verdict = verify(&contract, &evidence); println!("contract: {}", contract.content_hash_hex()); println!("verdict: passed={} — {}", verdict.passed, verdict.summary); println!( "coverage: {} cells across {} assertion(s) × {} feature(s)", verdict.coverage.cells.len(), verdict.coverage.assertion_ids.len(), verdict.coverage.feature_ids.len() ); }