fix(client): correct CLUSTER BUMPEPOCH reply type - #3414
Open
abhijeet117 wants to merge 1 commit into
Open
Conversation
Contributor
|
@abhijeet117 Thanks for the PR. We’ll review it when we have capacity. |
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.
Summary
CLUSTER BUMPEPOCH replies the simple string "BUMPED <epoch>" or "STILL <epoch>" (cluster_legacy.c formats it with sdscatprintf), but the reply was typed as the literal union 'BUMPED' | 'STILL'. Code like
reply === 'BUMPED'compiled while never matching at runtime because the epoch is always appended. The reply is now declared as a plain string, matching CLUSTER_REPLICATE and the existing runtime assertion in the spec.Testing
Compile-time regression test asserts the client-facing reply type equals string and is not the bare literal union; it fails before this change and passes after (
npm run test:types -w @redis/client). lint:changed and the client package build pass. Runtime behavior is unchanged; the existing spec already asserts typeof reply === 'string'.Checklist
Note
Low Risk
Type-only correction for one cluster command reply; no runtime or security changes.
Overview
Fixes the TypeScript reply type for
CLUSTER BUMPEPOCH. Redis returns"BUMPED <epoch>"or"STILL <epoch>", but the client typed the reply as the bare literals'BUMPED' | 'STILL', so checks likereply === 'BUMPED'type-checked while never matching at runtime.The command now uses a plain
SimpleStringReply. A compile-time types test asserts the client-facing type isstringand not the old literal union. Runtime behavior is unchanged.Reviewed by Cursor Bugbot for commit 15ca6b4. Bugbot is set up for automated code reviews on this repo. Configure here.