@blazetrails/msgpack
MessagePack serialization, mirroring Ruby's msgpack gem
| Measure | Value |
|---|---|
| Rails counterpart | msgpack v1.8.0 |
| API methods matched | 100% (35 of 35) |
| Rails tests matched | 100% (220 of 220) (10 permanent) |
| Ruby files ported | 8 |
| Ruby files unported | 0 |
| Measured at | fe89b44726 |
Gaps by file
No gaps recorded for this package.
Missing methods
None recorded for this package.
Unported Ruby files
Every compared Ruby file has a TypeScript file.
Deviation receipts
JSDoc receipt tags in the package's source, by the receipt each carries.
| Tag | PERMANENT | CONVERGEABLE | none |
|---|---|---|---|
@noRailsEquivalent | 3 | 0 | 0 |
@missingRailsCall | 1 | 0 | 0 |
@internal | 0 | 0 | 14 |
Permanently skipped tests
No section cited (18)
- defines a function for ObjectSpace.memsize_of
- works on a fresh factory
- works on a factory with registered types
- extracts an object from the buffer
- extracts an object from the buffer, starting at an offset
- extracts an object from the buffer, starting at an offset reading bytes up to a limit
- extracts nothing if the limit cuts an object in half
- returns the offset where the object ended
- is finished if #data returns an object
- yields each object in the stream
- yields each object in the stream
- is a no-op
- produces results with encoding as binary or string(utf8)
- recodes to internal encoding
- can symbolize keys when using #execute
- decode binary as ascii-8bit string when using #execute
- is serialized into timestamp96
- is serialized into timestamp96
A String has no encoding tag either (5)
Ruby Strings are JS string primitives (no mutable String carrier) (3)
Ratified deviations
Each rule below is ratified in the repository's CLAUDE.md files. The first paragraph is quoted; the link opens the full section at this build's commit.
Ruby Strings are JS string primitives (no mutable String carrier)
A Ruby String is a mutable object with identity. str << "x" and str.replace("y") change the receiver in place, str.dup is a second object with the same content, and frozen? is a per-object fact. ActiveModel leans on all three:
A String has no encoding tag either
str.encoding, force_encoding and String#b read or change a per-object encoding. A JS string has none, and trails adds none: the carrier that would hold it is the carrier this section rejects. ruby-compat tags a Uint8Array only. A Rails body that branches on a String's encoding ports the UTF-8 arm, and a test asserting str.encoding is permanently unportable for that assertion.
A read answers new bytes; the out String is not written (Buffer#read's out)
Buffer#read and #read_all take an optional out String (vendor/msgpack/v1.8.0/ext/msgpack/buffer_class.c:430-533), which the C extension resizes in place and appends the read bytes to. _msgpack_buffer_read_from_io_to_string (vendor/msgpack/v1.8.0/ext/msgpack/buffer.c:627-655) reads straight into an empty out String and copies through io_buffer otherwise.
The unpacker is its own read loop (read_primitive)
Unpacker ports read_primitive, msgpack_unpacker_read and msgpack_unpacker_skip (vendor/msgpack/v1.8.0/ext/msgpack/unpacker.c:438-896) line for line, with the head byte, stack and partial raw body kept on the instance as the C struct keeps them. It does not decode through @msgpack/msgpack. The read state lives in one uk object, because a pool freezes its unpackers and Ruby's freeze leaves the C struct writable. A map reads as a plain object while every key is a String and becomes a Hash at the first other key. Ruled by the operator on 2026-11-16, amending RFC 0184's "no porting ext/msgpack/*.c" non-goal for the unpacker.
A :-prefixed String packs as a Symbol (Packer#write's T_SYMBOL arm)
A Ruby Symbol is a JS string with a leading colon (root CLAUDE.md), so Packer#write takes the T_SYMBOL arm for every string isSymbol answers. A call site that packs arbitrary text where Rails packs a String (IPAddr#to_s in ActiveSupport's write_ipaddr) calls writeString, so "::1" keeps Rails' str bytes. Ruled by the operator on 2026-11-16.