From aed07a4b719a3c1897359431f3b9f1980ad38c0a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 28 Oct 2026 11:38:11 +0100 Subject: [PATCH] connector-contract-v3: drop the unreachable short-string arms of the str header width Mutation survivors on 2101602: the worst-case payload is the base64 of an envelope holding two 256-byte ids, so it never fits a one- or two-byte str header. Co-Authored-By: Claude Opus 5.5 --- crates/model-connector/src/envelope.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/model-connector/src/envelope.rs b/crates/model-connector/src/envelope.rs index f0b423a..9b9cd45 100644 --- a/crates/model-connector/src/envelope.rs +++ b/crates/model-connector/src/envelope.rs @@ -226,14 +226,11 @@ fn bin_header_bytes(len: usize) -> usize { } } -/// MessagePack `str` header width for a string of `len` bytes. +/// MessagePack `str` header width for the base64 payload. The payload always +/// exceeds 255 bytes: the envelope it encodes holds two ids of at least +/// `MAX_IDENTITY_BYTES` in the worst case this bound measures. fn str_header_bytes(len: usize) -> usize { - match len { - 0..=31 => 1, - 32..=255 => 2, - 256..=65_535 => 3, - _ => 5, - } + if len <= 65_535 { 3 } else { 5 } } /// The largest payload bound whose worst-case frame fits `max_frame_bytes`: