pub struct EpisodeId(/* private fields */);Expand description
An episode’s own identity: s-<YYYYMMDDHHMMSS>-<4 hex>.
This is the canonical session identity and the only one. It is minted once, when the
episode opens, by whoever opens it; it is what every ledger line of the episode is
stamped with; and it is what session_id: names in the closed record. A provider’s own
session string is ProviderSessionId and is never this.
The shape is the shell tool’s, parsed as written rather than as would be tidier: there
are months of these ids in .ai/repo/sessions/ and a parser that refused them would be
a parser that cannot read this repository. It is not crate::execution::ExecutionId’s
shape — that one is x-20260908T010203Z-0a1b2c3d, with a T, a Z and eight hex
digits — and the difference is asserted below so that a refactor cannot quietly align
them and orphan every record already written.
use majordomus_cli::session::EpisodeId;
let id = EpisodeId::parse("s-20260910205542-e2a6").expect("an episode id");
assert_eq!(id.as_str(), "s-20260910205542-e2a6");
assert_eq!(id.minted_at(), "20260910205542");
// what it refuses, and why: a path segment is what this value becomes on disk
assert!(EpisodeId::parse("../../etc/passwd").is_none());
assert!(EpisodeId::parse("s-20260910205542-e2a").is_none(), "four hex digits");
assert!(EpisodeId::parse("x-20260908T010203Z-0a1b2c3d").is_none(), "that is an execution");
assert!(EpisodeId::parse("").is_none());Implementations§
Source§impl EpisodeId
impl EpisodeId
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
Parse an id as the stores write it. None for anything else — which is what keeps
a path, a traversal or a wildcard out of a store lookup, since this value names a
file under state/sessions-closing/ and is matched against record front matter.
use majordomus_cli::session::EpisodeId;
assert!(EpisodeId::parse("s-20260910205542-e2a6").is_some());
assert!(EpisodeId::parse("s-20260910205542-e2a6/../x").is_none(), "one path segment");Sourcepub fn minted_at(&self) -> &str
pub fn minted_at(&self) -> &str
The YYYYMMDDHHMMSS the id was minted at. A reader’s convenience and never a
substitute for started_at: the stamp says when the id was made, the record says
when the episode opened, and an episode recovered from a crash can have the two
differ.
use majordomus_cli::session::EpisodeId;
let id = EpisodeId::parse("s-20260910205542-e2a6").expect("an episode id");
assert_eq!(id.minted_at(), "20260910205542");Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
The id as text. This is the string every ledger line of the episode is stamped with and the one
session_id: names in the closed record.
use majordomus_cli::session::EpisodeId;
let id = EpisodeId::parse("s-20260910205542-e2a6").expect("an episode id");
assert_eq!(id.as_str(), "s-20260910205542-e2a6");Trait Implementations§
Source§impl<'de> Deserialize<'de> for EpisodeId
impl<'de> Deserialize<'de> for EpisodeId
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 EpisodeId
Source§impl JsonSchema for EpisodeId
impl JsonSchema for EpisodeId
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 EpisodeId
impl Ord for EpisodeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for EpisodeId
impl PartialOrd for EpisodeId
impl StructuralPartialEq for EpisodeId
Auto Trait Implementations§
impl Freeze for EpisodeId
impl RefUnwindSafe for EpisodeId
impl Send for EpisodeId
impl Sync for EpisodeId
impl Unpin for EpisodeId
impl UnsafeUnpin for EpisodeId
impl UnwindSafe for EpisodeId
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.