You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deferred follow-up from the compatibility-rules discussion (tracking issue in core).
msgpack@1 (today's MsgPack, rmp_serde default config) encodes a struct as a positional array, and generated Rust has no #[serde(default)]. So:
extra trailing elements fail decoding (LengthMismatch);
missing ones fail too, even for Option fields;
adding, removing or reordering any field breaks peers.
JSON tolerates all of these.
Proposal: a msgpack@2 that encodes structs as name-keyed maps (rmp_serde struct-map mode), decodes a missing optional field as absent, and ignores unknown fields. One rule set then holds across formats. The trade is size: field names on the wire.
Needs: the runtime format, conformance vectors for a new format-msgpack@2 feature, generated #[serde(default)] on optionals in comline-rust, and a TS MessagePack codec, which doesn't exist yet.
A possible shape for this, from core#127: key structs by field id rather than field name. Explicit field ids would be assigned on build and written into the source, as for function ids. An id-keyed MessagePack would tolerate added and removed fields like JSON, while staying nearly as compact as today's positional msgpack@1, as Cap'n Proto and FlatBuffers do.
Decided 2026-10-20 (recorded in ComlineProject/docs#64): msgpack@2 takes a parameter keys = "name" | "id" (default name). name: a map keyed by field name; renaming a field is major. id: a map keyed by field id, nearly as compact as positional; renames are free; every field needs @id (the field-id follow-up of core#127). Adding or removing an optional field is minor under both; each value sets its own profile facts.
Activity
Kinflou commentedon Oct 19, 2026
A possible shape for this, from core#127: key structs by field id rather than field name. Explicit field ids would be assigned on build and written into the source, as for function ids. An id-keyed MessagePack would tolerate added and removed fields like JSON, while staying nearly as compact as today's positional
msgpack@1, as Cap'n Proto and FlatBuffers do.Kinflou commentedon Oct 20, 2026
Decided 2026-10-20 (recorded in ComlineProject/docs#64):
msgpack@2takes a parameterkeys = "name" | "id"(defaultname).name: a map keyed by field name; renaming a field is major.id: a map keyed by field id, nearly as compact as positional; renames are free; every field needs@id(the field-id follow-up of core#127). Adding or removing an optional field is minor under both; each value sets its own profile facts.