Skip to content

5.3 WireCompatibility and Envelope Decoding

Wiki Keeper (Grok Bot) edited this page Oct 15, 2026 · 2 revisions

WireCompatibility and Envelope Decoding

Fail-closed wire-schema gating in src/compatibility.rs. Crate semver (CARGO_PKG_VERSION) is independent of on-wire wire_version.

Constants

Constant Value
WireCompatibility::CURRENT 1
WireCompatibility::MIN_SUPPORTED 1
WireCompatibility::LEGACY_UNVERSIONED 1

Classification

  • classify_wire_version / WireCompatibility::classify → Compatibility::{Supported, TooOld, TooNew}
  • accept_wire_version → SupportedWireVersion or CompatibilityError::TooOld{found, min} / TooNew{found, current}

Decode API

  • decode_ipc_message_json(&[u8]) / decode_ipc_message_value(Value) — inspect wire_version before payload use; legacy unversioned tagged JSON accepted as wire v1.
  • encode_ipc_message_json — non-canonical convenience encode (not the fixture generator).
  • Canonical deterministic encode: encode_canonical_ipc_message.

Compatibility rules

  1. Unknown fields ignored on structs and the top-level envelope.
  2. Unknown IpcMessage variants fail deserialization (no Default, no catch-all).
  3. Missing wire_version → treat as LEGACY_UNVERSIONED.

Errors

  • CompatibilityError — version window miss
  • EnvelopeError — wraps compatibility errors plus parse failures (NotAnObject, missing keys, payload/JSON errors)

See also 5.4 Canonical Wire-v1 Encoding.

Clone this wiki locally