feat(client): add INCREX and INCREXBYFLOAT commands#3288
Conversation
|
Does it make sense to decode withTypeMapping({ [RESP_TYPES.DOUBLE]: String }) |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 596f77e. Configure here.
| transformReply: { | ||
| 2: undefined as unknown as () => TuplesReply<[BlobStringReply, BlobStringReply]>, | ||
| 3: undefined as unknown as () => TuplesReply<[DoubleReply, DoubleReply]> | ||
| } |
There was a problem hiding this comment.
INCREXBYFLOAT RESP3 missing transform returns numbers not strings
High Severity
INCREXBYFLOAT declares per-protocol transformReply but both RESP2 and RESP3 entries are undefined. RESP2 happens to work because bulk strings are already JS strings, giving [string, string]. RESP3 doubles are decoded as JS number before reaching the caller, so the result is [number, number] — contradicting the PR description's promise of normalized [string, string] output and silently losing precision for values beyond Number.MAX_SAFE_INTEGER. The RESP3 slot needs an actual transform function that stringifies the decoded doubles.
Reviewed by Cursor Bugbot for commit 596f77e. Configure here.
INCREX is the integer-only path — both RESP2 and RESP3 return `:` integer replies in BYINT mode, so the declared return is `[NumberReply, NumberReply]` with no transform. Setting `NUMBER:String` opts the user into precision-safe string output via the decoder for values past `Number.MAX_SAFE_INTEGER`. `by`, `lowerBound`, and `upperBound` accept `RedisArgument | number` so callers can pass big-int strings directly. INCREXBYFLOAT is the float-only sibling. Its wire reply differs by protocol (`$` bulk string in RESP2, `,` double in RESP3); a per-protocol transform normalizes both elements to a plain `[string, string]` for consistent precision-friendly output. Buffer is intentionally not exposed. Also bumps the docker test image to custom-26235535976-debian across all packages so CI picks up a server build that includes the latest INCREX API (SATURATE flag). Integration tests cover both protocols and the precision opt-in. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> fix(client): return INCREXBYFLOAT replies as native protocol types RESP2 now returns [BlobStringReply, BlobStringReply] and RESP3 returns [DoubleReply, DoubleReply] as pure passthroughs, matching the server's wire behavior without lossy normalization through a stringify step.


INCREX is the integer-only path — both RESP2 and RESP3 return
:integer replies in BYINT mode, so the declared return is[NumberReply, NumberReply]with no transform. SettingNUMBER:Stringopts the user into precision-safe string output via the decoder for values pastNumber.MAX_SAFE_INTEGER.by,lowerBound, andupperBoundacceptRedisArgument | numberso callers can pass big-int strings directly.INCREXBYFLOAT is the float-only sibling. Its wire reply differs by protocol (
$bulk string in RESP2,,double in RESP3);Also bumps the docker test image to custom-26235535976-debian across all packages so CI picks up a server build that includes the latest INCREX API (SATURATE flag).
Integration tests cover both protocols and the precision opt-in.
Description
Checklist
npm testpass with this change (including linting)?Note
Low Risk
Additive command definitions and test/CI image tag updates; no changes to auth, persistence, or existing command behavior.
Overview
Adds Redis 8.8
INCREXsupport to the Node client:increxfor integer increments (optionalBYINT, bounds,SATURATE, TTL/ENX/PERSIST) andincrExByFloatforBYFLOAT, both registered on the public command surface with broad unit and integration tests (including RESP2/3 and large-integerNUMBER:Stringmapping).CI and package test defaults switch the 8.8 Redis Docker tag from
8.8-rc1tocustom-26235535976-debianso tests run against a server build that includes the currentINCREXAPI (e.g.SATURATE).Reviewed by Cursor Bugbot for commit a8c6bed. Bugbot is set up for automated code reviews on this repo. Configure here.