Adding support for new INCREX command#4067
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Pull request overview
Adds a new increx command to the core Redis command API (sync + async overloads) supporting BYINT/BYFLOAT, LBOUND/UBOUND, OVERFLOW, expiration options, PERSIST, and ENX. Also tightens mutual-exclusivity checks in getex, msetex, set, hgetex, and hsetex so zero-valued expiration/empty conditional arguments are treated as provided. Updates the CI 8.8 matrix to use the 8.8-rc1 Redis image.
Changes:
- New
increxAPI with client-side validation for mutually exclusive options, overflow values, andenxrequiring an expiration. - Replaced truthiness-based
at_most_one_value_setinvocations with explicitis not Nonechecks across several existing commands. - Added sync and async tests for
INCREXbehavior and regression tests for zero-valued expiry / empty conditional arguments; updated8.8Redis image tag in integration workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| redis/commands/core.py | Adds increx sync/async overloads and implementation; updates mutual-exclusivity checks in getex, msetex, set, hgetex, hsetex. |
| tests/test_commands.py | Adds sync INCREX tests and zero-value/empty-value regression tests for GETEX/MSETEX/SET/HGETEX/HSETEX. |
| tests/test_asyncio/test_commands.py | Mirrors async tests for the above. |
| .github/workflows/integration.yaml | Switches the 8.8 Redis version mapping to 8.8-rc1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 22ac22f. Configure here.

Description of change
Add support for the new
INCREXcommand. The command is exposed asincrex(...)on the core Redis command API with sync and async overloads, matching the existing redis-py command style.The implementation supports default increment behavior,
BYINT,BYFLOAT, lower and upper bounds,OVERFLOWmodes, expiration options,PERSIST, andENX.The new API builds command arguments explicitly and validates mutually exclusive options before dispatching to Redis. Expiration options use
at_most_one_value_setwithis not Nonechecks so values likeex=0andpx=0are treated as provided arguments, rather than being skipped due to Python truthiness. The same validation fix was applied to related command helpers that useEX,PX,EXAT,PXAT,PERSIST, orKEEPTTL.Tests were added for sync and async clients. INCREX coverage includes default increment,
BYINT,BYFLOAT, saturating overflow behavior, rejected overflow preserving the existing value, expiration withENX, and invalid option combinations.Additional regression tests cover zero-valued expiration arguments for
GETEX,MSETEX,SET,INCREX,HGETEX, andHSETEX, with each test placed near the command it exercises. A SET conditional validation test was also added to ensure empty conditional values likeifeq=b""still count as provided when checking mutual exclusivity.Note
Medium Risk
Adds a new Redis command surface (
increx) and changes argument validation for multiple TTL/conditional options; behavior changes could affect callers that previously relied on falsy values (e.g.,ex=0) being ignored. Test changes reduce flakiness but touch concurrency timing in cluster initialization tests.Overview
Adds a new core client command
increx(...)(sync/async overloads) to support RedisINCREX, includingBYINT/BYFLOAT, bounds +OVERFLOW, expiration flags (EX/PX/EXAT/PXAT),PERSIST, andENX, with explicit option validation before dispatch.Fixes several commands (
getex,msetex,set,hgetex,hsetex, plusincrex) to validate mutually-exclusive expiry/conditional options usingis not Nonechecks so zero/empty values (e.g.,ex=0,ifeq=b"") are not silently ignored; adds regression tests for these cases.Stabilizes flaky
BGSAVEtests by pollingINFO persistenceinstead of sleeping, and makes a clusterinitialize()vsmove_slot()concurrency test deterministic via synchronization events/timeouts; CI is also updated to test Redis8.8against8.8-rc1.Reviewed by Cursor Bugbot for commit d007796. Bugbot is set up for automated code reviews on this repo. Configure here.