pub struct DeterminismGuard { /* private fields */ }Expand description
Verifies transformations under one proxy trace id.
Implementations§
Source§impl DeterminismGuard
impl DeterminismGuard
pub fn new(request_id: impl Into<String>) -> Self
Sourcepub fn verify(&self, before: &[Value], after: &[Value]) -> DeterminismProof
pub fn verify(&self, before: &[Value], after: &[Value]) -> DeterminismProof
Produces a proof for the supplied request id.
Sourcepub fn verify_forwarded(
&self,
before: &[Value],
after: &[Value],
sent: Option<&SentPrefix>,
) -> DeterminismProof
pub fn verify_forwarded( &self, before: &[Value], after: &[Value], sent: Option<&SentPrefix>, ) -> DeterminismProof
Verifies after against what the proxy already forwarded for this
conversation (sent, from prefix_replay::sent_prefix).
The provider cached the bytes the proxy sent, not the client’s: the protected prefix is the run of leading messages the client sent unchanged since the last forward, and each of them must leave exactly as it left then. A message forwarded for the first time — the newest tool result — is new content and may be rewritten; a content- deterministic rewrite then leaves the same bytes on every later turn. Where the client changed or dropped a message (a rewind, another conversation with the same opening) the protected prefix ends there.
Assumption: a conversation the proxy has not forwarded (sent is
None: its first turn, or the first after a proxy restart) holds no
provider cache made through this proxy, so nothing is protected. Once
a forwarded prefix is known, a differing byte in it fails closed —
except where it first differs at a message long-session elision
rewrote this turn (session_elide, once per stride).
frozen_bytes counts the canonical bytes of the protected messages
that leave unchanged; modification_start_byte is where after first
differs from before. The prefix hashes cover the per-message hashes
of the protected prefix as forwarded then and as forwarded now.
Trait Implementations§
Source§impl Clone for DeterminismGuard
impl Clone for DeterminismGuard
Auto Trait Implementations§
impl Freeze for DeterminismGuard
impl RefUnwindSafe for DeterminismGuard
impl Send for DeterminismGuard
impl Sync for DeterminismGuard
impl Unpin for DeterminismGuard
impl UnsafeUnpin for DeterminismGuard
impl UnwindSafe for DeterminismGuard
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,
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