Skip to content

feat(cmds): add Start and Stop to ZRANGE and ZRANGESTORE builders - #1035

Open
AdamMagued wants to merge 1 commit into
redis:mainfrom
AdamMagued:feat-issue-1032-zrange-start-stop
Open

AdamMagued wants to merge 1 commit into
redis:mainfrom
AdamMagued:feat-issue-1032-zrange-start-stop

Conversation

@AdamMagued

@AdamMagued AdamMagued commented Oct 11, 2026 •

Copy link
Copy Markdown

Resolves #1032.

Redis renamed range arguments for ZRANGE and ZRANGESTORE from min/max to start/stop in redis/redis#10097 and redis/redis-doc#1736 to avoid confusion when using the REV modifier. Under REV, the start argument represents the upper score bound and stop represents the lower score bound.

This change updates hack/cmds/commands.json to define a oneof grouping containing both min/max and start/stop argument blocks for ZRANGE and ZRANGESTORE commands, following the maintainer recommendation in #1032.

Changes made:

  • Updated hack/cmds/commands.json definitions for ZRANGE and ZRANGESTORE using oneof blocks for min/max and start/stop.
  • Regenerated command builders with go run hack/cmds/gen.go internal/cmds hack/cmds/*.json.
  • Added unit tests in internal/cmds/builder_test.go verifying that Start/Stop and Min/Max builder invocations produce identical command arguments across all options.

Note

Low Risk
Additive, backward-compatible builder API with tests proving wire-equivalence to Min/Max; no runtime or security-sensitive logic changes.

Overview
Adds Start/Stop fluent builder paths for ZRANGE and ZRANGESTORE, matching Redis’s renamed range arguments (alongside existing Min/Max).

hack/cmds/commands.json now models the range as a oneof: either min/max or start/stop. Regenerated builders in internal/cmds/gen_sorted_set.go expose parallel chains (ZrangeKey.Start → Stop, same optional flags as the min/max path).

Tests in builder_test.go assert Start/Stop and Min/Max emit identical Redis argument lists (including BYSCORE, BYLEX, REV, LIMIT, WITHSCORES, and cacheable builds). Smoke coverage for the new chains was added in gen_sorted_set_test.go.

Reviewed by Cursor Bugbot for commit 7203aab. Bugbot is set up for automated code reviews on this repo. 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.

Add Start/Stop to the ZRANGE and ZRANGESTORE builders; Min/Max read backwards with REV

2 participants