pub struct Closure {
pub present: bool,
pub worktree: String,
pub branch: String,
pub head: String,
pub working_tree: String,
pub task: Option<ActiveTask>,
pub closed: bool,
pub tallies: BTreeMap<String, usize>,
pub obligations: Vec<ObligationClosure>,
pub findings: Vec<String>,
}Expand description
What this checkout’s active task owes, and how much of it is still true.
A clone that has never run the lifecycle answers this too, and answers it as absence:
present false, no task, and a finding saying so. “Nothing owed” and “nothing to owe
it” are different facts, and a served instance must not report the second as the first.
use majordomus_cli::capability::builtin::obligations::Closure;
let fresh: Closure = serde_json::from_str(
r#"{"present":false,"worktree":"/srv/clone","branch":"master","closed":false,
"tallies":{},
"findings":["no active task in this checkout (.ai/local/state/current.yaml); nothing owes anything here"]}"#,
)
.unwrap();
assert!(!fresh.present && !fresh.closed, "nothing that does not exist is closed");
assert!(fresh.task.is_none() && fresh.obligations.is_empty());
assert_eq!(fresh.findings.len(), 1, "absence is reported, not implied");Fields§
§present: boolWhether this checkout has a task to report about at all. False in a clone that has never run the lifecycle, which is not a fault and is not “nothing owed”.
worktree: StringThe worktree this answer is about. Every reading below is scoped to it, and to no other checkout of the same repository.
branch: StringThe branch, or DETACHED.
head: StringThe commit this checkout is on.
working_tree: Stringclean or dirty.
task: Option<ActiveTask>The active task, or None. Its requires is the list the entries below expand.
closed: boolTrue when the task declares obligations and every one of them is discharged and
current — that is, when majordomus.obligation-closure would not refuse
finish --outcome completed. False when anything is owed, stale or undeclared, and
false when there is no task: nothing that does not exist is closed.
tallies: BTreeMap<String, usize>How many obligations stand where, by state word. Absent states are absent rather than zero, so a reader never has to know the vocabulary to read the tallies.
obligations: Vec<ObligationClosure>Every obligation the task declared, in the order it declared them.
findings: Vec<String>What a reader should know before trusting any of the above: an unreadable vocabulary, a ledger that could not be read, a task that declares nothing. Empty is the ordinary case.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Closure
impl<'de> Deserialize<'de> for Closure
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 Closure
Source§impl JsonSchema for Closure
impl JsonSchema for Closure
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 moreimpl StructuralPartialEq for Closure
Auto Trait Implementations§
impl Freeze for Closure
impl RefUnwindSafe for Closure
impl Send for Closure
impl Sync for Closure
impl Unpin for Closure
impl UnsafeUnpin for Closure
impl UnwindSafe for Closure
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.