Best-effort compact provenance for a change: session, agent label, turn timestamp, and governing plan id. `None` if no provenance graph explains it.
(repo: &Repository, hash_b32: &str)
| 1085 | /// Best-effort compact provenance for a change: session, agent label, turn |
| 1086 | /// timestamp, and governing plan id. `None` if no provenance graph explains it. |
| 1087 | fn load_provenance_compact(repo: &Repository, hash_b32: &str) -> Option<serde_json::Value> { |
| 1088 | let hash = Hash::from_base32(hash_b32.as_bytes())?; |
| 1089 | let graphs = load_graphs(repo, &hash).ok()?; |
| 1090 | let (_, g) = graphs.first()?; |
| 1091 | let agent = if g.agent_display_name.is_empty() { |
| 1092 | g.agent_name.clone() |
| 1093 | } else { |
| 1094 | g.agent_display_name.clone() |
| 1095 | }; |
| 1096 | Some(serde_json::json!({ |
| 1097 | "session_id": g.session_id, |
| 1098 | "agent": agent, |
| 1099 | "timestamp": g.timestamp, |
| 1100 | "plan_id": g.plan_id, |
| 1101 | })) |
| 1102 | } |
| 1103 | |
| 1104 | #[cfg(test)] |
| 1105 | mod tests { |
no test coverage detected