Skip to content

feat(client): add zRevRankWithScore command#3279

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
raashish1601:codex/2464-zrevrank-withscore
Jul 6, 2026
Merged

feat(client): add zRevRankWithScore command#3279
nkaradzhov merged 1 commit into
redis:masterfrom
raashish1601:codex/2464-zrevrank-withscore

Conversation

@raashish1601

@raashish1601 raashish1601 commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds ZREVRANK_WITHSCORE / zRevRankWithScore for Redis 7.2's ZREVRANK key member WITHSCORE form.

This mirrors the existing ZRANK_WITHSCORE implementation and keeps zRevRank itself unchanged, so existing callers keep the current number | null return type while callers that need the score can opt into the new command.

Closes #2464.

Redis command reference: https://redis.io/docs/latest/commands/zrevrank/

Validation

  • node -r ts-node/register/transpile-only direct parse/transform check for ZREVRANK_WITHSCORE
  • npm run lint:changed
  • npm run check:command-jsdoc
  • npm run build
  • git diff --cached --check

I also attempted a grep-limited Mocha run for ZREVRANK_WITHSCORE.spec.ts, but this repo starts its Docker-backed Redis test environment in the global hooks before the grep-selected test runs. It failed locally at spawn docker ENOENT because Docker is not installed in this environment.


Note

Low Risk
Additive read-only command wrapper with no changes to existing APIs; risk is mainly using it against Redis versions before 7.2.

Overview
Adds client support for Redis 7.2 ZREVRANK … WITHSCORE, exposed as ZREVRANK_WITHSCORE / zRevRankWithScore, so callers can get a member’s reverse rank and score in one read without changing existing zRevRank (number | null).

The new command module follows the same pattern as ZRANK_WITHSCORE: it reuses ZREVRANK argument parsing and appends WITHSCORE, and maps replies to { rank, score } or null via ZRANK_WITHSCORE.transformReply. It is wired into the public commands export in index.ts, with tests for argument encoding and integration behavior (gated to Redis ≥ 7.2).

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

@nkaradzhov

Copy link
Copy Markdown
Collaborator

Hi @raashish1601, thanks for the PR, i will look into it, hopefully soon!

@nkaradzhov nkaradzhov self-requested a review July 6, 2026 14:42

@nkaradzhov nkaradzhov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

clgtm

@nkaradzhov nkaradzhov closed this Jul 6, 2026
@nkaradzhov nkaradzhov reopened this Jul 6, 2026
@nkaradzhov nkaradzhov merged commit f29f1cd into redis:master Jul 6, 2026
16 checks passed
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.

Support ZREVRANK: Added the optional WITHSCORE argument.

2 participants