pub struct ObligationClosure {Show 13 fields
pub id: String,
pub title: String,
pub summary: String,
pub discharged_by: String,
pub remote: bool,
pub inputs: Vec<String>,
pub state: ObligationState,
pub staleness: Option<Divergence>,
pub evidence: Option<Evidence>,
pub inputs_hash_now: Option<String>,
pub inputs_files: Option<usize>,
pub detail: String,
pub reproduce: String,
}Expand description
One obligation the task declared, joined with what the vocabulary says about it and with the evidence that does or does not discharge it.
The vocabulary’s fields are repeated here on purpose: a client asking what this task owes gets the token’s title, its summary and the command that would discharge it in the same answer, and needs no second call to render a report.
use majordomus_cli::capability::builtin::obligations::{ObligationClosure, ObligationState};
let owed: ObligationClosure = serde_json::from_str(
r#"{"id":"pages","title":"The published site serves this commit","remote":true,
"state":"owed","detail":"owed, and no evidence was recorded",
"reproduce":"majordomus evidence --covers pages --command 'scripts/pages verify'"}"#,
)
.unwrap();
assert_eq!(owed.state, ObligationState::Owed);
assert!(owed.evidence.is_none() && owed.staleness.is_none(), "nothing to label");
assert!(owed.reproduce.starts_with("majordomus evidence"), "a finding carries its repair");Fields§
§id: StringThe token, as the task’s requires names it.
title: StringFrom the vocabulary; the token itself when it declares none.
summary: StringFrom the vocabulary.
discharged_by: StringFrom the vocabulary: the command that produces the evidence.
remote: boolFrom the vocabulary: whether the fact is remote.
inputs: Vec<String>From the vocabulary: the pathspecs the evidence is hashed over.
state: ObligationStateWhere it stands.
staleness: Option<Divergence>How far the evidence is from this checkout, in the repository’s one staleness
vocabulary. None when there is no evidence to label.
A remote fact is labelled against the commit it was taken at, because the site that
serves a commit goes on serving it while the tree moves underneath. A tree-bound
fact is labelled by re-hashing: equal hashes are exact, and a difference takes the
commit’s label, which is advanced when the working tree has merely moved on and
diverged when the history it named is gone. A token that declares neither inputs
nor a remote fact is bound to nothing and stays exact once recorded — that is the
validator’s behaviour, and it is reproduced rather than tightened here.
evidence: Option<Evidence>The line that discharged it, or None.
inputs_hash_now: Option<String>What the token’s inputs hash to in this tree now — the other half of “stale against
what”. None for a token that declares no inputs, and None when git could not be
asked which files they select.
inputs_files: Option<usize>How many tracked files that hash was taken over. Reported because the shell’s selection and this one are not always the same set — see the module header — and a count is the cheapest way for a reader to see it rather than be told it.
detail: StringOne line: what this obligation’s standing actually is, in the words the validator uses when it refuses.
reproduce: StringThe command that would discharge it. Every finding here carries the way to act on
it, as project.finding-carries-reproduce asks.
Trait Implementations§
Source§impl Clone for ObligationClosure
impl Clone for ObligationClosure
Source§fn clone(&self) -> ObligationClosure
fn clone(&self) -> ObligationClosure
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 ObligationClosure
impl Debug for ObligationClosure
Source§impl<'de> Deserialize<'de> for ObligationClosure
impl<'de> Deserialize<'de> for ObligationClosure
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 ObligationClosure
Source§impl JsonSchema for ObligationClosure
impl JsonSchema for ObligationClosure
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 ObligationClosure
impl PartialEq for ObligationClosure
Source§fn eq(&self, other: &ObligationClosure) -> bool
fn eq(&self, other: &ObligationClosure) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ObligationClosure
impl Serialize for ObligationClosure
impl StructuralPartialEq for ObligationClosure
Auto Trait Implementations§
impl Freeze for ObligationClosure
impl RefUnwindSafe for ObligationClosure
impl Send for ObligationClosure
impl Sync for ObligationClosure
impl Unpin for ObligationClosure
impl UnsafeUnpin for ObligationClosure
impl UnwindSafe for ObligationClosure
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.