pub enum EpisodeStanding {
Current,
Open,
Foreign,
Stranded,
}Expand description
Where an open episode stands, as far as the repository can observe it.
It is worth being precise about what is not here. Whether the provider that opened an
episode is still attached to its conversation is not a fact of this repository: the
episode file records no pid, the peer board records no episode id, and a client that
exits without firing its end event leaves a file identical to one a live worker is using.
Guessing would produce exactly the confident-and-wrong answer this subsystem exists to
avoid, so the vocabulary below is the observable one — where the file is, whose worktree
it names, and whether the pointer follows it — and note always says which.
Read as a scale, the four run from “this checkout’s own work” to “nobody’s work any
more”, and only the last is a fault: current and open are both this worktree’s live
episodes and differ only in which one the pointer happens to aim at, foreign belongs to
another worktree and is reported rather than adopted, and stranded is the one that
needs a person, because nothing can close it.
use majordomus_cli::capability::builtin::lifecycle::EpisodeStanding;
// the standings that are somebody's live work, against the one that is nobody's
let live = [EpisodeStanding::Current, EpisodeStanding::Open, EpisodeStanding::Foreign];
assert!(live.iter().all(|s| *s != EpisodeStanding::Stranded));
// serialised as the word `as_str` gives, so the two renderings cannot drift apart
for s in [EpisodeStanding::Current, EpisodeStanding::Foreign, EpisodeStanding::Stranded] {
assert_eq!(serde_json::to_value(s).unwrap(), serde_json::json!(s.as_str()));
}Variants§
Current
This checkout’s pointer resolves to it. continuity.state is about this one.
Open
Open, and it names this worktree, but the pointer names a different episode. Two windows of one provider on one worktree are two workers, and only one is pointed at.
Foreign
It names another worktree of this repository. Reported, never treated as this checkout’s — a record about somebody else’s work quietly becoming yours is the failure the two-tier resolution rule exists to prevent.
Stranded
The worktree it names is gone from disk. Nothing can close it: the close path composes the record from git in the worktree the episode opened in.
Implementations§
Source§impl EpisodeStanding
impl EpisodeStanding
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word this standing is reported and serialised under. One spelling for the value, so that the Cockpit, the API and MCP name a stranded episode identically and a reader who learned the vocabulary once has learned it everywhere.
use majordomus_cli::capability::builtin::lifecycle::EpisodeStanding;
assert_eq!(EpisodeStanding::Stranded.as_str(), "stranded");
// the serialised form is this word, not a second rendering of the same value
assert_eq!(
serde_json::to_value(EpisodeStanding::Stranded).unwrap(),
serde_json::json!(EpisodeStanding::Stranded.as_str()),
);Trait Implementations§
Source§impl Clone for EpisodeStanding
impl Clone for EpisodeStanding
Source§fn clone(&self) -> EpisodeStanding
fn clone(&self) -> EpisodeStanding
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 EpisodeStanding
Source§impl Debug for EpisodeStanding
impl Debug for EpisodeStanding
Source§impl<'de> Deserialize<'de> for EpisodeStanding
impl<'de> Deserialize<'de> for EpisodeStanding
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 EpisodeStanding
Source§impl JsonSchema for EpisodeStanding
impl JsonSchema for EpisodeStanding
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 EpisodeStanding
impl Ord for EpisodeStanding
Source§fn cmp(&self, other: &EpisodeStanding) -> Ordering
fn cmp(&self, other: &EpisodeStanding) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EpisodeStanding
impl PartialEq for EpisodeStanding
Source§fn eq(&self, other: &EpisodeStanding) -> bool
fn eq(&self, other: &EpisodeStanding) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EpisodeStanding
impl PartialOrd for EpisodeStanding
Source§impl Serialize for EpisodeStanding
impl Serialize for EpisodeStanding
impl StructuralPartialEq for EpisodeStanding
Auto Trait Implementations§
impl Freeze for EpisodeStanding
impl RefUnwindSafe for EpisodeStanding
impl Send for EpisodeStanding
impl Sync for EpisodeStanding
impl Unpin for EpisodeStanding
impl UnsafeUnpin for EpisodeStanding
impl UnwindSafe for EpisodeStanding
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.