The fresh attested intent node, when a current attestation exists.
(
repo: &Repository,
id: &str,
frontmatter: &Map<String, Value>,
body: &str,
)
| 705 | |
| 706 | /// The fresh attested intent node, when a current attestation exists. |
| 707 | fn fresh_attested_intent( |
| 708 | repo: &Repository, |
| 709 | id: &str, |
| 710 | frontmatter: &Map<String, Value>, |
| 711 | body: &str, |
| 712 | ) -> Option<CanonicalNode> { |
| 713 | let vault_path = format!( |
| 714 | "attestations/{}/attested.md", |
| 715 | sanitize_id(&normalized_id(repo, id)) |
| 716 | ); |
| 717 | let entry = repo.vault_retrieve(&vault_path).ok()??; |
| 718 | let node: CanonicalNode = serde_json::from_str(body_of(&entry).trim_end()).ok()?; |
| 719 | let fresh = serde_json::from_str::<Value>(&entry.frontmatter_json) |
| 720 | .ok() |
| 721 | .and_then(|v| { |
| 722 | v.get("sourceContentHash") |
| 723 | .and_then(Value::as_str) |
| 724 | .map(str::to_string) |
| 725 | }); |
| 726 | if fresh.as_deref() == Some(source_content_hash(frontmatter, body).as_str()) { |
| 727 | Some(node) |
| 728 | } else { |
| 729 | None |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | /// Evidence failures are user-fixable gate refusals over the wire. |
| 734 | fn evidence_status(error: intent_evidence::EvidenceError) -> Status { |
no test coverage detected