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: StringThe computed MDL SHA of the bound project — the context_sha key component.
question: StringThe 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: ValueThe 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: BackendWhich 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.