Skip to main content

Module parity

Module parity 

Source
Expand description

Transport parity: the canonical registry against every projection of it.

§What parity means here

A capability is declared once and projected to MCP, to HTTP, to the OpenAPI document and to the command line. The crate’s own suites already prove that a declared projection exists and that no projection carries an orphan — that is tests/projections.rs, and this module does not repeat it. What no test could see is the other direction on the command line: a command that is nobody’s projection.

The command line is the only projection with commands of its own, so it is the only one where an operation can go missing from the API by nobody noticing. This module closes that: every runnable command is either bound to a capability by its CliExposure, or classified in crate::cli::local::LOCAL with a reason that is itself checked.

§The three ways it fails

runnable command, no capability, no classification   -> OPERATION_CLI_UNCLASSIFIED
classification naming no command                     -> OPERATION_CLASSIFICATION_STALE
classification of a command that is a capability     -> OPERATION_CLASSIFICATION_CONFLICT

and a fourth for the claims a classification makes: a rendering must name a capability that exists and answers over HTTP, and an alias must name a command that exists.

use majordomus_cli::quality::parity;
use majordomus_cli::cli;

// the command tree is pure, so parity's command inventory can be read without a repository
let commands = parity::runnable_commands(&cli::tree());
assert!(commands.iter().any(|c| c == "serve"));
assert!(!commands.iter().any(|c| c == "capabilities"), "a pure group runs nothing");

Functions§

inspect
Measure the registry against its projections, and against the command line.
runnable_commands
Every command a person can run, as they type it after majordomus.