-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area:codecArea: codecs and serializationArea: codecs and serializationarea:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgepriority:p1Priority P1 (high)Priority P1 (high)
Milestone
Description
Summary
When calling into Python, binary payloads using Tywrap's bytes marker are not consistently decoded on the Python side, and Python responses are not fully revived into Uint8Array on the TypeScript side. This causes incorrect behavior in boundaries that depend on byte semantics (for example, length calculations and byte payload shape).
Reproduction
- Call
bridge.call<number>('builtins', 'len', [new Uint8Array([72, 101, 108, 108, 111])]and observe incorrect length behavior before fix. - Ensure responses from Python that include bytes envelopes like
{ "__type__": "bytes" ... }are parsed into typed arrays.
Expected Behavior
- JavaScript
Uint8Array/byte-like inputs are decoded to Pythonbytesfor runtime invocation args/kwargs/method calls. - Python byte envelopes are revived to
Uint8ArraybySafeCodec.decodeResponseanddecodeResponseAsync. - Bridge behavior is stable across
handle_call,handle_instantiate, andhandle_call_methodboundaries. - Tests cover regressions around byte round-trip and length semantics.
Acceptance Criteria
- Add protocol decode path for
__tywrap_bytes__/__type__: 'bytes'envelopes in Python runtime bridge. - Add Python bytes envelope reviver for
SafeCodec.decodeResponseanddecodeResponseAsync. - Add regression tests for byte round-trip and bytes length semantics.
- Run relevant test suites and keep CI green.
- Keep changes constrained to bridge/codec boundary only with explicit error behavior on malformed envelopes.
Notes
- Keep a small compatibility-safe scope: no protocol version bump unless transport contract is changed beyond envelope compatibility.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:codecArea: codecs and serializationArea: codecs and serializationarea:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgepriority:p1Priority P1 (high)Priority P1 (high)