Skip to main content

codetether_agent/rlm/oracle/
batch.rs

1//! Batch validation statistics.
2
3use super::trace_types::ValidatedTrace;
4
5/// Statistics from batch trace validation.
6#[derive(Debug, Clone, Default)]
7pub struct BatchValidationStats {
8    pub golden: Vec<ValidatedTrace>,
9    pub consensus: Vec<ValidatedTrace>,
10    pub unverified: Vec<(ValidatedTrace, String)>,
11    pub failed: Vec<(ValidatedTrace, String)>,
12}
13
14impl BatchValidationStats {
15    /// Total number of traces across all buckets.
16    ///
17    /// # Examples
18    ///
19    /// ```ignore
20    /// let stats = BatchValidationStats::default();
21    /// assert_eq!(stats.total(), 0);
22    /// ```
23    pub fn total(&self) -> usize {
24        self.golden.len() + self.consensus.len() + self.unverified.len() + self.failed.len()
25    }
26}
27
28/// Statistics from split-write operations.
29///
30/// Records paths and counts for each JSONL bucket
31/// produced by [`BatchValidationStats::write_jsonl_split`].
32///
33/// # Examples
34///
35/// ```ignore
36/// let stats: SplitWriteStats = batch.write_jsonl_split("out", "pfx")?;
37/// assert_eq!(stats.golden_count, 3);
38/// ```
39#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
40pub struct SplitWriteStats {
41    /// Path to the golden bucket file.
42    pub golden_path: String,
43    /// Path to the consensus bucket file.
44    pub consensus_path: String,
45    /// Path to the failed bucket file.
46    pub failed_path: String,
47    /// Path to the unverified bucket file.
48    pub unverified_path: String,
49    /// Number of golden traces written.
50    pub golden_count: usize,
51    /// Number of consensus traces written.
52    pub consensus_count: usize,
53    /// Number of failed traces written.
54    pub failed_count: usize,
55    /// Number of unverified traces written.
56    pub unverified_count: usize,
57}