Skip to main content

EvidenceCommand

Enum EvidenceCommand 

Source
pub enum EvidenceCommand {
    Show {
        state: Option<String>,
        status: Option<String>,
        findings: bool,
        check: bool,
        presented: Option<String>,
        presented_tree: Option<String>,
    },
    Claim {
        id: String,
    },
    Proves {
        id: String,
    },
    Record {
        suite: Option<PathBuf>,
        crate_output: Option<PathBuf>,
        origin: Option<String>,
        provenance: Vec<String>,
        coverage: Option<PathBuf>,
        ledger: Option<String>,
        run_record: Option<PathBuf>,
    },
    Stamp {
        producer: Option<String>,
        report: Option<PathBuf>,
        exclude: Vec<String>,
        out: Option<PathBuf>,
    },
}
Expand description

The subcommands of majordomus evidence: the whole matrix, one claim, one test, and the recorder.

show, claim and proves are the command line of evidence.report, evidence.claim and evidence.test; record is the command line of evidence.record, which is a command line and nothing else because it writes a tracked file and this server is read-only; stamp is the command line of evidence.stamp, a read offered only here because it reads a path its caller names. The capability is evidence.test and the command is proves — test is a word the fish completion adapter refuses, so the command line spells the relation with the verb rather than renaming the identity.

use clap::Parser;
use majordomus_cli::cli::{Cli, Command, EvidenceCommand};

fn parse(args: &[&str]) -> EvidenceCommand {
    let cli = Cli::try_parse_from(args.iter().copied()).unwrap();
    let Command::Evidence(args) = cli.command else { panic!("evidence") };
    args.command
}

assert!(matches!(
    parse(&["majordomus", "evidence", "show", "--state", "stale"]),
    EvidenceCommand::Show { state: Some(s), check: false, .. } if s == "stale"
));
assert!(matches!(
    parse(&["majordomus", "evidence", "claim", "evidence-both-directions"]),
    EvidenceCommand::Claim { id } if id == "evidence-both-directions"
));
assert!(matches!(
    parse(&["majordomus", "evidence", "proves", "crate:why"]),
    EvidenceCommand::Proves { id } if id == "crate:why"
));
assert!(Cli::try_parse_from(["majordomus", "evidence", "test", "crate:why"]).is_err());

// recording reads a report a runner already wrote; it runs no test
assert!(matches!(
    parse(&["majordomus", "evidence", "record", "--suite", "tmp/report.tsv"]),
    EvidenceCommand::Record { suite: Some(p), origin: None, .. } if p.ends_with("report.tsv")
));

// a run measures the checkout it left; the recording carries that measurement
assert!(matches!(
    parse(&["majordomus", "evidence", "stamp", "--report", "suite.tsv", "--exclude", "dist"]),
    EvidenceCommand::Stamp { report: Some(r), exclude, .. }
        if r.ends_with("suite.tsv") && exclude == ["dist"]
));
assert!(matches!(
    parse(&[
        "majordomus", "evidence", "record", "--suite", "s.tsv", "--provenance", "p.json",
        "--provenance", "crate=c.json", "--ledger", "local",
    ]),
    EvidenceCommand::Record { provenance, ledger: Some(l), .. }
        if provenance == ["p.json", "crate=c.json"] && l == "local"
));

Variants§

§

Show

Every claim against the evidence recorded for it

Fields

§state: Option<String>

Only claims in this proof state (proven, inputs_unchanged, stale, failing, not_run, unrunnable, no_test)

§status: Option<String>

Only claims declaring this status (guaranteed, advisory, planned, rejected)

§findings: bool

Only the claims whose declared status the evidence does not support

§check: bool

Exit 10 when a claim declares a guarantee the evidence does not support

§presented: Option<String>

Judge at the checked-out commit as committed (HEAD, or any name of it), from the ledger that commit holds, instead of at the working tree

§presented_tree: Option<String>

What you know about the presented commit’s tree (clean, dirty, unknown); it can only weaken the measured state

§

Claim

One claim: its proof state, the execution behind it, and how to reproduce it

Fields

§id: String

The claim id, as docs/CLAIMS.yaml spells it

§

Proves

One test: its latest execution and every claim it proves

Fields

§id: String

suite:<case>, crate:<binary>, or the path a claim names it with

§

Record

Record a run that happened into the ledger

Fields

§suite: Option<PathBuf>

The runner’s TSV report (MJ_TEST_REPORT=<file> bash test/run.sh)

§crate_output: Option<PathBuf>

A file holding cargo test’s output, for the crate’s own integration tests

§origin: Option<String>

Where the run happened: local (the default), ci or release

§provenance: Vec<String>

The file evidence stamp --out wrote; prefix suite=, crate= or coverage= when the file names no producer and several reports are given

§coverage: Option<PathBuf>

The summary scripts/rust-coverage --summary-json wrote

§ledger: Option<String>

repo (the default) or local

§run_record: Option<PathBuf>

Also write the run record to this file

§

Stamp

Measure the checkout as a run left it, for record --provenance

Fields

§producer: Option<String>

The producer whose run this is: suite, crate or coverage

§report: Option<PathBuf>

The report the run wrote

§exclude: Vec<String>

One of the run’s own untracked outputs (a file, or a directory with everything under it)

§out: Option<PathBuf>

Write the measurement to this file

Trait Implementations§

Source§

impl Debug for EvidenceCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for EvidenceCommand

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for EvidenceCommand

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more