Skip to content

encode before incrementing seq + putting in send buffer#363

Merged
jackyzha0 merged 8 commits intomainfrom
jackyzha0/only-increment-seq-after-encode
Mar 8, 2026
Merged

encode before incrementing seq + putting in send buffer#363
jackyzha0 merged 8 commits intomainfrom
jackyzha0/only-increment-seq-after-encode

Conversation

@jackyzha0
Copy link
Member

Why + What changed

spiritual successor of #278

  • Moves message encoding (codec.toBuffer) before incrementing the sequence number and pushing to the send buffer, so that if encoding fails (e.g. unserializable values like Symbol), or JS cannot allocate memory for the buffer, the session seq doesn't get out of sync
  • Changes the send buffer type from OpaqueTransportMessage[] to EncodedTransportMessage[] so buffered messages are already serialized and don't need re-encoding on
    reconnect
  • Adds tests for unserializable values in procedure handlers (binary codec throws, JSON codec silently drops)

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

@jackyzha0 jackyzha0 requested a review from a team as a code owner March 8, 2026 01:23
@jackyzha0 jackyzha0 requested review from cbrewster, darshkpatel and masad-frost and removed request for a team March 8, 2026 01:23
Copy link

@peter-zhong-replit peter-zhong-replit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove earlier accidental stamp

@peter-zhong-replit peter-zhong-replit dismissed their stale review March 8, 2026 01:29

remove rquest changes

@jackyzha0 jackyzha0 merged commit 3870a42 into main Mar 8, 2026
8 checks passed
@jackyzha0 jackyzha0 deleted the jackyzha0/only-increment-seq-after-encode branch March 8, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants