pub fn check_references(
root: &Path,
decl: &Declarations,
work_dir: &Path,
) -> Result<Vec<String>, Vec<String>>Expand description
The reference solution of every task applied to its fixture: the hidden tests must fail
on the starting state and pass on the reference, or a failing run would say nothing about
the agent. Returns one line per task, and Err listing every task that breaks the rule.
Each task is prepared under <work_dir>/references/<task> with the control’s starting
state and removed once checked; no harness and no provider is involved, so the check
costs nothing to repeat.
use majordomus_cli::economics::runner::check_references;
let (repo, work) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());
// task `solve` starts from `fx/`, verifies with `test -f solved`, and its reference
// solution `ref.patch` creates that file
std::fs::create_dir_all(repo.path().join("fx")).unwrap();
std::fs::write(repo.path().join("fx/app.py"), "x = 1\n").unwrap();
let patch = "--- /dev/null\n+++ b/solved\n@@ -0,0 +1 @@\n+yes\n";
std::fs::write(repo.path().join("ref.patch"), patch).unwrap();
let lines = check_references(repo.path(), &decl, work.path()).unwrap();
assert_eq!(lines, ["solve: fails on the starting state, passes on the reference"]);
// and the workspace, hidden tests and all, is gone
assert!(!work.path().join("references/solve").exists());