Map a loaded graph into the plain projector input — the CLI's `map_graph_to_input` semantics (the turn parent loads the previous graph and uses ITS activity id; best-effort when it cannot load).
(
repo: &atomic_repository::Repository,
graph: &atomic_core::change::ProvenanceGraph,
change_hash: &atomic_core::types::Hash,
person_did: &str,
)
| 5228 | /// `map_graph_to_input` semantics (the turn parent loads the previous |
| 5229 | /// graph and uses ITS activity id; best-effort when it cannot load). |
| 5230 | fn provenance_map_input( |
| 5231 | repo: &atomic_repository::Repository, |
| 5232 | graph: &atomic_core::change::ProvenanceGraph, |
| 5233 | change_hash: &atomic_core::types::Hash, |
| 5234 | person_did: &str, |
| 5235 | ) -> ( |
| 5236 | atomic_canonical::prov::ProvActivityInput, |
| 5237 | Option<atomic_core::types::Hash>, |
| 5238 | ) { |
| 5239 | use atomic_canonical::prov::{change_urn, ProvActivityInput}; |
| 5240 | use atomic_core::types::Base32; |
| 5241 | let previous = graph.previous; |
| 5242 | let turn_parent = previous.and_then(|prev_hash| { |
| 5243 | repo.load_provenance_graph(&prev_hash) |
| 5244 | .ok() |
| 5245 | .map(|prev| atomic_canonical::prov::activity_urn(&provenance_activity_id(&prev))) |
| 5246 | }); |
| 5247 | let agent_vendor = (!graph.agent_vendor.is_empty()).then(|| graph.agent_vendor.clone()); |
| 5248 | let input = ProvActivityInput { |
| 5249 | change_id_base32: change_hash.to_base32(), |
| 5250 | activity_id: provenance_activity_id(graph), |
| 5251 | started_at: None, |
| 5252 | ended_at: None, |
| 5253 | agent_slug: atomic_canonical::prov::normalize_agent_slug(&graph.agent_name), |
| 5254 | agent_display_name: graph.agent_display_name.clone(), |
| 5255 | agent_vendor, |
| 5256 | person_did: person_did.to_string(), |
| 5257 | generated: graph |
| 5258 | .changes_explained |
| 5259 | .iter() |
| 5260 | .map(|hash| change_urn(&hash.to_base32())) |
| 5261 | .collect(), |
| 5262 | used: Vec::new(), |
| 5263 | turn_parent, |
| 5264 | }; |
| 5265 | (input, previous) |
| 5266 | } |
| 5267 | |
| 5268 | /// The ProvActivityInput as the versioned bundle JSON (schema |
| 5269 | /// "atomic.prov.input.v1") — the CLI deserializes the same shape. |
no test coverage detected