Expand description
shigoto-types — typed primitives every other shigoto crate consumes.
Spec: theory/SHIGOTO.md §III.1–III.4 + §III.11–III.12.
v0.1.0 is the scaffold: trait + enum + struct surfaces declared,
implementations land as the bootstrap consumer (tend) migrates
per theory/SHIGOTO.md §IV.3 (M0.9 in the broader plan).
Re-exports§
pub use failure::Failure;pub use failure::FailureKind;pub use failure::classify;pub use failure::signature;pub use sink::AuditFileSink;pub use sink::InMemorySink;pub use sink::MultiSink;pub use sink::NullSink;pub use sink::Sink;pub use chain::Chain;pub use classify::ChainedClassifier;pub use classify::Classifier;pub use classify::FailureClassifier;pub use classify::FnClassifier;pub use watch::EscalationRouting;pub use watch::ScheduleWindow;pub use watch::TimeoutWatcher;pub use watch::WatchAction;pub use watch::WatchRule;pub use policy::CascadePolicy;pub use decision::Decision;pub use converge::Action;pub use converge::AppliedChange;pub use converge::ApplyMetrics;pub use converge::Change;pub use converge::ChangeSeverity;pub use converge::FailedChange;pub use converge::NoMetrics;pub use converge::Outcome;pub use converge::Plan;pub use converge::PlanId;pub use converge::Reconciler;pub use converge::ReconcilerError;pub use converge::build_outcome;pub use converge::change;pub use converge::change_with_severity;
Modules§
- chain
Chain<I, O>— first-match-wins composition over typed rules.- classify
- Typed input classification — the canonical
Classifier<I, O>trait every fleet-wide raw-input-to-typed-event pipeline consumes. Spec:theory/CONVERGENCE-ADOPTION.md§II.5, Phase 0.2. - converge
converge— the universal state-convergence trait + typed Plan/Outcome border.- decision
- Typed pure action-decision — the canonical
Decisiontrait every fleet-wide “decide a controller action from a structured context” rule consumes. Spec:theory/CONVERGENCE-ADOPTION.md§II.3. - failure
- Typed failure classification — the META primitive every long-running pleme-io reconciler consumes.
- policy
- Typed policy cascade — the canonical
CascadePolicytrait every fleet-wide multi-layer-override system consumes. Spec:theory/CONVERGENCE-ADOPTION.md§II.2. - sink
- Typed event sink — the canonical
Sink<T>trait every fleet-wide event recorder consumes. Spec:theory/CONVERGENCE-ADOPTION.md§II.1, Phase 0.1. - testing
- Test-helpers for typed-primitive authors.
- watch
- Typed stuck-state escalation — the canonical
TimeoutWatcher<S>primitive every fleet-wide FSM-timeout watchdog consumes. Spec:theory/CONVERGENCE-ADOPTION.md§II.4, Phase 0.3.
Structs§
- Illegal
Transition - Rejected transition —
(from, signal)is not a legal FSM cell. Returning Result instead of panicking lets consumers report drift (an operator action attempting an illegal transition) without crashing the scheduler. - JobId
- Typed identity for a Job. Stable across cycles + scheduler restarts.
- JobKind
Id - Typed work-class identifier. Stored as
String(not&'static str) so it serializes through serde without lifetime constraints. CheapCloneis fine for the volume we expect (≤ ~100 kinds across the whole scheduler). - Snapshot
- Read-only snapshot of the scheduler’s current FSM map.
- Tick
Receipt - Derived per-tick rollup the scheduler emits on every
tick. - Transition
Event - Unhealed
Drift
Enums§
- Gate
Aggregate - Aggregate gate outcome — what the cohort of gates collectively said. Per §III.9 individual gates return Pass / Wait / Skip; the aggregate is the worst outcome (Skip > Wait > Pass) per a typed reducer in shigoto-gate. We carry the rolled-up result here so the FSM stays language-agnostic about how the rollup is computed.
- JobPhase
- FSM phase a Job inhabits. See
theory/SHIGOTO.md§III.3 for the transition table. - JobScope
- JobSubject
- Retry
Outcome - Retry decision from a
RetryPolicy::decide()call. Same shape that shigoto-retry’sRetryDecisionexposes — duplicated as a typed signal payload so the FSM stays in shigoto-types without a dependency on shigoto-retry. - Signal
- FSM driver — every legal way a Job’s phase can change. Exhaustive
over the
(JobPhase, Signal)cross-product pertheory/SHIGOTO.md§IV.1; theadvancetable below enumerates every cell. - Skip
Reason - Transition
Reason
Traits§
- Erased
Job - Trait-object dispatch surface. The scheduler holds
Box<dyn ErasedJob>(Jobitself isn’t object-safe because of the associated types);ErasedJobcollapses the typed Output + Error to()+ boxed error so the scheduler can store heterogeneous jobs in one DAG. - Job
- The typed Job trait — what every consumer’s domain-specific job
implements. Per
theory/SHIGOTO.md§III.1. - JobError
- JobInput
- Inputs / Outputs / Errors implement these marker traits so the scheduler can serialize across boundaries when persistence lands.
- JobOutput
- Output
Sink - Typed receiver for
Job::Outputvalues. Jobs callrecordon a successfulexecuteso consumers (reconcile receipts, audit trails, dashboards) can read the typed outcomes the scheduler’s phase-tracking discards. - Recording
Job - Convenience trait that captures the most common Job authoring
shape across pleme-io consumers: a Job whose typed Output flows
through an
OutputSinkfor consumer-side capture, and whose identity decomposes into (scope, kind, subject).
Functions§
- advance
- The canonical FSM driver. Pure: same
(from, signal)always produces the same result. Exhaustive overJobPhase × Signal— adding a new phase or signal fails to compile until every cell of the cross-product is decided.