rewrit_model/
divergence.rs1use crate::case::SourceLocation;
2use crate::ids::CaseId;
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use serde_json::Value;
6use std::collections::BTreeMap;
7
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
9#[serde(rename_all = "snake_case")]
10pub enum Severity {
11 Blocking,
12 Warning,
13 Allowed,
14}
15
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
17#[serde(rename_all = "snake_case")]
18#[non_exhaustive]
19pub enum DivergenceKind {
20 MissingCandidateCase,
21 MissingReferenceCase,
22 OrphanCandidateCase,
23 OutputMismatch,
24 TypeMismatch,
25 SchemaMismatch,
26 ErrorMismatch,
27 SideEffectMismatch,
28 StdoutMismatch,
29 StderrMismatch,
30 ExitCodeMismatch,
31 Timeout,
32 Flaky,
33 AdapterError,
34 InfraError,
35 PolicyAllowed,
36 WaiverExpired,
37}
38
39#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
40pub struct MinimalReproduction {
41 pub command: String,
42 #[serde(default)]
43 pub args: Vec<String>,
44 pub cwd: Option<String>,
45 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
46 pub env: BTreeMap<String, String>,
47}
48
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
50pub struct Divergence {
51 pub kind: DivergenceKind,
52 pub severity: Severity,
53 pub case_id: CaseId,
54 pub suite: Option<String>,
55 pub path: Option<String>,
56 pub reference: Option<Value>,
57 pub candidate: Option<Value>,
58 pub message: String,
59 pub machine_code: String,
60 pub source_location: Option<SourceLocation>,
61 pub target_location: Option<SourceLocation>,
62 pub policy: Option<String>,
63 #[serde(default)]
64 pub normalizers_applied: Vec<String>,
65 pub hint: Option<String>,
66 #[serde(default, skip_serializing_if = "Option::is_none")]
67 pub minimal_reproduction: Option<MinimalReproduction>,
68}