ADR 0007: Zero-Bridge Serialization (Direct Python-to-MsgPack)
Status
Accepted (Supersedes ADR 0004)
Context
ADR 0004 used serde_json as a bridge between Python and MsgPack. This introduced unnecessary allocations, CPU overhead, and a dependency on JSON's type system limitations.
Decision
- Eliminate
serde_json: Remove all intermediate JSON conversions. - Direct Transcoding: Use
serde-transcodeto stream directly betweenpythonize(Python objects) andrmp_serde(MsgPack bytes). - Rust-native Hashing: Key generation now uses the same transcode path to hash data directly from Python objects.
Consequences
- Positive: Significantly lower latency at the Python-Rust boundary.
- Positive: Reduced binary size and dependency complexity by removing
serde_json. - Positive: Better support for binary data or types that might be lossy in JSON.
- Negative: Tight coupling between
pythonize,rmp-serde, andserde-transcode.