feat(cluster): RFC 010 c2 — owned wire envelope

Frame enum per the RFC inventory; hand-rolled encode/decode with u32 LE
length prefix + u8 tag; strings u16-prefixed, payload blobs u32-prefixed;
MAX_FRAME_LEN cap (control plane never carries bulk, §5). Streaming decode:
Ok(None) = need more bytes, every Err = corruption. postcard confined to
encode_payload/decode_payload — the single codec seam (§2); postcard gains
the alloc feature for to_allocvec (still no_std-aligned, no default
features). DownReason/RejectReason travel as single tag bytes; Down tag 5
is reserved for c11's Disconnected.

Tests: per-frame roundtrip, back-to-back frames, golden heartbeat bytes,
zero-length payload, every-prefix incomplete, unknown frame/enum tags,
length prefix lying long (with and without bytes present) and short,
truncation mid-string, adversarial lengths (u32::MAX, cap+1, zero), UTF-8
corruption, payload seam roundtrip through a real Send frame.
This commit is contained in:
Claude
2026-08-14 13:23:50 +00:00
parent 58a2fe3046
commit 3850f6099b
4 changed files with 783 additions and 1 deletions
+2
View File
@@ -4,3 +4,5 @@
//! trait (c3), and everything above them land in later chunks. This module is
//! intentionally empty so the `cluster` feature's default-build invariance is
//! reviewable in isolation.
pub mod envelope;