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