Skip to content

Handle bytes/bytearray return values explicitly #53

@bbopen

Description

@bbopen

Summary

Returning Python bytes/bytearray currently leads to JSON serialization failures; these should be encoded or rejected explicitly.

Failure mode

  • json.dumps raises TypeError: Object of type bytes is not JSON serializable.
  • The error can surface as a protocol error rather than a clear codec error.

Repro (adversarial)

  • Add a fixture that returns b"\x00\x01" and bytearray([...]).
  • Call through NodeBridge and assert explicit error or base64 envelope.

Acceptance criteria

  • Bytes/bytearray are either encoded in a dedicated envelope (preferred) or rejected with a clear error.
  • Adversarial tests cover bytes/bytearray return paths.

Metadata

Metadata

Assignees

Labels

area:codecArea: codecs and serializationbugSomething isn't workingpriority:p2Priority P2 (medium)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions