From bdbecc3308816978b21b08de5a1d235d74e76b3e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 16:58:28 +0200 Subject: [PATCH] Odin Cut 3: size a stored document with a message id CultNet admits CultNet refuses an empty message id, so sizing a document's snapshot response with one failed for every record, and the failure was read as "keep": nothing was ever dropped. The response is now sized with a one-byte message id, the shortest CultNet admits, and a record that cannot be sized is logged and kept rather than silently kept. Co-Authored-By: Claude Opus 5.5 --- crates/odin-daemon/src/main.rs | 36 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index b16a736..2e4c490 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -1362,14 +1362,19 @@ fn peer_document(envelope: &CultCacheEnvelope) -> Option payload.len(), + // Kept: the catalog meets the same failure when it serves + // the record, and logs it there. + Err(error) => { + eprintln!( + "Odin cannot size {} {} as a snapshot response; kept: {error:#}", + envelope.r#type, envelope.key + ); + return None; + } + }; (size > limit).then(|| (envelope.r#type.clone(), envelope.key.clone(), size)) }) .collect(); @@ -3274,7 +3288,7 @@ mod tests { } /// A peer document whose single-document snapshot response, encoded as the - /// server encodes one with an empty message id, is `response_bytes` long. + /// server encodes one with a one-byte message id, is `response_bytes` long. fn document_answering_in(key: &str, response_bytes: usize) -> Result { let document = |payload_bytes: usize| -> Result { Ok(CultCacheEnvelope { @@ -3298,7 +3312,7 @@ mod tests { tags: None, }; let message = CultNetMessage::SnapshotResponseRaw { - message_id: String::new(), + message_id: "m".into(), documents: vec![served], }; Ok(encode_cultnet_message_to_vec(&message, CultNetWireContract::CultNetSchemaV0)?.len())