pub enum Decision {
Allow,
Deny(String),
Modify(MemoryDelta),
Ask(String),
}Expand description
The four-shape outcome of Permissions::evaluate. Mirrors the
G4 HookDecision vocabulary so callers wire one decision type
into all five op paths regardless of which source produced the
outcome.
Modify carries a MemoryDelta — the same payload type the
hook chain composes. Rules in K9 cannot return Modify (only
Allow / Deny / Ask); only hook chains can.
Ask carries the prompt text that should be surfaced to the
operator (or queued in the K10 approval pipeline). The runtime
promotion of Ask under PermissionsMode::Enforce turns this
into Deny so callers don’t accidentally approve under strict
mode.
§Disambiguation (issue #970)
The codebase has five enums named Decision. They model
different domain outputs and are NOT substitutable:
Decision(this enum) — K9 four-shape pipeline output (rules + hooks + mode promotion combined).RuleDecision— narrower three-shape TOML rule-row decision (noModify; rules can’t rewrite a payload).crate::governance::agent_action::Decision— three-shape external-action engine output (Allow/Refuse{rule_id, reason}/Warn{rule_id, reason}); narrower again, with a structured refusal payload instead of a string.crate::models::GovernanceDecision— three-shape substrate governance output (Allow/Deny(GovernanceRefusal)/Pending(String)); carries a typed refusal envelope.crate::approvals::Decision— two-shape operator submission verdict (Approve/Deny) for the K10 transports.
Each enum’s variant set is locked to its column / wire contract;
see docs/internal/enum-proliferation-audit-970.md.
Variants§
Allow
Allow the operation to proceed unchanged.
Deny(String)
Deny the operation. reason surfaces in the API response and
the audit log.
Modify(MemoryDelta)
Allow the operation but apply delta first. Only produced by
hook chains in K9; rules cannot return Modify.
Ask(String)
Pause and prompt the operator. Mode default decides what to do with this if no caller is wired into the K10 approval API (Enforce → Deny, Advisory/Off → Allow).
Trait Implementations§
impl StructuralPartialEq for Decision
Auto Trait Implementations§
impl Freeze for Decision
impl RefUnwindSafe for Decision
impl Send for Decision
impl Sync for Decision
impl Unpin for Decision
impl UnsafeUnpin for Decision
impl UnwindSafe for Decision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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