1use serde::{Deserialize, Serialize};
7
8use crate::event::RawEvent;
9use crate::intent::IntentBatch;
10use crate::SanitizedEvent;
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct GoldenTrace {
24 pub trace_id: String,
26 pub window_start_ms: i64,
28 pub window_end_ms: i64,
30 pub raw_events: Vec<RawEvent>,
32 pub expected_sanitized: Vec<SanitizedEvent>,
34 pub expected_intents: IntentBatch,
36 pub expected_actions: Vec<ExecutedAction>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct ExecutedAction {
43 pub action_type: String,
45 pub target: Option<String>,
47 pub executed_at_ms: i64,
49 pub success: bool,
51 pub error_reason: Option<String>,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct ReplayResult {
58 pub trace_id: String,
60 pub sanitization_match: bool,
62 pub sanitization_divergences: Vec<usize>,
64 pub policy_match: bool,
66 pub policy_divergences: Vec<String>,
68 pub execution_match: bool,
70 pub execution_divergences: Vec<usize>,
72}
73
74impl ReplayResult {
75 pub fn all_match(&self) -> bool {
78 self.sanitization_match && self.policy_match && self.execution_match
79 }
80}