Repository navigation
docs: define the payload snapshot boundary - #252
Conversation
|
Warning Review limit reached
Next review available in: 18 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Reference behavior
Fresh Socket.IO 4.7.5 and 4.8.3 installations both resolved
socket.io-parser4.2.7. Runtime probes in Node and Chromium produced the same default-parser behavior in both versions.Connected client-to-server and server-to-client emits snapshot non-binary packet data synchronously. Mutating the source after
emitdoes not change the received value. Acknowledgement requests snapshot at emit, and acknowledgement responses snapshot when the receiver invokes the ack. A client emit buffered before connection is different: its source remains live until the buffer flushes, and the snapshot is taken then.Decoded data follows JSON conversion. Dates arrive as ISO strings, undefined object properties disappear, unsupported array positions and non-finite numbers become
null,toJSONis honored, and custom prototypes become plain objects. Map, Set, RegExp, and Error retain only enumerable own properties. Repeated references decode as separate objects, while circular data and BigInt fail when encoding is attempted.Broadcast probes showed that Socket.IO encodes one packet at the broadcast call even when there are no recipients. Each recipient decodes an independent object graph, so later mutation of the source and mutation by one recipient cannot affect another recipient.
The probes also fixed the boundary relative to
onAnyOutgoing. A connected direct emit exposes the live source to the sending-side listener before snapshotting. A buffered client does not notify at the original emit; it notifies and snapshots at flush. A broadcast snapshots first, then each reached server socket's outgoing listener sees the shared source without being able to change any recipient's encoded value.Decision
ADR 0026 selects the default parser's JSON result, reference isolation, and snapshot or failure timing as Smocket's compatibility boundary for non-binary EVENT and ACK data. This applies to direct emits, acknowledgements, broadcasts, timeout wrappers, connected volatile emits, and buffered delivery in both directions.
The decision does not promise Socket.IO's internal traversal algorithm, getter or
toJSONinvocation counts, or exact native exception classes and messages. Binary-containing packets, Engine.IO framing, and custom parser options stay outside this boundary. The implementation must remain host-neutral and add no Socket.IO runtime dependency.Normalizing only Date was rejected because it would leave the rest of the packet boundary observably wrong. Keeping direct references would permit tests to rely on reference sharing that real Socket.IO cannot provide.
structuredClonepreserves types and graph aliases that the default parser removes, while depending onsocket.io-parserwould import binary and parser machinery beyond the selected logic-layer surface.Follow-up and release boundary
Issue #250 now owns implementation with paired real/mock coverage for both directions, acknowledgements, connected and buffered timing, broadcast recipient isolation, outgoing catch-all ordering, invalid JSON data, timeout and volatile wrappers, and the browser gate.
Until #250 lands,
docs/differences.mdrecords direct same-process payload references as a known gap rather than an intentional divergence. The decision index and v1 roadmap now link the ADR and its implementation dependency. ADR 0019 classifies the eventual newly covered surface as minor after 1.0 and patch before 1.0.Related issue
Closes #237
Checklist