Skip to main content

Trace

Struct Trace 

Source
pub struct Trace {
Show 13 fields pub case_id: String, pub agent_sha: String, pub model: String, pub context_version: Option<String>, pub context_sha: String, pub question: String, pub sql_executed: Option<String>, pub result: Value, pub cost: Option<f64>, pub latency_ms: u64, pub turns: Option<u64>, pub tool_calls: Option<u64>, pub backend: Backend,
}
Expand description

One captured case result. The result is stored as the raw {columns, rows} JSON value (the same object capture embeds) so no Serialize is needed on the compare crate’s Table; it is deserialized back into a Table at re-score time.

sql_executed and tool_calls are schema slots the P4 trace shape reserves, but the single-shot claude -p --output-format json envelope does not expose either (only num_turns), so they are captured as None today. turns (from num_turns) is the delivered per-case diagnostic; full SQL / tool-call granularity would need --output-format stream-json (a later change).

Fields§

§case_id: String§agent_sha: String§model: String§context_version: Option<String>

The golden’s symbolic context_version pin (informational), e.g. driftwood@a1b2c3d.

§context_sha: String

The computed MDL SHA of the bound project — the context_sha key component.

§question: String

The question the result answers. Part of the key: if a case’s question changes under the same id, the cached result is for a different prompt and must be re-run (a miss).

§sql_executed: Option<String>

The SQL the agent executed. Not exposed by the --output-format json result envelope; None.

§result: Value

The captured {columns, rows} result object.

§cost: Option<f64>

None when the backend that produced this trace couldn’t report cost — absent is not zero.

§latency_ms: u64§turns: Option<u64>

Conversation turns (num_turns) — the round-trip count (“4–8 round-trips” per case, typically). None when the backend couldn’t report a turn count.

§tool_calls: Option<u64>

Tool-call count. Not exposed by the JSON result envelope; None (see struct docs).

§backend: Backend

Which back-end/runtime produced this trace — part of the cache key (see CaseKey::backend) so a trace from one back-end is never replayed as another’s result. #[serde(default)] so a pre-existing on-disk trace (no field at all) deserializes to Backend::default — the back-end that behavior always meant before this dimension existed.

Trait Implementations§

Source§

impl Clone for Trace

Source§

fn clone(&self) -> Trace

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 Trace

Source§

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

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

impl<'de> Deserialize<'de> for Trace

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Trace

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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.