pub struct DeferredAuditEvent {
pub agent_id: String,
pub action: AgentAction,
pub decision: Decision,
pub timestamp: DateTime<Utc>,
}Expand description
One refusal captured by the storage hook, awaiting flush to the
signed_events chain.
All fields are owned (no borrows) so the event can cross the mpsc
channel boundary without lifetime gymnastics. payload_bytes is
the canonical-JSON encoding of {action, decision} — the same
shape the audited path commits to via
agent_action::emit_check_event. The drainer hashes this on the
way to signed_events.payload_hash.
Fields§
§agent_id: StringAgent identity at the moment of refusal (resolved from request
or process context). Lands in signed_events.agent_id.
action: AgentActionThe action that was refused. Cloned from the hook input.
decision: DecisionThe verdict — must be a Refuse variant; non-refusal events
do not enter the queue (the submit helpers gate on
Decision::is_refusal).
timestamp: DateTime<Utc>Wall-clock timestamp of refusal. Lands in
signed_events.timestamp as RFC3339.
Implementations§
Source§impl DeferredAuditEvent
impl DeferredAuditEvent
Sourcepub fn from_refusal(
agent_id: &str,
action: &AgentAction,
decision: &Decision,
) -> Option<Self>
pub fn from_refusal( agent_id: &str, action: &AgentAction, decision: &Decision, ) -> Option<Self>
Build a deferred event from the hook’s three inputs. Returns
None when decision is not a refusal — callers should
only submit refusals to the queue (Allow / Warn paths do not
chain-log a refusal row).
Sourcepub fn rule_id(&self) -> Option<&str>
pub fn rule_id(&self) -> Option<&str>
Extract the rule_id from the refusal verdict. Used by the drainer to surface the firing rule in the audit row’s canonical payload.
Sourcepub fn reason(&self) -> Option<&str>
pub fn reason(&self) -> Option<&str>
Extract the refusal reason from the verdict (verbatim operator-authored string).
Sourcepub fn canonical_bytes(&self) -> Result<Vec<u8>>
pub fn canonical_bytes(&self) -> Result<Vec<u8>>
Canonical JSON shape the drainer hashes for
signed_events.payload_hash. Stable across versions: a
flat object with action, decision, agent_id,
timestamp keys — same outline as
agent_action::emit_check_event plus the agent + timestamp.
§Errors
Returns an error only if serde_json cannot serialize the
action variant (in practice never happens for the canonical
AgentAction shapes).
Trait Implementations§
Source§impl Clone for DeferredAuditEvent
impl Clone for DeferredAuditEvent
Source§fn clone(&self) -> DeferredAuditEvent
fn clone(&self) -> DeferredAuditEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DeferredAuditEvent
impl RefUnwindSafe for DeferredAuditEvent
impl Send for DeferredAuditEvent
impl Sync for DeferredAuditEvent
impl Unpin for DeferredAuditEvent
impl UnsafeUnpin for DeferredAuditEvent
impl UnwindSafe for DeferredAuditEvent
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