Skip to main content

Tier

Enum Tier 

Source
pub enum Tier {
    Task,
    Governance,
    Source,
    Decision,
    Knowledge,
    History,
}
Expand description

Where an entry sits in the order the budget spends in.

The order is this repository’s own: lib/context.sh assembles its sections “in authority order, highest first, because a worker that runs out of budget must lose the least reliable evidence rather than the most: git, then the task and its policy, then blockers, then authored records, then event history.” These six tiers are that sentence, applied to objects instead of to sections.

The derived Ord is load-bearing: the variants are declared in authority order, so < means “spent before” and “harder to drop”, and the budget’s ordering is a plain sort rather than a table mapping tiers to ranks. A variant added in the wrong place would silently re-rank the whole answer, which is why the declaration order is the one thing about this enum to be careful with.

use majordomus_cli::devcontext::Tier;

// the declaration order *is* the order the budget spends in
let mut sorted = Tier::ORDER.to_vec();
sorted.sort();
assert_eq!(sorted, Tier::ORDER.to_vec());

// so the strongest authority is the smallest, and it is the one never dropped
assert_eq!(Tier::ORDER.iter().copied().min(), Some(Tier::Task));
assert!(Tier::Task < Tier::Governance && Tier::Governance < Tier::History);

// and the serialised word is the lowercase one the report is read under
assert_eq!(
    serde_json::to_value(Tier::Governance).unwrap(),
    serde_json::json!(Tier::Governance.as_str()),
);

Variants§

§

Task

What was asked for: the issue, its milestone, the paths named, the intent. Never dropped — a context that lost the thing it was compiled about is not a smaller answer, it is the wrong one.

§

Governance

What the work will be judged against: the policy, the scope, the directory contracts that reach the named paths, and the rules. A blocking rule is never dropped.

§

Source

The code and the cases the work touches.

§

Decision

The architectural decisions already in force over it.

§

Knowledge

What a previous session left: handovers, session records, curated knowledge.

§

History

Supporting evidence: use cases, claims, features, and the rest of the layer.

Implementations§

Source§

impl Tier

Source

pub const ORDER: &'static [Tier]

Every tier, in the order the budget spends in.

use majordomus_cli::devcontext::Tier;
assert_eq!(Tier::ORDER.len(), 6);
assert_eq!(Tier::ORDER[0], Tier::Task);
Source

pub fn as_str(self) -> &'static str

The word this tier is reported under.

use majordomus_cli::devcontext::Tier;
assert_eq!(Tier::Governance.as_str(), "governance");
Source

pub fn meaning(self) -> &'static str

What this tier is for, in one line, so that a reader of the answer never has to find this file.

This is carried into the answer — TierSpend::meaning is this string — rather than left for a consumer to look up, because the per-tier spend is read by people who are deciding what to raise the budget for and “knowledge: 4 excluded” is not actionable without knowing what the tier holds.

use majordomus_cli::devcontext::Tier;

// it explains the tier rather than naming it, so it is never just the word again
for t in Tier::ORDER {
    assert!(t.meaning().len() > t.as_str().len(), "{} restates itself", t.as_str());
}

// and it says what is actually in there
assert!(Tier::Governance.meaning().contains("policy"));
assert!(Tier::Decision.meaning().contains("architectural decisions"));

Trait Implementations§

Source§

impl Clone for Tier

Source§

fn clone(&self) -> Tier

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Tier

Source§

impl Debug for Tier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Tier

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Tier

Source§

impl JsonSchema for Tier

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Ord for Tier

Source§

fn cmp(&self, other: &Tier) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Tier

Source§

fn eq(&self, other: &Tier) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Tier

Source§

fn partial_cmp(&self, other: &Tier) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Tier

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Tier

Auto Trait Implementations§

§

impl Freeze for Tier

§

impl RefUnwindSafe for Tier

§

impl Send for Tier

§

impl Sync for Tier

§

impl Unpin for Tier

§

impl UnsafeUnpin for Tier

§

impl UnwindSafe for Tier

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsOut<T> for T
where T: Copy,

§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more