-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgebugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)
Milestone
Description
Summary
JSON.stringify silently converts NaN, Infinity, and -Infinity to null in arrays/objects. This causes silent data corruption when passing numeric arguments into the bridge.
Failure mode
- Call
bridge.call('math', 'sqrt', [NaN]). - Payload JSON contains
nullinstead ofNaN. - Python receives
Noneand executes with unexpected values.
Evidence
src/runtime/node.tssend()usesJSON.stringify(message)directly.JSON.stringifyconverts non-finite numbers tonull.
Proposed fix
- Validate arguments/kwargs for non-finite numbers before serialization and throw a clear
BridgeProtocolError. - Optionally add a strict mode that rejects unsupported JS types (functions, symbols, undefined).
Acceptance criteria
- Passing NaN/Infinity in args or kwargs throws a clear error and does not silently convert.
- Add tests covering NaN/Infinity in both args and kwargs.
Metadata
Metadata
Assignees
Labels
area:runtime-nodeArea: Node runtime bridgeArea: Node runtime bridgebugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)