Sync with upstream v3.1.3 + Gather patch#5
Merged
Conversation
Allows extension codecs to handle undefined values instead of
msgpack converting them to nil. Used by Gather's serialization
framework to preserve {a: undefined} round-trip fidelity.
Ports the undefined round-trip test from the original patch PR and adds a new reentrancy test verifying that allowUndefinedCustomEncoding is propagated through clone() when the encoder's reentrance guard fires.
The encoder variable was only assigned once; restructuring to declare it before the Box codec registration lets ESLint's prefer-const rule pass while keeping the test semantics identical (extensionCodec is a shared reference, so the Box codec registered afterward is still visible to the encoder at runtime).
gesposito
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebases our
allowUndefinedCustomEncodingpatch onto upstream v3.1.3.The PR diff shows only Gather-specific changes against the upstream baseline (
main-upstream= exact v3.1.3 tag):src/Encoder.ts— theallowUndefinedCustomEncodingoption (5 insertions)package.json— rename to@gathertown/msgpack, version3.1.3Original patch for comparison: #2
All 325 upstream tests pass.
Test Plan
npm testpasses (325/325)Note
Medium Risk
Changes how
undefinedis treated during encoding whenallowUndefinedCustomEncodingis enabled, which can affect on-the-wire serialization compatibility. Adds targeted tests, but consumers relying on defaultundefined→nil behavior should review usage.Overview
Renames the published package to
@gathertown/msgpackwhile keeping version3.1.3.Adds an opt-in
Encoderoption,allowUndefinedCustomEncoding, that stops treatingundefinedas MessagePack nil so extension codecs can custom-encode it; ensures this flag is preserved across encoderclone()reentrancy. UpdatesExtensionCodectests to cover encoding/decodingundefinedand the clone-propagation case.Reviewed by Cursor Bugbot for commit f04adc1. Bugbot is set up for automated code reviews on this repo. Configure here.