Skip to content

fix(client): default RESP to RESP2#3301

Open
raashish1601 wants to merge 2 commits into
redis:masterfrom
raashish1601:fix/redis-options-default-resp
Open

fix(client): default RESP to RESP2#3301
raashish1601 wants to merge 2 commits into
redis:masterfrom
raashish1601:fix/redis-options-default-resp

Conversation

@raashish1601
Copy link
Copy Markdown
Contributor

@raashish1601 raashish1601 commented May 30, 2026

Summary

  • Set RedisClientOptions default RESP from \RespVersions\ to \2.
  • Updated internal maintenance manager, sentinel pub-sub, sentinel internals, and test utils typings so RESP 2/3 are preserved correctly and avoid forcing a defaulted RESP in internal call paths.

Validation

pm run build

pm run lint (changed files)

Note: lint:changed reports existing lint issues in these files (not introduced by this change).


Note

Low Risk
Mostly TypeScript defaults and RESP2 reply shaping; runtime wire behavior for typical clients should stay RESP2 unless callers opt into RESP3.

Overview
Default protocol version: RedisClientOptions now defaults the RESP generic to 2 instead of the full RespVersions union, matching runtime behavior (RESP ?? 2 on the command queue).

Typing follow-through: parseOptions / parseURL, Enterprise Maintenance Manager, and Sentinel (BroadSentinelClient, PubSubProxy<RESP>, pooled clients) are updated so internal code does not widen or mis-infer RESP when options omit an explicit version.

Streams: XINFO GROUPS RESP2 parsing now uses transformTuplesReply; reply types treat last-delivered-id as a string and Redis 7 lag as nullable, with new unit tests.

Reviewed by Cursor Bugbot for commit 34c322a. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 34c322a. Configure here.

});
},
2: (reply: Array<Array<BlobStringReply | NumberReply | NullReply>>) =>
reply.map(group => transformTuplesReply(group as unknown as ArrayReply<BlobStringReply>)) as unknown as XInfoGroupsReply['DEFAULT'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

XINFO_GROUPS integration test broken by prototype and property changes

Medium Severity

Switching transformReply[2] to use transformTuplesReply changes the returned objects in two ways that break the existing integration test: (1) objects now have a null prototype (via Object.create(null)) instead of Object.prototype, and (2) for Redis versions below 7.0, the entries-read and lag keys are absent rather than present with value undefined. The integration test uses assert.deepStrictEqual (via strict as assert) which checks prototype equality, so comparing a null-prototype actual against a plain object expected will throw. The new unit tests correctly use Object.assign(Object.create(null), {...}), but the unchanged integration test does not.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 34c322a. Configure here.

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.

1 participant