Skip to content

fix(client): XGROUP CREATE/SETID with ENTRIESREAD 0 must emit the argument#3333

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
Develop-KIM:fix/xgroup-entriesread-0
Jul 13, 2026
Merged

fix(client): XGROUP CREATE/SETID with ENTRIESREAD 0 must emit the argument#3333
nkaradzhov merged 1 commit into
redis:masterfrom
Develop-KIM:fix/xgroup-entriesread-0

Conversation

@Develop-KIM

@Develop-KIM Develop-KIM commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

XGROUP CREATE key group id ENTRIESREAD 0 and XGROUP SETID key group id ENTRIESREAD 0 silently drop the ENTRIESREAD argument when the value is 0. Both argument builders guard it with a truthy check (if (options?.ENTRIESREAD)), so an explicit 0 never reaches the server.

ENTRIESREAD 0 is a valid value: it sets a consumer group's entries-read counter (used for lag tracking) to zero, for example when resetting the group. With the current code the argument is omitted, so the counter is left unset instead of 0.

The fix guards on !== undefined in both XGROUP_CREATE and XGROUP_SETID, so an explicit 0 is forwarded. This matches the recent XSETID ENTRIESADDED 0 fix (#3324) and RESTORE IDLETIME/FREQ 0 (#3323).

Added an ENTRIESREAD 0 transformArguments test to both command specs.

Checklist

  • Lint (eslint --max-warnings=0), type-check (tsc --build), and the transformArguments unit tests pass locally. The full npm test integration suite runs against Dockerized Redis, which I don't have set up locally, so I relied on CI for that.
  • Is the new or changed code fully tested? Added ENTRIESREAD 0 argument tests for both commands.
  • Documentation update: not applicable, no API surface change.

Note

Low Risk
Small argument-building fix with added unit tests; no auth, data, or API contract changes beyond correct command encoding.

Overview
XGROUP CREATE and XGROUP SETID no longer drop ENTRIESREAD when the value is 0. Both commands now append ENTRIESREAD whenever the option is set (!== undefined) instead of using a truthy check, so resetting the consumer group entries-read counter to zero reaches Redis as intended.

Unit tests assert that transformArguments includes ENTRIESREAD '0' for both commands.

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

…ument

`XGROUP CREATE`/`XGROUP SETID ... ENTRIESREAD 0` was guarded by a truthy
check (`if (options?.ENTRIESREAD)`), so an explicit `0` was silently
dropped and the entries-read counter was left unset instead of being set
to 0.

`ENTRIESREAD 0` is a valid value (a consumer group that has read zero
entries, e.g. resetting the group's lag tracking), so guard on
`!== undefined` so `0` is forwarded, matching the recent XSETID
ENTRIESADDED 0 fix (redis#3324). Adds an `ENTRIESREAD 0` argument test for both
commands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nkaradzhov nkaradzhov merged commit 2f2b431 into redis:master Jul 13, 2026
15 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.

2 participants