fix(client): type ACL GETUSER flags as RESP3 SET - #3417
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 009c10b47f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| type AclUser = TuplesToMapReply<[ | ||
| [BlobStringReply<'flags'>, ArrayReply<BlobStringReply>], | ||
| [BlobStringReply<'flags'>, SetReply<BlobStringReply>], |
There was a problem hiding this comment.
Keep RESP2 flags typed as an array
When a RESP2 client uses .withTypeMapping({ [RESP_TYPES.SET]: Set }), Resp2Reply<AclUser> preserves this nested value's new SET tag, so aclGetUser() now declares flags as Set<string>. The RESP2 server still sends an ARRAY and the decoder returns an array—the existing integration assertion confirms this—so consumers can compile Set-only operations that fail at runtime. Give the RESP2 transform an explicitly array-typed flags result rather than sharing the RESP3 marker.
AGENTS.md reference: AGENTS.md:L49-L51
Useful? React with 👍 / 👎.
|
@abhijeet117 Thanks for the PR. We’ll review it when we have capacity. |
Summary
ACL GETUSER declares flags as an array, but Redis emits the flags element with setDeferredSetLen in acl.c, so RESP3 clients receive a SET on the wire and get a runtime Set typed as string[]. Sibling commands already model this shape with SetReply (FUNCTION LIST, CLIENT TRACKINGINFO). flags is now SetReply: RESP2 replies stay arrays, RESP3 replies type as Set.
Testing
Compile-time regression test resolves the reply under a SET type mapping and asserts flags is Set; it fails on master with TS2740 and passes after the fix. Verified against acl.c source; parser spec, type tests, build and lint run locally; Docker-backed integration tests run in CI.
Checklist
Note
Low Risk
Type-only reply mapping change with no runtime parser or command behavior updates. Possible TypeScript breakage for callers that treated RESP3 flags as an array.
Overview
Corrects
ACL GETUSERreply types soflagsis a RESP3 set, matching what Redis actually sends (setDeferredSetLeninacl.c). Previously it was typed as an array, so RESP3 clients got a runtimeSetwhile TypeScript claimedstring[].flagsis nowSetReply<BlobStringReply>(same pattern asFUNCTION LISTandCLIENT TRACKINGINFO). RESP2 replies stay arrays. A compile-time types test assertsflagsisSet<string>under a SET type mapping.Reviewed by Cursor Bugbot for commit 009c10b. Bugbot is set up for automated code reviews on this repo. Configure here.