(root: &Path)
| 34 | } |
| 35 | |
| 36 | fn signed_fixture(root: &Path) -> (String, String) { |
| 37 | let repo = Repository::init(root).unwrap(); |
| 38 | repo.init_vault().unwrap(); |
| 39 | let created = repo |
| 40 | .vault_intent_create(IntentCreateOptions { |
| 41 | title: "Retain selected source passages".into(), |
| 42 | priority: None, |
| 43 | assignee: None, |
| 44 | labels: Vec::new(), |
| 45 | session_id: None, |
| 46 | turn_id: None, |
| 47 | kind: None, |
| 48 | }) |
| 49 | .unwrap(); |
| 50 | repo.vault_intent_update(&created.id, IntentUpdateOptions { |
| 51 | content: Some(format!(":::why\nKeep a reviewable retained report.\n:::\n\n:::acceptance-criterion{{#{}-ac-1 status=unmet}}\nSelected passages remain in the retained report.\n:::\n", created.uid)), |
| 52 | force: true, ..Default::default() |
| 53 | }).unwrap(); |
| 54 | let entry = repo.vault_intent_show(&created.id).unwrap(); |
| 55 | let fm: serde_json::Map<String, Value> = serde_json::from_str(&entry.frontmatter_json).unwrap(); |
| 56 | let body = String::from_utf8(entry.content_bytes).unwrap(); |
| 57 | let key = KeyPair::generate(); |
| 58 | let identity = Identity::new("synthetic-reviewer", &key); |
| 59 | let node = lift_and_attest(&fm, &body, &identity, &key).unwrap(); |
| 60 | // Native legacy sidecar format, with the same source anchor as the tracked |
| 61 | // path. No globally installed identity/configuration is needed by the test. |
| 62 | let mut hash = blake3::Hasher::new(); |
| 63 | hash.update(serde_json::to_string(&fm).unwrap().as_bytes()); |
| 64 | hash.update(b"\0"); |
| 65 | hash.update(body.as_bytes()); |
| 66 | let safe: String = created |
| 67 | .id |
| 68 | .chars() |
| 69 | .map(|c| { |
| 70 | if c.is_ascii_alphanumeric() || c == '-' || c == '_' { |
| 71 | c |
| 72 | } else { |
| 73 | '_' |
| 74 | } |
| 75 | }) |
| 76 | .collect(); |
| 77 | let source_hash = format!("blake3:{}", hash.finalize().to_hex()); |
| 78 | let dir = repo.dot_dir().join("canonical/intents").join(&safe); |
| 79 | std::fs::create_dir_all(&dir).unwrap(); |
| 80 | std::fs::write( |
| 81 | dir.join("attested.jsonld"), |
| 82 | serde_json::to_vec(&json!({ |
| 83 | "node":node, "source":{ "sourceContentHash": source_hash } |
| 84 | })) |
| 85 | .unwrap(), |
| 86 | ) |
| 87 | .unwrap(); |
| 88 | // `atomic intent attest` writes the sidecar and a tracked attestation entry. |
| 89 | // The service/daemon path reads only the latter, so mirror both stores. |
| 90 | let vault_path = format!("attestations/{safe}/attested.md"); |
| 91 | let mut attested_body = serde_json::to_vec_pretty(&node.to_value()).unwrap(); |
| 92 | attested_body.push(b'\n'); |
| 93 | repo.vault_store( |
no test coverage detected