(&self)
| 87 | |
| 88 | impl Command for ProvenanceTrace { |
| 89 | fn run(&self) -> CliResult<()> { |
| 90 | // Route every form through the service layer: the handler resolves |
| 91 | // the target, loads the explaining graphs, maps the projection |
| 92 | // inputs, and pre-walks the prior-turn chain. Identity resolution |
| 93 | // stays CLIENT-SIDE (the identity store is a config read, not |
| 94 | // redb); the projection/signing runs over wire-carried inputs with |
| 95 | // the SAME canonical functions. |
| 96 | if self.json { |
| 97 | let (identity, keypair) = resolve_person(self.identity.as_deref())?; |
| 98 | let person_did = did_for_public_key(&identity.public_key); |
| 99 | if let Some((change_hash, graphs)) = |
| 100 | crate::commands::rpc::provenance_export(&self.target, &person_did)? |
| 101 | { |
| 102 | let values = graphs |
| 103 | .iter() |
| 104 | .map(|wire| { |
| 105 | if self.sign { |
| 106 | attest_prov(&wire.input, &identity, &keypair) |
| 107 | } else { |
| 108 | project(&wire.input) |
| 109 | } |
| 110 | }) |
| 111 | .collect::<Vec<_>>(); |
| 112 | #[cfg(feature = "dsse-export")] |
| 113 | if self.dsse { |
| 114 | return print_dsse(&values, &keypair); |
| 115 | } |
| 116 | print_value(&values, self.sign); |
| 117 | return Ok(()); |
| 118 | } |
| 119 | let root = find_repository_root()?; |
| 120 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 121 | let change_hash = resolve_change_target(&repo, &self.target)?; |
| 122 | let graphs = load_graphs(&repo, &change_hash)?; |
| 123 | let values = graphs |
| 124 | .iter() |
| 125 | .map(|(_, g)| { |
| 126 | let input = map_graph_to_input(&repo, g, &change_hash, &person_did); |
| 127 | if self.sign { |
| 128 | attest_prov(&input, &identity, &keypair) |
| 129 | } else { |
| 130 | project(&input) |
| 131 | } |
| 132 | }) |
| 133 | .collect::<Vec<_>>(); |
| 134 | #[cfg(feature = "dsse-export")] |
| 135 | if self.dsse { |
| 136 | return print_dsse(&values, &keypair); |
| 137 | } |
| 138 | print_value(&values, self.sign); |
| 139 | return Ok(()); |
| 140 | } |
| 141 | |
| 142 | // Plain trace: no identity/key required. Use the graph's own person |
| 143 | // slot as "(unresolved)" — the human chain does not need a signature. |
| 144 | // We still resolve a Person did if one is available so the chain shows |
| 145 | // the real signer; otherwise the actedOnBehalfOf target is left blank. |
| 146 | let person_did = resolve_person(self.identity.as_deref()) |
nothing calls this directly
no test coverage detected