pub struct ClaimProof {Show 13 fields
pub id: String,
pub claim: String,
pub status: String,
pub source: Option<String>,
pub implementation: Option<String>,
pub test_path: Option<String>,
pub test: Option<String>,
pub state: ProofState,
pub meaning: String,
pub execution: Option<Execution>,
pub changed: Vec<String>,
pub detail: Option<String>,
pub reproduce: Option<String>,
}Expand description
One claim, joined to whatever the repository actually recorded about it.
The claim’s own fields are carried verbatim beside the derived ones, so that a reader who disbelieves the state can check the join rather than take it.
use majordomus_cli::evidence::{ClaimProof, ProofState};
let proof = ClaimProof {
id: "scope-integrity".into(),
claim: "a commit outside the task's scope is refused".into(),
status: "guaranteed".into(),
source: Some("docs/SCOPE.md".into()),
implementation: Some("apps/majordomus-cli/src/scope.rs".into()),
test_path: Some("test/cases/07_scope.sh".into()),
test: Some("suite:07_scope".into()),
state: ProofState::NotRun,
meaning: ProofState::NotRun.meaning().to_string(),
execution: None,
changed: vec![],
detail: None,
reproduce: Some("bash test/run.sh 07_scope".into()),
};
let json = serde_json::to_value(&proof).unwrap();
// `changed` is emitted empty rather than omitted: a client must not have to tell
// "no file changed" from "the server did not say"
assert_eq!(json["changed"], serde_json::json!([]));
// an execution that does not exist is absent, not a null standing in for one
assert!(json.get("execution").is_none());
// and so is a detail the state did not need
assert!(json.get("detail").is_none());
assert_eq!(json["meaning"], serde_json::json!(ProofState::NotRun.meaning()));§Example
A ClaimProof is produced by report; its state is the whole answer and its
meaning is that answer in a sentence, worded once for every surface.
use majordomus_cli::evidence::{report, ClaimProof, Ledger};
use majordomus_cli::synthetic::SyntheticRepository;
let repo = SyntheticRepository::small().unwrap();
let ledger = Ledger::load(repo.root()).unwrap();
let r = report(&repo.index().unwrap(), &ledger);
let proofs: &[ClaimProof] = &r.claims;
assert!(proofs.is_empty(), "a synthetic tree declares no claims");Fields§
§id: StringThe claim’s id, as docs/CLAIMS.yaml spells it.
claim: StringThe claim sentence.
status: StringThe status the claim declares: guaranteed, advisory, planned, rejected.
source: Option<String>The document that defines the behaviour.
implementation: Option<String>The file that implements it.
test_path: Option<String>The path the claim names as its test, verbatim.
test: Option<String>The test’s stable identity, when a runner owns it.
state: ProofStateWhat the repository can say about the proof.
meaning: StringThat state, in one sentence.
execution: Option<Execution>The execution the state was derived from, when there is one.
changed: Vec<String>The files this claim names that differ between the recorded commit and the working
tree. Empty unless the state is ProofState::Stale.
Always emitted, empty included: the schema this capability publishes says the key is there, and a client that has to tell “no files changed” from “the server did not say” is a client reading two different answers as one.
detail: Option<String>Why the state is what it is, in one sentence, when the state alone does not say: a test that declined to run, a run on a commit the presented revision does not contain, a tree that was not its commit, a failing run the checkout holds uncommitted.
reproduce: Option<String>The command that produces the proof again, when a runner owns the test.
Trait Implementations§
Source§impl Clone for ClaimProof
impl Clone for ClaimProof
Source§fn clone(&self) -> ClaimProof
fn clone(&self) -> ClaimProof
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClaimProof
impl Debug for ClaimProof
Source§impl<'de> Deserialize<'de> for ClaimProof
impl<'de> Deserialize<'de> for ClaimProof
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 ClaimProof
Source§impl JsonSchema for ClaimProof
impl JsonSchema for ClaimProof
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 ClaimProof
impl PartialEq for ClaimProof
Source§fn eq(&self, other: &ClaimProof) -> bool
fn eq(&self, other: &ClaimProof) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ClaimProof
impl Serialize for ClaimProof
impl StructuralPartialEq for ClaimProof
Auto Trait Implementations§
impl Freeze for ClaimProof
impl RefUnwindSafe for ClaimProof
impl Send for ClaimProof
impl Sync for ClaimProof
impl Unpin for ClaimProof
impl UnsafeUnpin for ClaimProof
impl UnwindSafe for ClaimProof
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.