Skip to main content

PlanTransitionInput

Struct PlanTransitionInput 

Source
pub struct PlanTransitionInput {
    pub issue: String,
    pub transition: Transition,
}
Expand description

The input of plan.transition: which issue to move, and which way.

Two fields and no third. There is no timestamp — the move is stamped with the moment it happened, never with one the caller supplies, because a lifecycle a caller can backdate is not a record of what happened. There is no force or reason field either: a transition the model refuses is refused, and the way to make it legal is to satisfy the guard rather than to ask past it.

use majordomus_cli::capability::builtin::plan::PlanTransitionInput;
use majordomus_cli::plan::Transition;

// The wire form an MCP client or an HTTP POST sends.
let input: PlanTransitionInput =
    serde_json::from_str(r#"{"issue":"I0001","transition":"done"}"#).unwrap();
assert_eq!(input.issue, "I0001");
assert_eq!(input.transition, Transition::Done);
assert_eq!(input.transition.field(), "completed_at");
assert_eq!(input.transition.event(), "plan_done");

// Unknown fields are refused rather than ignored: a caller that misspells `transition`
// is told so instead of having its move silently dropped.
assert!(serde_json::from_str::<PlanTransitionInput>(
    r#"{"issue":"I0001","transition":"done","force":true}"#).is_err());

Fields§

§issue: String

The issue to move, by its id — which is also its file name.

§transition: Transition

Which move: start, verify or done.

Trait Implementations§

Source§

impl BenchmarkCases for PlanTransitionInput

The benchmark cases of the one capability here that writes.

Every case is a refusal, and that is deliberate rather than a gap. A case is executed — by majordomus bench against this repository, and by the HTTP and MCP suites against a fixture — so a case that moved an issue would change the plan every time the suite ran, and a measurement whose cost is a changed record is not a measurement. The runner states the principle that makes this sound: “a refusal is an answer, and answering is the work a benchmark exists to measure”, and only Internal is fatal.

The refusal path is also the honest thing to time: it builds the plan, resolves the issue and evaluates the guard, which is everything the write path does except the two syscalls at the end.

The refusal must be a refusal and not a lookup miss. An earlier version named an issue that could not exist, which answered 404 rather than 422, and tests/http_serve.rs holds every route to answering its own cases — 200, or 422 for a command that turns a caller down. Choosing the move from the record keeps the case inside that contract.

So a plan with no issue yields no case, and the handler is not bent to make one: naming an issue the plan does not have is NotFound whether or not the plan holds other issues, and a 422 that appeared only when the plan is empty would make the same request’s answer depend on records it never named. The descriptor declares the requirement conditional on BenchmarkPrecondition::PlanHoldsAnIssue instead, and coverage reports it inapplicable in such a repository — and missing, as before, in one whose plan holds an issue.

Source§

fn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>

The cases, in a stable order. An empty list means “nothing to benchmark in this repository”, which the coverage check reports as missing.
Source§

fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>

The cases as JSON, the shape every runner serialises from.
Source§

impl Debug for PlanTransitionInput

Source§

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

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

impl<'de> Deserialize<'de> for PlanTransitionInput

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 JsonSchema for PlanTransitionInput

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 Serialize for PlanTransitionInput

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

Auto Trait Implementations§

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
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, 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