pub enum IntentEvidenceState {
Current,
Stale,
Failing,
NotRun,
NotDerivable,
Unresolved,
}Expand description
What the evidence behind one criterion says, as a word. Only Current meets a criterion:
a stale, failing, unrecorded or underivable reference never does, and neither does one that
resolves to nothing.
Whether a recorded run is current is not decided here. A test or claim criterion is
judged by the evidence module’s one truth table (evidence::freshness()) at the working
tree and read through evidence::current, the same judgement the claim report and the
subject pages make; IntentEvidenceState::judged is the whole of the translation. So
the state follows the evidence both ways: a criterion met today reads stale or failing
the moment the ledger or the tree says so, and met again once a current pass is recorded.
use majordomus_cli::intent::IntentEvidenceState;
assert_eq!(serde_json::to_string(&IntentEvidenceState::NotRun).unwrap(), "\"not_run\"");
assert_ne!(IntentEvidenceState::Stale, IntentEvidenceState::Current);Variants§
Current
A passing run that is current evidence at the working tree: its commit is in this
history, it measured a tree that was its commit, the test still hashes to what ran,
and nothing the criterion names has changed since — for a test, its source and the
source and implementation of every claim that test proves; for a claim, what the
claim names. A change the criterion does not name, the evidence ledger’s own included,
leaves it current. A test that proves no claim naming an implementation names no code
under test, so for it nothing but the ledger may have changed since the run. The only
state that meets a criterion; the criterion’s proof says whether it rests on
proven or on inputs_unchanged.
Stale
A pass that is not current evidence: something the criterion names has changed since it, it names no code under test and anything but the ledger and the plan’s own records has changed since, the test no longer hashes to what ran, the run’s commit is not in this history (or git could not compare it), or the run measured a tree that was not its commit — a run on a dirty tree, which no later tree can be matched against.
Failing
The latest recorded run failed, timed out or errored.
NotRun
The reference resolves and no run counts for it: none was recorded, the latest run declined to run (a skip), or the claim names no test a runner drives.
NotDerivable
The reference resolves, and this kind of evidence (command, deployment) is not
derivable from the ledger, so it never meets a criterion by itself.
Unresolved
The reference is empty or names nothing this repository holds.
Implementations§
Source§impl IntentEvidenceState
impl IntentEvidenceState
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word every surface prints for this state, the same one serde writes.
use majordomus_cli::intent::IntentEvidenceState;
assert_eq!(IntentEvidenceState::NotDerivable.as_str(), "not_derivable");Sourcepub fn judged(state: ProofState, recorded: TreeState) -> IntentEvidenceState
pub fn judged(state: ProofState, recorded: TreeState) -> IntentEvidenceState
A verdict of the evidence module’s truth table, in this vocabulary: current only when
evidence::current says so, of a run on the tree recorded (the execution’s own
working_tree; TreeState::Unknown when there is none). A pass that is not current
is stale — including a run on a dirty tree whose inputs read unchanged — a skip and an
absence are not run, and a failure is failing.
use majordomus_cli::evidence::{ProofState, TreeState};
use majordomus_cli::intent::IntentEvidenceState;
let judged = IntentEvidenceState::judged;
assert_eq!(judged(ProofState::InputsUnchanged, TreeState::Clean), IntentEvidenceState::Current);
// a run on a tree that was not its commit proves nothing about a later one
assert_eq!(judged(ProofState::InputsUnchanged, TreeState::Dirty), IntentEvidenceState::Stale);
assert_eq!(judged(ProofState::Failing, TreeState::Clean), IntentEvidenceState::Failing);Trait Implementations§
Source§impl Clone for IntentEvidenceState
impl Clone for IntentEvidenceState
Source§fn clone(&self) -> IntentEvidenceState
fn clone(&self) -> IntentEvidenceState
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 IntentEvidenceState
Source§impl Debug for IntentEvidenceState
impl Debug for IntentEvidenceState
Source§impl<'de> Deserialize<'de> for IntentEvidenceState
impl<'de> Deserialize<'de> for IntentEvidenceState
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 IntentEvidenceState
Source§impl JsonSchema for IntentEvidenceState
impl JsonSchema for IntentEvidenceState
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 PartialEq for IntentEvidenceState
impl PartialEq for IntentEvidenceState
Source§fn eq(&self, other: &IntentEvidenceState) -> bool
fn eq(&self, other: &IntentEvidenceState) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for IntentEvidenceState
impl Serialize for IntentEvidenceState
impl StructuralPartialEq for IntentEvidenceState
Auto Trait Implementations§
impl Freeze for IntentEvidenceState
impl RefUnwindSafe for IntentEvidenceState
impl Send for IntentEvidenceState
impl Sync for IntentEvidenceState
impl Unpin for IntentEvidenceState
impl UnsafeUnpin for IntentEvidenceState
impl UnwindSafe for IntentEvidenceState
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<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.