Skip to content

Add a typed codec that rebuilds a message without running code - #460

Closed
johnsabath wants to merge 2 commits into
mainfrom
feat/typed-ipc-codec
Closed

johnsabath wants to merge 2 commits into
mainfrom
feat/typed-ipc-codec

Conversation

@johnsabath

@johnsabath johnsabath commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Closed.

reactor_runtime.ipc.typed encodes an object as a tree of typed values:
None, bool, int, float, str, bytes, numpy arrays and scalars of a fixed
dtype list, list, tuple, dict, and the dataclasses and enums registered
with @payload_type. Arrays go into the writer's SharedSlot as they do
with pack(), or inline when there is no slot.

The reader builds only those types. It checks every length against the
frame, every array's shape against its bytes, every span against the
block, and the nesting depth, and it refuses an unregistered type by
name. pickle imports any class a frame names and calls what the frame
tells it to, so a reader that must not trust its writer cannot use it.

Nothing uses the codec yet; the model server's link takes it in the
next change.

Signed-off-by: John Sabath <john@reactor.inc>

Copy link
Copy Markdown
Contributor Author

…tity

A combined or unnamed Flag value encoded as "A|B" and could not decode,
so encode now refuses it and names the fix. A dict key check compared
types with ==, which a metaclass can override; it now compares by
identity. A deeply nested tuple key raised RecursionError; the check now
stops at MAX_DEPTH. The error for a bad enum member no longer renders the
decoded value, so no registered __repr__ runs.

Signed-off-by: John Sabath <john@reactor.inc>
@johnsabath johnsabath closed this Dec 5, 2026
@johnsabath
johnsabath deleted the feat/typed-ipc-codec branch December 5, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant