Skip to main content

run

Function run 

Source
pub fn run(
    root: &Path,
    catalogue: &AdvisorCatalogue,
    refs: &References,
    loaded: &Loaded,
) -> Vec<ReasoningFinding>
Expand description

Run every check over the repository at root, in the order of CHECKS.

It reads the catalogue, the adapter modules, the provider-independent sources, the CI workflows, the documentation and the loaded records, and asks no advisor anything. The findings come back in check order; an empty list means every rule holds.

use majordomus_cli::reasoning::catalogue::{AdvisorCatalogue, References};
use majordomus_cli::reasoning::check::run;
use majordomus_cli::reasoning::record::ReasoningRecord;
use majordomus_cli::reasoning::store::Loaded;

let record: ReasoningRecord = serde_json::from_value(serde_json::json!({
    "schema": "majordomus/reasoning-record", "version": 1, "id": "consultation-1",
    "task": "t", "recorded_at": "2026-10-01T00:00:01Z",
    "body": {
        "kind": "consultation", "plan": "plan-0", "advisor": "alpha", "status": "timeout",
    },
}))
.unwrap();
let loaded = Loaded { records: vec![record], unreadable: vec![] };
let root = tempfile::tempdir().unwrap();
let found = run(root.path(), &AdvisorCatalogue::default(), &References::default(), &loaded);
let messages: Vec<&str> = found.iter().map(|f| f.message.as_str()).collect();
assert_eq!(
    messages,
    [
        "names advisor 'alpha', which the catalogue does not declare",
        "cites plan plan-0, which is not recorded",
    ]
);