Expand description
What this executable’s own public surface is held to, measured by the executable.
§What it is for
Every other subsystem here is a projection of the capability registry, and the registry is what makes an operation impossible to declare twice. Nothing played that role for the crate’s Rust surface: documentation, examples and behavioural coverage were properties a reviewer noticed or did not. This subsystem makes them a measurement with a stable code, a rule, a location and a remedy, so that the same finding reaches a terminal, a pipeline, an HTTP client and an agent from one reading.
§The parts
source the crate as a syntax tree: what is exported, where, with what documentation
policy what an item owes, and what counts as having paid it
parity the registry against MCP, HTTP, OpenAPI and the command line
report one measurement: counts and findings, sorted, deterministic
model the vocabulary: codes, severities, the report's own shape
rustdoc the tree rustdoc renders from the crate, judged against the same inventory
leaks the shapes a published artifact must never carry, from the one file naming themDiscovery happens once and every renderer reads the value: the same relationship the rest of the executable has with the registry, for the same reason.
§Invariants
- Deterministic. File reads are the only I/O; no network, no clock, no environment. Two runs over one tree produce equal reports, which is what lets a report be compared and committed.
- Whole or nothing. A source file that cannot be parsed is an error, never a skip: a partial inventory that looked clean is the one result this must not produce.
- No exemption list. What the policy does not ask of an item is derived from the item’s kind and shape, and is reported as an exemption with its reason, so that what is not demanded is as visible as what is.
§Errors
Everything here returns crate::Error::InvalidSource and nothing else: a directory
that is not a crate, a file that cannot be read, a file that does not parse, or a
mod declaration that resolves to no file.
use majordomus_cli::quality;
// the whole lifecycle: build a crate, measure it, read the verdict
let dir = tempfile::tempdir().unwrap();
let src = dir.path().join("src");
std::fs::create_dir_all(&src).unwrap();
std::fs::write(src.join("lib.rs"), "//! Thin.\npub fn go() {}\n").unwrap();
let report = quality::report::rust_only(dir.path(), "fixture").unwrap();
assert!(!report.passes());
assert_eq!(report.exit_code(), 10);
// and every finding names the rule that requires it and what to do about it
let first = &report.violations[0];
assert!(first.rule.starts_with("project."));
assert!(!first.remediation.is_empty());Re-exports§
pub use policy::ExampleRequirement;pub use policy::Verdict;pub use source::Example;pub use source::Inventory;pub use source::Item;pub use source::ItemKind;
Modules§
- parity
- Transport parity: the canonical registry against every projection of it.
- policy
- What the repository demands of an exported item, and what counts as having met it.
- report
- Assembling one measurement: the inventory and the registry in, a
QualityReportout. - source
- The crate read as a syntax tree: which items this crate actually exports, where each one is declared, what its documentation says, and which of its doc examples run.
Structs§
- Exemption
- A group of items the example policy does not apply to, with the reason it does not.
- Module
Quality - What the exported module surface looks like.
- Operation
Parity - What the canonical operations look like against the transports that project them.
- Public
ApiQuality - What the exported item surface looks like.
- Quality
Report - One measurement of one crate, and everything found wrong in it.
- Violation
- One finding: what, where, why, and what to do.
Enums§
- Severity
- How much a finding matters.
- Violation
Code - What is wrong, as a stable machine-readable code.
Constants§
- SCHEMA
- The schema of a quality report. Bumped when a consumer would have to change.