MCPcopy Create free account
hub / github.com/AI45Lab/Code / verification_event

Function verification_event

core/src/ahp/contract.rs:169–225  ·  view source on GitHub ↗
(
    run_id: &str,
    session_id: &str,
    agent_id: &str,
    depth: u32,
    summary: &crate::verification::VerificationSummary,
)

Source from the content-addressed store, hash-verified

167}
168
169fn verification_event(
170 run_id: &str,
171 session_id: &str,
172 agent_id: &str,
173 depth: u32,
174 summary: &crate::verification::VerificationSummary,
175) -> a3s_ahp::AhpEvent {
176 let mut residual_risks = Vec::new();
177 if !summary.pending_subjects.is_empty() {
178 residual_risks.push(format!(
179 "pending verification subjects: {}",
180 summary.pending_subjects.join(", ")
181 ));
182 }
183 if !summary.failed_subjects.is_empty() {
184 residual_risks.push(format!(
185 "failed verification subjects: {}",
186 summary.failed_subjects.join(", ")
187 ));
188 }
189
190 let metadata = std::collections::HashMap::from([
191 (
192 "report_count".to_string(),
193 serde_json::json!(summary.report_count),
194 ),
195 (
196 "required_check_count".to_string(),
197 serde_json::json!(summary.required_check_count),
198 ),
199 (
200 "pending_required_check_count".to_string(),
201 serde_json::json!(summary.pending_required_check_count),
202 ),
203 (
204 "failed_check_count".to_string(),
205 serde_json::json!(summary.failed_check_count),
206 ),
207 ]);
208
209 let payload = a3s_ahp::VerificationEvent {
210 run_id: run_id.to_string(),
211 session_id: session_id.to_string(),
212 status: verification_status_to_ahp(summary.status),
213 checks: Vec::new(),
214 residual_risks,
215 updated_at: now(),
216 metadata: Some(metadata),
217 };
218 ahp_event(
219 a3s_ahp::EventType::Verification,
220 session_id,
221 agent_id,
222 depth,
223 serde_json::to_value(payload).expect("verification payload serializes"),
224 )
225}
226

Callers

nothing calls this directly

Calls 5

nowFunction · 0.85
ahp_eventFunction · 0.85
expectMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected