pub struct SessionPolicy {
pub freshness: FreshnessPolicy,
pub ensure_server_on_start: bool,
pub knowledge_on_end: bool,
pub knowledge_on_compact: bool,
pub brief_interval_minutes: Option<u64>,
pub edits_require_claim: bool,
pub stranded_after: Option<String>,
}Expand description
session: — what the episode boundary does beyond drawing itself.
Only the half two entry paths both read is typed here. The rest of the block is carried through unread, as every other key is: the policy schema owns the full shape.
use majordomus_cli::policy::SessionPolicy;
// A policy that says nothing about it still converges. The default is what this
// repository's policy and the skeleton a new one is written from both declare, and a
// policy that could not be read must not silently change behaviour.
assert!(SessionPolicy::default().ensure_server_on_start);
assert!(SessionPolicy::default().knowledge_on_end);
assert!(SessionPolicy::default().knowledge_on_compact);
// and a repository that has turned one off is read as having turned it off
let off: SessionPolicy =
serde_json::from_str(r#"{"ensure_server_on_start": false, "knowledge_on_end": false}"#)
.expect("a session block");
assert!(!off.ensure_server_on_start);
assert!(!off.knowledge_on_end);
assert!(off.knowledge_on_compact, "the two switches are independent");Fields§
§freshness: FreshnessPolicysession.freshness: — how old a continuation record may be before it stops being
current. A separate question from divergence, which is about git topology and says
nothing about age.
ensure_server_on_start: boolWhether entering the repository converges on a ready shared server.
One switch, both entry paths: the provider’s start event (ADR 0035) and the file a
shell evaluates on entry (ADR 0043). It defaults to true because that is what
this repository’s policy and the skeleton a new one is written from both declare,
and because a policy that could not be read must not silently change behaviour —
an unreadable policy is doctor’s finding, not a reason to stop converging.
knowledge_on_end: boolWhether closing an episode derives the knowledge it produced into candidate records
under the tracked knowledge section (ADR 0091). Read here so that
knowledge_base.status judges a silent writer only where the writer is switched on,
and defaults to true for the reason ensure_server_on_start does: the policy and
the skeleton both declare it, and an unreadable policy must not change behaviour.
knowledge_on_compact: boolWhether a provider’s compaction event derives the same records. Independent of
checkpoint_on_compact: the two record different things.
brief_interval_minutes: Option<u64>session.brief_interval_minutes: — how often a session reports on itself without
being asked (ADR 0136). Absent is the default brief.session carries; the provider
mod reads the interval from that answer rather than from this file.
edits_require_claim: boolsession.edits_require_claim: — whether a provider’s tool may write a file of the
checkout only while a claim covers it: the active task’s scope, or a live mesh claim
of the writing session (I2735, crate::guard). Off unless a repository turns it
on, because it refuses edits, and a repository that never asked for that must not
find its workers stopped by an upgrade.
stranded_after: Option<String>session.stranded_after: — how long an open episode may be silent before its client
is taken to be gone (90s, 30m, 12h). majordomus recover reads it to judge an
episode stranded, and worktree.uncommitted reads the same value twice over: an
episode silent this long holds no work, and uncommitted work untouched this long
that nothing holds is abandoned. Absent is absent: no reader carries a default of
its own, because a second copy of the number is the drift the policy exists to stop.
use majordomus_cli::policy::SessionPolicy;
let declared: SessionPolicy =
serde_json::from_str(r#"{"stranded_after": "12h"}"#).expect("a session block");
assert_eq!(declared.stranded_after.as_deref(), Some("12h"));
assert_eq!(SessionPolicy::default().stranded_after, None, "absent is not a default");
// a bare number is seconds, as the shell reader takes it, and never a parse failure
// that would take the rest of the policy down with it
let bare: SessionPolicy =
serde_json::from_str(r#"{"stranded_after": 3600}"#).expect("a session block");
assert_eq!(bare.stranded_after.as_deref(), Some("3600"));Trait Implementations§
Source§impl Clone for SessionPolicy
impl Clone for SessionPolicy
Source§fn clone(&self) -> SessionPolicy
fn clone(&self) -> SessionPolicy
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 SessionPolicy
impl Debug for SessionPolicy
Source§impl Default for SessionPolicy
impl Default for SessionPolicy
Source§impl<'de> Deserialize<'de> for SessionPolicy
impl<'de> Deserialize<'de> for SessionPolicy
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 SessionPolicy
Source§impl PartialEq for SessionPolicy
impl PartialEq for SessionPolicy
Source§fn eq(&self, other: &SessionPolicy) -> bool
fn eq(&self, other: &SessionPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SessionPolicy
Auto Trait Implementations§
impl Freeze for SessionPolicy
impl RefUnwindSafe for SessionPolicy
impl Send for SessionPolicy
impl Sync for SessionPolicy
impl Unpin for SessionPolicy
impl UnsafeUnpin for SessionPolicy
impl UnwindSafe for SessionPolicy
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.