Skip to main content

SandboxEvent

Struct SandboxEvent 

Source
pub struct SandboxEvent {
    pub run_id: i64,
    pub step: u32,
    pub kind: String,
    pub backend: Option<String>,
    pub detail: Option<String>,
}
Expand description

One event in the life of a sandboxed execution: the sandbox created for a run, a command run in it (with the backend that isolated it), a resource cap that killed it, a denied network attempt, or the sandbox torn down.

Together these let an operator audit not just what code ran but where and how it was isolated, reconstructable from the store alone after the run.

use io_harness::{SandboxEvent, Store};

let events = store.sandbox_events(run_id)?;

// Which backend actually isolated the run. The crate picks a native one per
// platform and falls back to a portable floor, so "was this really contained"
// is a question about this field and not about the configuration.
let backend = events.iter().find_map(|e| e.backend.as_deref());
assert_eq!(backend, Some("macos-sandbox-exec"));

// And the phase to look for when a run that used to pass stops passing:
// `criterion-compile` means the criterion no longer compiles *against* the
// subject, which before 0.8.1 could be reported as a pass.
let phases: Vec<&str> = events
    .iter()
    .filter(|e| e.kind == "gate_phase_failed")
    .filter_map(|e| e.detail.as_deref())
    .collect();
assert_eq!(phases, ["criterion-compile"]);

Fields§

§run_id: i64

The run this execution belongs to.

§step: u32

The step it occurred on.

§kind: String

"create", "exec", "cap_hit", "destroy", "gate_phase_failed" (whose detail names the phase), or "gate_output" (whose detail is what a failing gate command printed).

A "net_deny" kind was documented here from 0.6.0 to 0.11.0 and never existed: nothing constructed it and nothing emitted it. It was removed in 0.12.0 rather than implemented, because a sandbox denies egress structurally — the backend gives the child no route out, so there is no attempt to observe and nothing to count. Network decisions the harness actually makes are in policy_events with act = "net".

§backend: Option<String>

The backend that isolated the run (e.g. "macos-sandbox-exec").

§detail: Option<String>

The argv for an "exec", the breached cap for a "cap_hit", or the bounded output of a failing gate command for a "gate_output". Never the agent’s file contents and never credentials — the command line, or what the caller’s own criterion printed.

Implementations§

Source§

impl SandboxEvent

Source

pub fn create(run_id: i64, step: u32, backend: &str) -> Self

A sandbox was created for a run, isolated by backend.

Source

pub fn exec(run_id: i64, step: u32, backend: &str, argv: &str) -> Self

A command ran in the sandbox under backend.

Source

pub fn cap_hit(run_id: i64, step: u32, cap: &str) -> Self

A resource cap killed the run.

Source

pub fn destroy(run_id: i64, step: u32) -> Self

The sandbox was torn down (workdir removed, processes reaped).

Source

pub fn gate_phase_failed(run_id: i64, step: u32, phase: &str) -> Self

Which phase of an execution gate failed: "subject-compile" (the file under verification does not compile), "criterion-compile" (the criterion does not compile against it), "test-run" (it compiled and the test failed), or "subject-emptied" (the file compiled but a crate-level attribute stripped its items, so nothing was type-checked — the compile-only gates).

0.8.1 added this because the release deliberately makes some previously passing runs fail. criterion-compile is the one to look for: before 0.8.1 the subject and the criterion were one crate, so a subject could shadow the names the criterion used — or delete it outright — and be reported as passing. An operator whose run stopped passing on upgrade can tell that case from an ordinary failed criterion without reading the harness’s source.

A new kind value, not a new table or column: a 0.8.0 store takes it with no migration.

Source

pub fn gate_output(run_id: i64, step: u32, output: &str) -> Self

What a failing gate command printed, already bounded by the caller (0.17.0).

Verification::Command can run any command in any language, so “the criterion did not pass” stops being a self-explaining outcome: cargo test failing because the agent’s change is wrong and npm test failing because the machine has no node_modules are the same discriminant and need opposite responses. The command’s own output is the only thing that tells them apart.

This is the one detail that is not a command line. It is a gate command’s output — a caller-supplied criterion, never the agent’s file contents — and it is what makes a language-agnostic gate diagnosable at all. Bounded by the caller before it arrives here.

use io_harness::{SandboxEvent, Store};

let store = Store::memory()?;
let run_id = store.start_run("make the suite pass", "/repo")?;
store.record_sandbox_event(&SandboxEvent::gate_output(
    run_id, 3, "FAIL test/parse.test.js\n  expected 2 received 1",
))?;

let why = store.sandbox_events(run_id)?;
assert!(why.iter().any(|e| e.kind == "gate_output"
    && e.detail.as_deref().is_some_and(|d| d.contains("expected 2"))));

A new kind value, not a new table or column: a 0.6.0 store takes it with no migration.

Trait Implementations§

Source§

impl Clone for SandboxEvent

Source§

fn clone(&self) -> SandboxEvent

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SandboxEvent

Source§

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

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

impl Eq for SandboxEvent

Source§

impl PartialEq for SandboxEvent

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SandboxEvent

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more