pub struct BaselineStore { /* private fields */ }Expand description
Manages baseline persistence and regression detection.
Implementations§
Source§impl BaselineStore
impl BaselineStore
Sourcepub fn save(
&self,
eval_set_id: &str,
metrics: &HashMap<String, HashMap<String, f64>>,
) -> Result<()>
pub fn save( &self, eval_set_id: &str, metrics: &HashMap<String, HashMap<String, f64>>, ) -> Result<()>
Save metrics as a baseline.
Writes the metrics map with a timestamp and eval set identifier to the configured path as pretty-printed JSON.
Sourcepub fn load(&self) -> Result<Option<Baseline>>
pub fn load(&self) -> Result<Option<Baseline>>
Load existing baseline.
Returns Ok(None) if the baseline file does not exist.
Returns an error only for actual I/O or parse failures.
Sourcepub fn check_regressions(
&self,
current: &HashMap<String, HashMap<String, f64>>,
tolerance: f64,
) -> Result<Vec<Regression>>
pub fn check_regressions( &self, current: &HashMap<String, HashMap<String, f64>>, tolerance: f64, ) -> Result<Vec<Regression>>
Compare current metrics against baseline and detect regressions.
Every metric and case recorded in the baseline must be present in current.
A regression is reported when baseline_value - current_value > tolerance, when
the current score is NaN, or when the current run has no score for a baseline
metric and case. Metrics and cases that appear only in current are ignored.
Regressions are sorted by metric name, then case id.
§Errors
Returns EvalError::BaselineError when the baseline file does not exist, or
cannot be read or parsed. A missing baseline is an error rather than an empty
result, so a mistyped path or a baseline that was never committed cannot pass
a regression gate.