pub enum RulesVerdict {
Proven,
Unproven,
Failing,
}Expand description
What the whole corpus can be said to prove, in one word, before any number is read.
satisfied answers a narrower question — are there findings — and a corpus in which no
blocking rule was ever run has none, because not run, gated and reviewed are weaker
states rather than defects (docs/DOCTRINE.md). Read alone, satisfied: true over such a
corpus says “every rule is enforced” about a repository that has shown nothing. The
verdict is the answer that cannot be read that way: it is proven only when every
blocking rule is proven — a passing run recorded on a clean tree, at a commit that
nothing but the evidence ledger has changed since. A rule whose inputs are merely
unchanged is not that (ADR 0041), and leaves the corpus unproven.
§Example
use majordomus_cli::rules::{RuleState, RulesVerdict};
// a corpus with a finding is failing, whatever else is true of it
assert_eq!(RulesVerdict::of([RuleState::Proven], true), RulesVerdict::Failing);
// one blocking rule never run is enough to leave the corpus unproven
assert_eq!(
RulesVerdict::of([RuleState::Proven, RuleState::NotRun], false),
RulesVerdict::Unproven
);
assert_eq!(RulesVerdict::of([RuleState::Proven], false), RulesVerdict::Proven);
// a pass whose inputs are merely unchanged is not proven
assert_eq!(
RulesVerdict::of([RuleState::Proven, RuleState::InputsUnchanged], false),
RulesVerdict::Unproven
);Variants§
Proven
Every blocking rule is proven: a passing run recorded on a clean tree, at a commit that nothing but the evidence ledger has changed since.
Unproven
No rule is a finding, and at least one blocking rule is not proven — never run, gated, reviewed, stale, or passing with only its inputs unchanged — or there is no blocking rule at all.
Failing
At least one rule declares a class its proof does not support.
Implementations§
Source§impl RulesVerdict
impl RulesVerdict
Sourcepub fn of(
blocking: impl IntoIterator<Item = RuleState>,
any_finding: bool,
) -> Self
pub fn of( blocking: impl IntoIterator<Item = RuleState>, any_finding: bool, ) -> Self
Decide the verdict from the state of every blocking rule and whether any finding exists.
Only proven counts. stale does not: a pass older than its subject is a pass of
something else. Nor does inputs unchanged: a run recorded on a dirty tree, or one
whose repository has moved since, is the absence of a known invalidation and not
proof (ADR 0041), and a corpus verdict of proven over it would be the one badge the
evidence states exist to refuse. An empty set of blocking rules is unproven, not
proven — a corpus that claims nothing has shown nothing, and success by vacancy is
the number that stops meaning anything.
use majordomus_cli::rules::{RuleState, RulesVerdict};
assert_eq!(RulesVerdict::of([RuleState::Stale], false), RulesVerdict::Unproven);
assert_eq!(RulesVerdict::of([], false), RulesVerdict::Unproven);
assert_eq!(
RulesVerdict::of([RuleState::InputsUnchanged], false),
RulesVerdict::Unproven
);Sourcepub fn label(self) -> &'static str
pub fn label(self) -> &'static str
The one word every surface prints for this verdict, and the one word a script greps
for: the serialised form and the rendered form are the same string, so a reader and
a parser can never be told different things about the same report. The three are
proven, unproven and failing, and the middle one exists because “no finding”
and “proven” are not the same answer — RulesVerdict::meaning says why in prose.
use majordomus_cli::rules::RulesVerdict;
assert_eq!(RulesVerdict::Unproven.label(), "unproven");
assert_eq!(RulesVerdict::Proven.label(), "proven");
assert_eq!(RulesVerdict::Failing.label(), "failing");Sourcepub fn meaning(self) -> &'static str
pub fn meaning(self) -> &'static str
What the verdict asserts, in one sentence, carried beside the label so that a reader is never left to infer it from a colour or a word.
The sentence is the whole point of the type. A report that found no fault used to be
rendered as a pass, and “no rule is a finding” is a far weaker statement than “every
blocking rule is proven”: the first is satisfied by a corpus nothing has ever run. unproven says that distinction out loud, in the one place a
person reads, so that an absence of findings cannot be quoted as proof.
use majordomus_cli::rules::RulesVerdict;
assert!(RulesVerdict::Unproven.meaning().contains("not a finding"));
assert!(RulesVerdict::Proven.meaning().contains("Every blocking rule"));Trait Implementations§
Source§impl Clone for RulesVerdict
impl Clone for RulesVerdict
Source§fn clone(&self) -> RulesVerdict
fn clone(&self) -> RulesVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RulesVerdict
Source§impl Debug for RulesVerdict
impl Debug for RulesVerdict
Source§impl<'de> Deserialize<'de> for RulesVerdict
impl<'de> Deserialize<'de> for RulesVerdict
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RulesVerdict
Source§impl Hash for RulesVerdict
impl Hash for RulesVerdict
Source§impl JsonSchema for RulesVerdict
impl JsonSchema for RulesVerdict
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for RulesVerdict
impl Ord for RulesVerdict
Source§fn cmp(&self, other: &RulesVerdict) -> Ordering
fn cmp(&self, other: &RulesVerdict) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RulesVerdict
impl PartialEq for RulesVerdict
Source§fn eq(&self, other: &RulesVerdict) -> bool
fn eq(&self, other: &RulesVerdict) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for RulesVerdict
impl PartialOrd for RulesVerdict
Source§impl Serialize for RulesVerdict
impl Serialize for RulesVerdict
impl StructuralPartialEq for RulesVerdict
Auto Trait Implementations§
impl Freeze for RulesVerdict
impl RefUnwindSafe for RulesVerdict
impl Send for RulesVerdict
impl Sync for RulesVerdict
impl Unpin for RulesVerdict
impl UnsafeUnpin for RulesVerdict
impl UnwindSafe for RulesVerdict
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.