pub struct ReductionPlan {Show 13 fields
pub turn_id: TurnId,
pub acts: Vec<PlannedAct>,
pub batches: Vec<CommandBatch<Value>>,
pub policy_decisions: Vec<PolicyDecision>,
pub answer_tasks: Vec<AnswerTask>,
pub constraints_applied: Vec<ConstraintKind>,
pub notices: Vec<ServerNotice>,
pub pre_execution_interactions: Vec<InteractionSpec>,
pub plan_hash: Digest,
pub superseded_operations: Vec<OperationKey>,
pub refusals: Vec<NarratableFact>,
pub changed_nothing: Vec<NarratableFact>,
pub awaiting_confirmation: Vec<NarratableFact>,
}Expand description
The reducer’s output (spec §13).
Fields§
§turn_id: TurnIdThe turn.
acts: Vec<PlannedAct>One entry per input act, by index (I11).
batches: Vec<CommandBatch<Value>>Command batches ready for execution, grouped by atomicity scope. Commands are erased to JSON; the registry converts them at the boundary.
policy_decisions: Vec<PolicyDecision>Policy decisions for every command.
answer_tasks: Vec<AnswerTask>Questions to answer.
constraints_applied: Vec<ConstraintKind>Constraints that were applied.
notices: Vec<ServerNotice>Notices to show (e.g. “Nothing has been submitted”).
pre_execution_interactions: Vec<InteractionSpec>Interactions to persist before any command executes (clarifications
and confirmations). Deduplicated by InteractionSpec::key.
plan_hash: DigestDigest of everything above (see Self::compute_hash).
superseded_operations: Vec<OperationKey>Operations of acts a correction or a cancel in the same message replaced.
Supersession is the one reduction rule that makes a turn do less than its plan said, and until it was counted a message carrying four data that produced one command was only discoverable by reading the conversation that followed. One entry per dropped act, in plan order.
refusals: Vec<NarratableFact>Domain refusals, as facts the narration stage may rest on.
The notice beside them tells the user deterministically; these tell the narrator, so its prose does not ask for something else as though the refusal had not happened.
changed_nothing: Vec<NarratableFact>Acts that were accepted and changed nothing, as facts the narration stage may rest on.
Beside Self::refusals and not inside it, because the two are
different outcomes and one of them is counted: the runtime raises its
refusal signal once per entry there, and a no-op filed among them would
be a refusal in every dashboard that reads it. They travel together only
at the point where both become facts for the writer.
awaiting_confirmation: Vec<NarratableFact>Acts this turn prepared and held behind a confirmation card, as facts the narration stage may rest on.
Separate from Self::refusals and not folded into it, because these
are not refusals: that list is counted as
Signal::ActRefused, and an act
waiting for a click is one the server intends to run. See
NarratableFact::ActAwaitingConfirmation.
Implementations§
Source§impl ReductionPlan
impl ReductionPlan
Sourcepub fn compute_hash(&self) -> Result<Digest, HashError>
pub fn compute_hash(&self) -> Result<Digest, HashError>
Computes the digest of every field except plan_hash.
Sourcepub fn with_hash(self) -> Result<ReductionPlan, HashError>
pub fn with_hash(self) -> Result<ReductionPlan, HashError>
Sets plan_hash from the current content.
Sourcepub fn verify_hash(&self) -> Result<bool, HashError>
pub fn verify_hash(&self) -> Result<bool, HashError>
Returns true when plan_hash matches the content.
Sourcepub fn validate(&self, understood: &[ActId]) -> Result<(), ReductionError>
pub fn validate(&self, understood: &[ActId]) -> Result<(), ReductionError>
Structural consistency checks.
Everything here is a property a correct reducer already has; the point is that a plan which fails one of them must never reach execution, so a reducer bug becomes a refused turn instead of an unauthorized command:
- every act of the understanding appears exactly once (I11);
- every
ReadyToExecutecommand reference points at a batch command; - a
ReadyToExecuteact resolved its target exactly, unless it starts a workflow or picks a target (spec §12.2, I8), and its commands run on the case it resolved to; - every batched command has exactly one
PolicyDecision, that decision allows it, and its origin satisfies the policy the decision recorded (origin_satisfies, I9, I12); - no refused decision names a command that is nevertheless batched;
- every spec embedded in an act result is listed in
pre_execution_interactions(by key); PerCasebatches target a single case.
Sourcepub fn command_refs(&self) -> Vec<CommandRef>
pub fn command_refs(&self) -> Vec<CommandRef>
All command references in batch order.
Sourcepub fn has_no_effects(&self) -> bool
pub fn has_no_effects(&self) -> bool
Returns true when nothing will execute this turn.
Trait Implementations§
Source§impl Clone for ReductionPlan
impl Clone for ReductionPlan
Source§fn clone(&self) -> ReductionPlan
fn clone(&self) -> ReductionPlan
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 ReductionPlan
impl Debug for ReductionPlan
Source§impl<'de> Deserialize<'de> for ReductionPlan
impl<'de> Deserialize<'de> for ReductionPlan
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReductionPlan, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReductionPlan, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ReductionPlan
Source§impl PartialEq for ReductionPlan
impl PartialEq for ReductionPlan
Source§impl Serialize for ReductionPlan
impl Serialize for ReductionPlan
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ReductionPlan
Auto Trait Implementations§
impl Freeze for ReductionPlan
impl RefUnwindSafe for ReductionPlan
impl Send for ReductionPlan
impl Sync for ReductionPlan
impl Unpin for ReductionPlan
impl UnsafeUnpin for ReductionPlan
impl UnwindSafe for ReductionPlan
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more