assay_core/doctor/
model.rs

1use serde::{Deserialize, Serialize};
2
3use crate::errors::diagnostic::Diagnostic;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct DoctorReport {
7    pub schema_version: u32,   // 1
8    pub generated_at: String,  // rfc3339
9    pub assay_version: String, // e.g. "0.3.4"
10    pub platform: PlatformInfo,
11
12    pub inputs: DoctorInputs,
13    pub config: Option<ConfigSummary>,
14    pub trace: Option<TraceSummary>,
15    pub baseline: Option<BaselineSummary>,
16    pub db: Option<DbSummary>,
17    pub caches: CacheSummary,
18
19    pub diagnostics: Vec<Diagnostic>, // from validate + local checks
20    pub suggested_actions: Vec<SuggestedAction>,
21    pub notes: Vec<String>,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct PlatformInfo {
26    pub os: String,
27    pub arch: String,
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct DoctorInputs {
32    pub config_path: String,
33    pub trace_file: Option<String>,
34    pub baseline_file: Option<String>,
35    pub db_path: Option<String>,
36    pub replay_strict: bool,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct ConfigSummary {
41    pub suite: String,
42    pub model: String,
43    pub test_count: u32,
44    pub metric_counts: std::collections::BTreeMap<String, u32>,
45    pub thresholding_mode: Option<String>,
46    pub max_drop: Option<f64>,
47    pub min_floor: Option<f64>,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct TraceSummary {
52    pub path: String,
53    pub entries: u64,
54    pub schema_version: Option<u32>,
55    pub has_assay_meta: bool,
56    pub coverage: TraceCoverage,
57    pub approx_size_bytes: Option<u64>,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct TraceCoverage {
62    pub has_embeddings: bool,
63    pub has_judge_faithfulness: bool,
64    pub has_judge_relevance: bool,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
68pub struct BaselineSummary {
69    pub path: String,
70    pub suite: String,
71    pub schema_version: u32,
72    pub assay_version: Option<String>,
73    pub entry_count: u32,
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
77pub struct DbSummary {
78    pub path: String,
79    pub size_bytes: Option<u64>,
80    pub runs: Option<u64>,
81    pub results: Option<u64>,
82    pub last_run_id: Option<i64>,
83    pub last_run_started_at: Option<String>,
84}
85
86#[derive(Debug, Clone, Default, Serialize, Deserialize)]
87pub struct CacheSummary {
88    pub assay_cache_dir: Option<String>,
89    pub assay_embeddings_dir: Option<String>,
90    pub cache_size_bytes: Option<u64>,
91    pub embeddings_size_bytes: Option<u64>,
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
95pub struct SuggestedAction {
96    pub title: String,      // "Fix trace miss"
97    pub relates_to: String, // "failure_mode_1_trace_miss"
98    pub why: String,
99    pub steps: Vec<String>, // copy/paste commands
100}