pub enum RuleState {
Proven,
InputsUnchanged,
Stale,
Gated,
Failing,
NotRun,
Reviewed,
Unrunnable,
Dangling,
Unproven,
}Expand description
What the repository can say about one rule’s proof, as a whole.
Ordered strongest to weakest so that a summary sorted by this reads as a ranking. A rule’s
state is made from its parts’ by crate::evidence::freshness::aggregate: a failing part
makes it failing, and otherwise the weakest part that can carry proof decides.
§Example
use majordomus_cli::rules::RuleState;
assert!(RuleState::Proven < RuleState::Stale);
assert!(RuleState::Stale.passing());
assert!(!RuleState::Dangling.passing());Variants§
Proven
Every artifact it names is present, and every test it names has a passing run that nothing has invalidated.
InputsUnchanged
Every artifact is present and every test passed, but at least one run is only un-invalidated rather than measured against this tree.
Stale
A passing run exists, but something it is about has changed since.
Gated
An executable gate runs what this rule names, on every CI run that selects it. The mechanism is in the tree and wired; no verdict for it is recorded here.
Failing
The latest run of a test this rule names did not pass.
NotRun
Every artifact is present, and no run of at least one named test was ever recorded.
Reviewed
The rule declares, with a stated reason, that nothing executable can express it. An honest exemption: counted apart from every proven rule, never counted as one.
Unrunnable
The rule names a path no runner in this repository drives.
Dangling
The rule names a path that is not in the tree. A proof that does not exist is worse than no proof, because the rule reads as proven.
Unproven
The rule names neither a validator nor a test. Correct for a rule nothing executable can express; a defect for a blocking one.
Implementations§
Source§impl RuleState
impl RuleState
Sourcepub fn label(self) -> &'static str
pub fn label(self) -> &'static str
The word every surface prints for this state, written here once so that proven
and inputs unchanged cannot be collapsed into one badge by a renderer.
use majordomus_cli::rules::RuleState;
assert_eq!(RuleState::InputsUnchanged.label(), "inputs unchanged");Sourcepub fn meaning(self) -> &'static str
pub fn meaning(self) -> &'static str
One sentence: what the state means, worded once so that every surface says the same thing rather than each inventing its own gloss.
use majordomus_cli::rules::RuleState;
assert!(RuleState::Dangling.meaning().contains("not in the tree"));Sourcepub fn passing(self) -> bool
pub fn passing(self) -> bool
Does this state carry a passing execution behind it, of any freshness?
use majordomus_cli::rules::RuleState;
assert!(RuleState::Proven.passing());
assert!(!RuleState::Unproven.passing());Sourcepub fn as_proof(self, class: Class) -> (ProofState, bool)
pub fn as_proof(self, class: Class) -> (ProofState, bool)
The one declared mapping of a rule’s state onto the evidence vocabulary, and whether that state can carry proof when a subject aggregates it.
A gate refuses violations, but no recorded run proves the behaviour, so gated reads
not_run. A reviewed exemption and a rule that names nothing read no_test; only a
blocking rule that names nothing drags a subject, because only for it is that a
defect. A dangling path reads unrunnable and still drags.
use majordomus_cli::evidence::ProofState;
use majordomus_cli::rules::{Class, RuleState};
assert_eq!(RuleState::Gated.as_proof(Class::Blocking), (ProofState::NotRun, true));
assert_eq!(RuleState::Reviewed.as_proof(Class::Blocking), (ProofState::NoTest, false));
assert_eq!(RuleState::Unproven.as_proof(Class::Blocking), (ProofState::NoTest, true));
assert_eq!(RuleState::Unproven.as_proof(Class::Advisory), (ProofState::NoTest, false));
assert_eq!(RuleState::Dangling.as_proof(Class::Advisory), (ProofState::Unrunnable, true));Trait Implementations§
impl Copy for RuleState
Source§impl<'de> Deserialize<'de> for RuleState
impl<'de> Deserialize<'de> for RuleState
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 RuleState
Source§impl JsonSchema for RuleState
impl JsonSchema for RuleState
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 RuleState
impl Ord for RuleState
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RuleState
impl PartialOrd for RuleState
impl StructuralPartialEq for RuleState
Auto Trait Implementations§
impl Freeze for RuleState
impl RefUnwindSafe for RuleState
impl Send for RuleState
impl Sync for RuleState
impl Unpin for RuleState
impl UnsafeUnpin for RuleState
impl UnwindSafe for RuleState
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.