Skip to main content

AttributedApprovalResponse

Struct AttributedApprovalResponse 

#[non_exhaustive]
pub struct AttributedApprovalResponse { pub response: ChannelApprovalResponse, pub decided_by: Option<String>, pub source: ApprovalSource, }
Expand description

An approval response together with the back-channel that produced it.

When a channel fans one approval request out to several back-channels, decided_by names the back-channel that actually answered, so the audit trail attributes the decision to the deciding surface. The attribution travels with the returned decision, so concurrent approvals on the same channel instance cannot cross-wire it. Single channels leave it None.

#[non_exhaustive] so a future provenance field is an additive change rather than another source break. Out-of-tree code must construct this value through the dedicated constructors on this type — #[non_exhaustive] forbids struct-literal construction from another crate, so the ..Default::default() wildcard is not a workaround. The constructors (operator, from_runtime, with_decider, with_decider_opt) below are the public contract.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§response: ChannelApprovalResponse§decided_by: Option<String>§source: ApprovalSource

WHO produced this response — an operator, or the runtime failing closed.

This cannot be inferred from the other two fields, which is why it is carried explicitly:

  • Option::is_none() on the whole response does not work, because a fail-closed route returns Some(Deny) with no decider.
  • decided_by.is_none() does not work either, because a single (non-fan-out) channel leaves it None for a genuine operator answer.

Conflating the two produced a tool result that told the model “Denied by user.” on runs where no human was ever asked.

Implementations§

Source§

impl AttributedApprovalResponse

Source

pub fn operator(response: ChannelApprovalResponse) -> Self

An operator answered through a channel.

Use this at the boundary that actually observed a person’s answer. A synthesized deny (drop, timeout, unreachable approver) must use AttributedApprovalResponse::from_runtime instead — that distinction is the whole point of carrying ApprovalSource.

Source

pub fn from_runtime( response: ChannelApprovalResponse, source: ApprovalSource, ) -> Self

The runtime produced this outcome itself; no operator decided.

Source

pub fn with_decider(self, decider: impl Into<String>) -> Self

Name the back-channel that produced this decision (fan-out attribution).

Deliberately not called decided_by: that is the field’s name, and a same-named method reads as a getter at the call site.

Source

pub fn with_decider_opt(self, decider: Option<String>) -> Self

Same as with_decider but accepts the fan-out shape where the decider is known to be an Option<String>. Some names the back-channel; None leaves decided_by unset. Callers that already carry Option<String> from a routed decision reach for this rather than a match that rebuilds the value.

Trait Implementations§

Source§

impl Clone for AttributedApprovalResponse

Source§

fn clone(&self) -> AttributedApprovalResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AttributedApprovalResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AttributedApprovalResponse

Source§

impl PartialEq for AttributedApprovalResponse

Source§

fn eq(&self, other: &AttributedApprovalResponse) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · §

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AttributedApprovalResponse

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.