Skip to main content

Module check

Module check 

Source
Expand description

reasoning.check: the executable half of the rules project.advisors-are-optional and project.review-is-recorded-not-claimed. Each check reads files and says what it found; none of them asks an advisor anything.

  • catalogue — the advisor catalogue resolves against the provider table and the model catalogue (one inventory, referenced, never restated);
  • adapters — every adapter the catalogue names has its transport module, so the Node layer is derived from the catalogue rather than keeping a list of its own;
  • coupling — the provider-independent code (this module, its capability, its CLI rendering, its Cockpit page, the transport driver) names no advisor, adapter, executable, provider, vendor or model of the catalogue as a string literal;
  • ci — no CI workflow or gate names a model vendor’s credential variable, so no required gate can depend on a live model;
  • claims — no document asserts a claim the catalogue forbids (“consensus guarantees …”) or that an advisor is required;
  • records — every stored record is readable, every consultation names an advisor its plan selected and one this repository knows, every conclusion’s computed review matches the consultations it cites.

The lifecycle: load the catalogue, its references and the store, then run every check over a repository root; an empty list is a clean repository.

use majordomus_cli::reasoning::catalogue::{AdvisorCatalogue, References};
use majordomus_cli::reasoning::check::run;
use majordomus_cli::reasoning::store::Store;

let root = tempfile::tempdir().unwrap();
let catalogue = AdvisorCatalogue {
    forbidden_claims: vec!["consensus guarantees correctness".into()],
    ..Default::default()
};
let loaded = Store::at(root.path()).load();
assert!(run(root.path(), &catalogue, &References::default(), &loaded).is_empty());

std::fs::write(root.path().join("README.md"), "Consensus guarantees correctness.\n").unwrap();
let findings = run(root.path(), &catalogue, &References::default(), &loaded);
assert_eq!(findings.len(), 1);
assert_eq!((findings[0].check.as_str(), findings[0].subject.as_str()), ("claims", "README.md"));

Structs§

ReasoningFinding
One finding of a reasoning check: which check, where, and what is wrong.

Constants§

ADAPTER_DIR
Where the transport adapters live, relative to the root.
CHECKS
The checks, by name, in the order run performs them.
INDEPENDENT_SOURCES
The source files that must stay provider-independent, relative to the root.
REPOSITORY_CHECKS
The checks that judge a repository’s own workflows and documents rather than the reasoning layer it adopted; they apply only where REPOSITORY_RULE is declared.
REPOSITORY_RULE
The rule whose executable half ci and claims are: what Majordomus’s own CI and documents may say about advisors. A repository that does not declare it is an adopter, and an adopter’s workflows and documents are its product, not its use of the reasoning layer (I1996).

Functions§

applicable
The checks a repository declaring the rules rule_ids is held to, in CHECKS order: every check where REPOSITORY_RULE is among them, and only what an adopter adopted (its catalogue, adapters, coupling and records) where it is not.
catalogue_names
The names the independent code must not spell.
literals_naming
String literals of a source naming any of names: "name" or 'name', exactly.
run
Run every check over the repository at root, in the order of CHECKS.
run_checks
Run the named checks over the repository at root, in the order of CHECKS; a name that is not one of them is ignored. run is this with every check, and applicable says which a repository is held to.