pub fn uncommitted(
root: &Path,
committed: &Ledger,
) -> Result<Vec<Execution>, Error>Expand description
Every execution the working copy of the ledger holds that committed does not.
The ledger keeps one execution per test, so a row that differs from the committed row of
its test, or that the committed ledger has no row for, is a run recorded since. These are
read only through weakened_by: they withhold proven and never decide a verdict.
An absent working copy holds none. An unreadable one is an error rather than none: a run
it may hold cannot be ruled out, so a verdict that judged past it could read proven over
a failure the checkout has.
use majordomus_cli::evidence::freshness::uncommitted;
use majordomus_cli::evidence::{Ledger, LEDGER_PATH};
let root = tempfile::tempdir().unwrap();
// nothing in the working tree: nothing uncommitted
assert!(uncommitted(root.path(), &Ledger::empty()).unwrap().is_empty());
std::fs::create_dir_all(root.path().join(".ai/repo/evidence")).unwrap();
std::fs::write(root.path().join(LEDGER_PATH), "not json").unwrap();
let refused = uncommitted(root.path(), &Ledger::empty()).unwrap_err().to_string();
assert!(refused.contains(LEDGER_PATH), "{refused}");