README Source History Refs Reviews Compare Notes Search Review guide refactor(core): compress pass over session arena
6290472ae62ea581ac7a4291dd9f33e40f9d1d6c
Oliver Jan Krylow <oliver@bugabinga.net > · 26 Sep 2026
unsigned
Browse files Compare with HEAD
Changed files (2) Diff layout Auto Unified Split
smith-core/src/frame.rs Modified +3 / −3 text lines
98 98 Self ::Known { entry } => encode_frame ( Self ::Known { entry } => encode_frame (99 99 KIND_ENTRY , KIND_ENTRY ,100 100 VERSION_ENTRY , VERSION_ENTRY ,102 102 entry.content.len (), entry.content.len (),103 103 max_frame_bytes, max_frame_bytes,583 583 assert_eq! (entry.kind, EntryKind::ToolResult { call_id, ok: true }); assert_eq! (entry.kind, EntryKind::ToolResult { call_id, ok: true });584 584 assert_eq! (EntryContent::decode(& entry.content).unwrap (), content); assert_eq! (EntryContent::decode(& entry.content).unwrap (), content);586 - let payload = Frame::encode_payload(& entry. wire ( ) , DEFAULT_MAX_FRAME_BYTES ).unwrap ();586 + let payload = Frame::encode_payload(& entry, DEFAULT_MAX_FRAME_BYTES ).unwrap ();587 587 let at = payload let at = payload588 588 .windows (entry.content.len ()) .windows (entry.content.len ())589 589 .position (|window| window == entry.content.as_slice ()) .position (|window| window == entry.content.as_slice ())714 714 fn version_one_frames_without_body_prefix_are_rejected () { fn version_one_frames_without_body_prefix_are_rejected () {716 716 let entry = sample_entry (false ); let entry = sample_entry (false );717 - let payload = Frame::encode_payload(& entry. wire ( ) , DEFAULT_MAX_FRAME_BYTES ).unwrap ();717 + let payload = Frame::encode_payload(& entry, DEFAULT_MAX_FRAME_BYTES ).unwrap ();718 718 let mut bytes = u32 ::try_from(payload.len ()).unwrap ().to_le_bytes ().to_vec (); let mut bytes = u32 ::try_from(payload.len ()).unwrap ().to_le_bytes ().to_vec ();719 719 bytes.extend_from_slice (& payload); bytes.extend_from_slice (& payload);720 720 let recovery = read_all (& bytes, DEFAULT_MAX_FRAME_BYTES ); let recovery = read_all (& bytes, DEFAULT_MAX_FRAME_BYTES );smith-core/src/session.rs Modified +13 / −26 text lines
153 - #[derive(Clone, PartialEq, Eq, Debug, Deserialize)]153 + #[derive(Clone, PartialEq, Eq, Debug, Serialize , Deserialize)]154 154 pub struct EntryFrame {pub struct EntryFrame {156 156 pub id: EntryId, pub id: EntryId,162 162 pub kind: EntryKind, pub kind: EntryKind,164 - #[serde(deserialize_with = "byte_buf" )]164 + #[serde(serialize_with = " cbor_bytes " , deserialize_with = "byte_buf" )]165 165 pub content: Vec <u8 >, pub content: Vec <u8 >,182 182 content: bytes, content: bytes,186 - pub (crate ) fn wire (& self) -> EntryWire<'_ > {189 - parent: self.parent,190 - timestamp_ms: self.timestamp_ms,192 - content: CborBytes(& self.content),
199 189 #[derive(Serialize)]#[derive(Serialize)]200 190 pub (crate ) struct EntryWire <'a > {pub (crate ) struct EntryWire <'a > {201 191 id: EntryId, id: EntryId,202 192 parent: Option <EntryId>, parent: Option <EntryId>,203 193 timestamp_ms: i64 , timestamp_ms: i64 ,204 194 kind: EntryKind, kind: EntryKind,205 - content: CborBytes<'a >,195 + #[serde(serialize_with = "cbor_bytes" )]208 199 impl <'a > EntryWire <'a > {impl <'a > EntryWire <'a > {212 203 parent: entry.parent, parent: entry.parent,213 204 timestamp_ms: entry.timestamp_ms, timestamp_ms: entry.timestamp_ms,214 205 kind: entry.kind, kind: entry.kind,215 - content: CborBytes(content),221 - struct CborBytes <'a >(&'a [u8 ]);223 - impl Serialize for CborBytes <'_ > {224 - fn serialize <S: serde::Serializer>(227 - ) -> std::result::Result <S:: Ok , S:: Error> {228 - serializer.serialize_bytes (self.0 )212 + fn cbor_bytes <S: serde::Serializer>(213 + bytes: & impl AsRef <[u8 ]>,215 + ) -> std::result::Result <S:: Ok , S:: Error> {216 + serializer.serialize_bytes (bytes.as_ref ())232 219 fn byte_buf <'de , D: serde::Deserializer<'de >>(fn byte_buf <'de , D: serde::Deserializer<'de >>(