pub struct Corpus {
pub rows: Vec<RunRow>,
pub sessions_read: usize,
}Expand description
Every run the scan looked at, newest session first.
Fields§
§rows: Vec<RunRow>§sessions_read: usizeSessions read, including those that contributed no rows — the denominator for “how much of the store did this answer come from”.
Implementations§
Source§impl Corpus
impl Corpus
Sourcepub fn scan(dir: &Path, scan: &Scan) -> Result<Corpus>
pub fn scan(dir: &Path, scan: &Scan) -> Result<Corpus>
Read outcomes out of the session store.
Best-effort per session, like every other reader over this store: an unreadable or torn transcript contributes nothing and does not stop the ones after it.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn filter(&self, keep: impl Fn(&RunRow) -> bool) -> Corpus
pub fn filter(&self, keep: impl Fn(&RunRow) -> bool) -> Corpus
Keep only the rows a predicate accepts. sessions_read is preserved,
because it describes the scan and not the selection.
pub fn tool_calls(&self) -> u64
pub fn tool_errors(&self) -> u64
Sourcepub fn tool_error_rate(&self) -> Option<f64>
pub fn tool_error_rate(&self) -> Option<f64>
Share of attempted calls the environment refused.
None when nothing was attempted — the denominator is zero, and a
rate over no calls is undefined rather than perfect. That distinction
is the one a threshold silent on zero gets wrong, which is how a
trigger that stopped working entirely read as healthy.
Sourcepub fn ended_on_failed_call(&self) -> usize
pub fn ended_on_failed_call(&self) -> usize
Runs that decided they were done with their last call failed.
Sourcepub fn rate_of(&self, of: impl Fn(&RunRow) -> bool) -> Option<f64>
pub fn rate_of(&self, of: impl Fn(&RunRow) -> bool) -> Option<f64>
Share of runs that did. None on an empty corpus, for the reason
above.
Sourcepub fn stop_causes(&self) -> BTreeMap<Option<StopCause>, usize>
pub fn stop_causes(&self) -> BTreeMap<Option<StopCause>, usize>
How runs ended. Runs recorded before stop_cause existed, or written
by a path that did not set it, count under None rather than being
assumed complete.