pub fn summarize(root: &Path, query: &EconomicsQuery) -> EconomicsSummaryExpand description
The one calculator. Reads the declarations and every recorded run under root, forms
and judges the pairs, derives every metric with its class, distribution and interval,
and states the strongest thing the publication rule allows. Never fails: what cannot be
read is a diagnostic, and a repository with no methodology gets present: false.
Every record file on disk is read, the ones not yet committed included, so that a
person sees what they just recorded; summarize_tracked is the same calculation over
the committed records only.
use majordomus_cli::economics::{summarize, model::EconomicsQuery, DIR, NO_CLAIM};
let dir = tempfile::tempdir().unwrap();
let none = summarize(dir.path(), &EconomicsQuery::default());
assert!(!none.present && none.diagnostics.is_empty(), "not benchmarking is not a fault");
std::fs::create_dir_all(dir.path().join(DIR)).unwrap();
std::fs::write(dir.path().join(DIR).join("methodology.yaml"), "schema: x\n").unwrap();
let broken = summarize(dir.path(), &EconomicsQuery::default());
assert!(!broken.present && !broken.verdict.publishable);
assert!(broken.verdict.statement.starts_with(NO_CLAIM));
assert_eq!(broken.diagnostics.len(), 1, "what cannot be read is reported, not raised");