Repository navigation
fix(client): keep binary stream names in RESP3 XREAD replies - #3540
Merged
nkaradzhov merged 1 commit intoOct 27, 2026
Merged
Conversation
With RESP3 and a type mapping of { [RESP_TYPES.BLOB_STRING]: Buffer,
[RESP_TYPES.MAP]: Array }, xRead and xReadGroup returned each stream
name as a string decoded from UTF-8, so non-UTF-8 key bytes were
replaced with U+FFFD and the name could not be used to address the
stream again. RESP2 returns the Buffer. Return the name as decoded.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Description
On RESP3,
xReadandxReadGroupturn a binary stream name into a lossy UTF-8 string, even with the type mapping thatdocs/RESP.mdsuggests for keeping map keys as Buffers ("decode them asArrays instead"):On master against Redis 8.9, RESP2 gives
nameas<Buffer 73 ff fe>andxRangereturns the entry. RESP3 givesnameas the string's��'andxRangereturns[].With
MAP: Arraythe decoder hands the name over as a Buffer, andtransformStreamsMessagesReplyResp3Compatthen callstoString()on it. This returns the name as decoded, like the RESP2 transform does. Without a Buffer mapping the name is already a string, so default replies are unchanged.Added a
transformReplytest with a non-UTF-8 name; it fails on master withname: 'k��'. I ran the@redis/clientsuite in a Linux container with the Redis 8.9 image from the test config: 3415 passing, and the same 19 sentinel and socket timeout failures as on master in that setup. Lint is clean on the changed files. I did not run the other workspaces.Checklist
npm testpass with this change (including linting)?Note
Low Risk
Narrow change to RESP3 XREAD/XREADGROUP reply shaping; only affects stream
namewhen MAP is decoded as Array and blob strings may be Buffers.Overview
Fixes RESP3
xRead/xReadGroupso streamnamevalues are not forced throughtoString()when the reply is normalized from a map-as-Arrayshape.In
transformStreamsMessagesReplyResp3Compat, the array branch now assignsname: rawNameinstead of coercing withrawName?.toString?.(). WithwithTypeMapping({ [RESP_TYPES.BLOB_STRING]: Buffer, [RESP_TYPES.MAP]: Array }), non-UTF-8 stream keys stayBuffer(matching RESP2), so follow-up commands likexRangeuse the correct key. Default mappings (string names) are unchanged.Adds a unit test on
XREAD.transformReply[3]with a binary stream name and the Buffer/Array type mapping.Reviewed by Cursor Bugbot for commit 452aa8f. Bugbot is set up for automated code reviews on this repo. Configure here.