MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / replay_evidence

Function replay_evidence

atomic-cli/src/commands/rpc.rs:1153–1275  ·  view source on GitHub ↗
(
    session: &Service,
    args: &super::intent::validate::IntentValidate,
)

Source from the content-addressed store, hash-verified

1151}
1152
1153fn replay_evidence(
1154 session: &Service,
1155 args: &super::intent::validate::IntentValidate,
1156) -> CliResult<bool> {
1157 let (manifest, manifest_base) = match &args.replay_evidence {
1158 Some(path) => {
1159 let bytes = intent_evidence::read_manifest(path).map_err(evidence_cli_error)?;
1160 // Relative artifact roots must resolve against the manifest's
1161 // directory on the service host, not the service process's cwd.
1162 let absolute = std::path::absolute(path).map_err(CliError::Io)?;
1163 let base = absolute.parent().unwrap_or_else(|| Path::new("."));
1164 (bytes, base.display().to_string())
1165 }
1166 None => (Vec::new(), String::new()),
1167 };
1168 let request = pb::ReplayVaultEvidenceRequest {
1169 repository: Some(session.reference.clone()),
1170 kind: Kind::Intent as i32,
1171 id: args.id_or_path.clone(),
1172 evidence_context: true,
1173 manifest,
1174 manifest_base,
1175 checker: args
1176 .evidence_checker
1177 .as_ref()
1178 .map(|path| {
1179 std::path::absolute(path)
1180 .unwrap_or_else(|_| path.clone())
1181 .display()
1182 .to_string()
1183 })
1184 .unwrap_or_default(),
1185 view: None,
1186 };
1187 let response = session
1188 .replay_vault_evidence(request)
1189 .map_err(validation_refusal)?;
1190
1191 let context = response
1192 .evidence_context
1193 .as_ref()
1194 .map(evidence_context_json);
1195 let replay = response.evidence_replay.as_ref().map(evidence_replay_json);
1196 let mut results: Vec<serde_json::Value> = response
1197 .issues
1198 .iter()
1199 .map(|message| serde_json::json!({ "message": message }))
1200 .collect();
1201 if let Some(report) = &response.evidence_replay {
1202 for decision in &report.decisions {
1203 if decision.decision != "supported" {
1204 results.push(serde_json::json!({
1205 "focus_node": decision.criterion_id,
1206 "shape": "EvidenceReplay",
1207 "path": "evidence",
1208 "message": format!(
1209 "{}: {} ({})",
1210 decision.claim_type, decision.decision, decision.reason

Callers 1

intent_validateFunction · 0.85

Calls 11

parentMethod · 0.80
displayMethod · 0.80
as_refMethod · 0.80
read_manifestFunction · 0.50
validation_failedFunction · 0.50
cloneMethod · 0.45
replay_vault_evidenceMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected