pub enum Freshness {
Fresh,
Aging,
Stale,
Unknown,
Invalid,
}Expand description
How old a record is, judged against session.freshness in the policy.
This is the second of two independent judgements every record carries, and it exists
because the first one cannot answer this question. Divergence says where a record’s
commit sits relative to HEAD; advanced means that commit is an ancestor of this one,
which sounds like agreement and is identically true on the day the record is written and
a month later. Between 2026-09-05 and 2026-09-11 this repository served a handover that
was advanced and six days dead, and every surface that read this model — MCP, the HTTP
API, the Cockpit — presented its Next Action as the thing to do (ADR 0052).
The thresholds are policy and are read, never restated here: a constant in this file
would be a second source of truth for a number the policy owns, and a repository whose
policy predates the key is reported as Freshness::Unknown naming the missing key
rather than judged against a default nobody declared.
The five words divide into two groups, and the division is the one a caller acts on:
fresh and aging are current and may be presented as the instruction, stale and
invalid must be shown as history, and unknown is neither — a record nobody can date
is not thereby an old record, and treating it as one would quietly discard a briefing
that is perfectly good. Freshness::history is that division, and it is the only
place it is decided.
use majordomus_cli::capability::builtin::continuity::Freshness;
// the two renderings are one value: the serialised word is the word `as_str` gives,
// so a reader who met `stale` from MCP and from the command line met one fact
let stale = serde_json::to_value(Freshness::Stale).unwrap();
assert_eq!(stale, serde_json::json!("stale"));
assert_eq!(stale.as_str(), Some(Freshness::Stale.as_str()));
// and the division a caller acts on: absence of a judgement is not a bad judgement
assert!(Freshness::Stale.history() && Freshness::Invalid.history());
assert!(!Freshness::Unknown.history(), "undated is not old");
assert!(!Freshness::Fresh.history() && !Freshness::Aging.history());Variants§
Fresh
Inside session.freshness.fresh_minutes. Current; act on it.
Aging
Between the two thresholds. Still current, but its age is worth stating.
Stale
At or beyond session.freshness.stale_minutes. History, never current.
Unknown
Nothing to judge it by: no timestamp, or no thresholds declared.
Invalid
A timestamp that does not parse, or one in the future.
Implementations§
Source§impl Freshness
impl Freshness
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word this verdict is reported and serialised under, which is the shell tool’s
own vocabulary rather than a second one invented here — a reader who meets aging
from a briefing and from this executable has met one fact, not two.
use majordomus_cli::capability::builtin::continuity::Freshness;
assert_eq!(Freshness::Stale.as_str(), "stale");
// the serialised form is this word and not a second rendering of the same value
assert_eq!(
serde_json::to_value(Freshness::Aging).unwrap(),
serde_json::json!(Freshness::Aging.as_str()),
);Sourcepub fn history(self) -> bool
pub fn history(self) -> bool
Whether a record this old must be shown as history rather than as the current
instruction. unknown is not history: a record with no timestamp is not thereby old.
use majordomus_cli::capability::builtin::continuity::Freshness;
assert!(Freshness::Stale.history());
assert!(!Freshness::Unknown.history());Trait Implementations§
impl Copy for Freshness
Source§impl<'de> Deserialize<'de> for Freshness
impl<'de> Deserialize<'de> for Freshness
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 Freshness
Source§impl JsonSchema for Freshness
impl JsonSchema for Freshness
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 Freshness
impl Ord for Freshness
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 Freshness
impl PartialOrd for Freshness
impl StructuralPartialEq for Freshness
Auto Trait Implementations§
impl Freeze for Freshness
impl RefUnwindSafe for Freshness
impl Send for Freshness
impl Sync for Freshness
impl Unpin for Freshness
impl UnsafeUnpin for Freshness
impl UnwindSafe for Freshness
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.