Skip to main content

meerkat_machine_schema/
seam.rs

1//! Schema-owned seam classification for effect dispositions.
2//!
3//! Every effect disposition declares how its ownership boundary behaves. This
4//! classification lives with the effect on the catalog DSL (the `seam` clause of
5//! a `disposition` declaration) and is emitted onto the generated
6//! [`EffectDispositionRule`](crate::EffectDispositionRule), so the seam-inventory
7//! audit reads the classification straight off the schema instead of a
8//! hand-maintained side table.
9
10use std::fmt;
11
12/// Classification of an effect's ownership boundary characteristics.
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum SeamClassification {
15    /// Effect is fully internal to the machine — no owner realization needed.
16    /// Examples: state projection, local bookkeeping.
17    NoOwnerRealization,
18    /// Effect requires owner/shell to realize it, but no feedback is expected.
19    /// The machine emits and moves on; correctness does not depend on acknowledgment.
20    OwnerRealizationOnly,
21    /// Effect requires owner realization AND the owner must feed back into the
22    /// machine (or another composed machine) for the lifecycle to close.
23    /// This is the seam that needs a formal handoff protocol.
24    OwnerRealizationPlusFeedback,
25    /// Effect is a terminal/result signal whose surface representation must align
26    /// with machine truth. Divergence here means the API lies about outcomes.
27    SurfaceResultAlignment,
28}
29
30impl fmt::Display for SeamClassification {
31    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32        match self {
33            Self::NoOwnerRealization => write!(f, "no-owner-realization"),
34            Self::OwnerRealizationOnly => write!(f, "owner-realization-only"),
35            Self::OwnerRealizationPlusFeedback => write!(f, "owner-realization-plus-feedback"),
36            Self::SurfaceResultAlignment => write!(f, "surface-result-alignment"),
37        }
38    }
39}