Skip to main content

Record

Struct Record 

Source
pub struct Record {
Show 15 fields pub request_id: String, pub ts: String, pub tenant_id: String, pub model: Model, pub route: String, pub input: StreamDelta, pub output: StreamDelta, pub thinking: Option<StreamDelta>, pub cost: CostEntry, pub integrity: Integrity, pub dialect: Option<String>, pub rules_applied: Option<Vec<String>>, pub rule_fire_counts: Option<Vec<(String, u32)>>, pub quality: Option<QualityScore>, pub bytes_saved_by_rule: Option<Vec<(String, u64)>>,
}
Expand description

A single signed measurement record. Wire format frozen at v0.1.

§Changelog

  • v0.0.2: Added dialect and rules_applied as backward-compatible #[serde(default)] optional fields. Both default to None for v0.1 readers. Phase-2 Agent D’s encoder populates them.
  • v0.0.4: Added bytes_saved_by_rule as backward-compatible #[serde(default)] optional field. None for v0.0.3-and-earlier readers. Wired by Step 9 of docs/PLAN_2026-04-24.md — schema lands now so future encoder instrumentation (per-rule byte-delta callbacks) can populate without a second migration. Until then the field is always None at produce time. Consumers must handle None gracefully (treat as “no attribution available”).

Fields§

§request_id: String

ULID request identifier.

§ts: String

ISO-8601 timestamp with millisecond precision.

§tenant_id: String

Tenant id. Required for multi-tenant reporting.

§model: Model

Model the request was routed to.

§route: String

Route classification (agent-to-agent, agent-to-human, etc).

§input: StreamDelta

Input-stream measurement (baseline vs compressed).

§output: StreamDelta

Output-stream measurement.

§thinking: Option<StreamDelta>

Thinking-stream measurement (when provider exposes it).

§cost: CostEntry

Cost translation at capture time.

§integrity: Integrity

Cryptographic integrity fields.

§dialect: Option<String>

Pithy dialect family used for compression (e.g. "ultracos-symbolic-v1"). Added in v0.0.2. Populated by Phase-2 encoder; None for v0.1 records.

§rules_applied: Option<Vec<String>>

Ordered list of compression rules applied during encoding. Added in v0.0.2. Populated by Phase-2 encoder; None for v0.1 records.

§rule_fire_counts: Option<Vec<(String, u32)>>

Per-rule firing counts (alphabetical by rule name). Added in v0.0.3. Populated by EncoderTrace::as_pairs so the post-hoc analyzer can attribute savings and quality regressions to specific rules without re-running the encoder. None when the encoder did not run (Prose fallback) or the producer is on the v0.0.2 wire schema.

§quality: Option<QualityScore>

Optional shadow-arm quality measurement. Set when the proxy ran the same prompt through both the compressed and the prose arm at sample rate, so the closed-loop tuner can correlate compression with response quality. Added in v0.0.3.

§bytes_saved_by_rule: Option<Vec<(String, u64)>>

Per-rule byte-savings attribution, in UTF-8 bytes of input payload. Added in v0.0.4 as the substrate for PLAN Step 9. Aggregate delta_tokens + rule_fire_counts tells us WHICH rules fired and HOW OFTEN, but not WHICH BYTES each rule removed from the payload. Step 8+ rule-vs-rule tuning needs the latter.

Populated by the encoder once per-rule byte-delta callbacks are wired (separate follow-up commit). Until then, this field is None at produce time and consumers MUST treat None as “no attribution available”, not as “zero savings”.

Units are bytes of input before vs after the rule ran, not tokens. The bandit converts to token-equivalents against the target-model tokenizer at aggregation time, so this field stays tokenizer-agnostic and doesn’t drift when tokenizer choices change (see B8 DeepSeek-V4 addition).

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Record

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

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

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

impl<'de> Deserialize<'de> for Record

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 Record

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§

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