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,
)
| 5176 | /// `map_graph_to_input` semantics (the turn parent loads the previous |
| 5177 | /// graph and uses ITS activity id; best-effort when it cannot load). |
| 5178 | fn provenance_map_input( |
| 5179 | repo: &atomic_repository::Repository, |
| 5180 | graph: &atomic_core::change::ProvenanceGraph, |
| 5181 | change_hash: &atomic_core::types::Hash, |
| 5182 | person_did: &str, |
| 5183 | ) -> ( |
| 5184 | atomic_canonical::prov::ProvActivityInput, |
| 5185 | Option<atomic_core::types::Hash>, |
| 5186 | ) { |
| 5187 | use atomic_canonical::prov::{change_urn, ProvActivityInput}; |
| 5188 | use atomic_core::types::Base32; |
| 5189 | let previous = graph.previous; |
| 5190 | let turn_parent = previous.and_then(|prev_hash| { |
| 5191 | repo.load_provenance_graph(&prev_hash) |
| 5192 | .ok() |
| 5193 | .map(|prev| atomic_canonical::prov::activity_urn(&provenance_activity_id(&prev))) |
| 5194 | }); |
| 5195 | let agent_vendor = (!graph.agent_vendor.is_empty()).then(|| graph.agent_vendor.clone()); |
| 5196 | let input = ProvActivityInput { |
| 5197 | change_id_base32: change_hash.to_base32(), |
| 5198 | activity_id: provenance_activity_id(graph), |
| 5199 | started_at: None, |
| 5200 | ended_at: None, |
| 5201 | agent_slug: atomic_canonical::prov::normalize_agent_slug(&graph.agent_name), |
| 5202 | agent_display_name: graph.agent_display_name.clone(), |
| 5203 | agent_vendor, |
| 5204 | person_did: person_did.to_string(), |
| 5205 | generated: graph |
| 5206 | .changes_explained |
| 5207 | .iter() |
| 5208 | .map(|hash| change_urn(&hash.to_base32())) |
| 5209 | .collect(), |
| 5210 | used: Vec::new(), |
| 5211 | turn_parent, |
| 5212 | }; |
| 5213 | (input, previous) |
| 5214 | } |
| 5215 | |
| 5216 | /// The ProvActivityInput as the versioned bundle JSON (schema |
| 5217 | /// "atomic.prov.input.v1") — the CLI deserializes the same shape. |
no test coverage detected