Skip to main content

summarize_tracked

Function summarize_tracked 

Source
pub fn summarize_tracked(
    root: &Path,
    query: &EconomicsQuery,
) -> EconomicsSummary
Expand description

summarize over the run records git tracks and nothing else: what majordomus generate publishes. A generated artifact must be the same on every checkout of one commit, and a record someone ran locally and never committed would make it depend on whose checkout generated it. Tracked records are read from the working tree; a record that is on disk and untracked is not read at all, not even to report it.

use majordomus_cli::economics::{summarize, summarize_tracked, DIR};
let dir = tempfile::tempdir().unwrap();
// a git repository declaring one live suite `pilot`; one record, never committed
let recorded = dir.path().join(DIR).join("runs/pilot");
std::fs::create_dir_all(&recorded).unwrap();
std::fs::write(recorded.join("r1.json"), "{").unwrap();
let q = Default::default();
assert_eq!(summarize(dir.path(), &q).diagnostics.len(), 1, "a person sees the local record");
assert!(summarize_tracked(dir.path(), &q).diagnostics.is_empty(), "generation does not");