Skip to content

Conversation

petyaslavova
Copy link
Collaborator

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

This change is adding score_cast_func argument to the commands that had with_score/s argument - this way all commands expose consistent pattern how to handle the responses.

Another change added here is adding the usage of the configured score_cast_func for RESP3 responses as well - with the current code this argument value was completely ignored for resp3 responses.

Fixes #3300

…onsistency with the other sorted sets commands
@petyaslavova petyaslavova requested a review from Copilot October 9, 2025 12:08
@petyaslavova petyaslavova added the breakingchange API or Breaking Change label Oct 9, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds consistency to Redis sorted set commands by adding the score_cast_func parameter to zrank, zrevrank, and zunion commands, aligning them with other sorted set operations. It also ensures that score_cast_func is properly applied to both RESP2 and RESP3 protocol responses.

  • Adds score_cast_func parameter to zrank, zrevrank, and zunion commands for consistency
  • Introduces new parser helper functions to handle score casting for rank operations in both RESP2 and RESP3
  • Updates test cases to verify the new functionality works correctly with custom score cast functions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
redis/commands/core.py Adds score_cast_func parameter to zrank, zrevrank, and zunion methods
redis/_parsers/helpers.py Introduces new parser functions for handling score casting in rank operations for both RESP protocols
tests/test_commands.py Adds comprehensive test coverage for the new score_cast_func parameter functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breakingchange API or Breaking Change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent withscore and score_cast_func Parameters Between zrevrange and zrevrank

1 participant