fix(client): correct HELLO modules reply type - #3411
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10b540ac92
ℹ️ 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".
| [BlobStringReply<'path'>, BlobStringReply], | ||
| /** added in 7.0 */ | ||
| [BlobStringReply<'args'>, ArrayReply<BlobStringReply>] |
There was a problem hiding this comment.
Mark the pre-Redis-7 module fields optional
When HELLO is issued to Redis 6.x with a loaded module, module entries contain name and ver but not the path and args fields that these comments identify as added in 7.0. Declaring both fields as required therefore lets consumers dereference entry.path or entry.args as non-null values even though they are absent at runtime; this command's existing integration coverage still explicitly includes Redis 6.2, so these fields should be optional or represented by a version-aware union.
Useful? React with 👍 / 👎.
|
@abhijeet117 Thanks for the PR. We’ll review it when we have capacity. |
Summary
The HELLO reply type declared modules as an array of strings, but Redis sends one structured entry per loaded module: name and ver, plus path and args since 7.0. Consumers had no type-safe access to these fields. This declares the entries with the same TuplesToMapReply shape used by MODULE LIST, matching addReplyLoadedModules in the server.
Testing
Reproduced at compile time: with the old declaration, each module entry resolves to string and accessing name or ver fails tsc. Added packages/client/types-tests/hello.types-test.ts, which fails before the fix and passes after; it also covers the flat RESP2 form of the entry. Ran test:types, lint and the client package build locally; full suites run in CI.
Checklist
Note
Low Risk
Type-only change to the HELLO reply declaration plus a compile-time test; no runtime or protocol behavior is modified.
Overview
Corrects the
HELLOreply type somodulesis an array of structured entries (name,ver, and Redis 7.0+path/args) instead of an array of strings. That matches what Redis actually returns and lets consumers access those fields with type safety.Adds a compile-time types test that asserts mapped RESP3 entries expose those fields and that
veris a number.Reviewed by Cursor Bugbot for commit 10b540a. Bugbot is set up for automated code reviews on this repo. Configure here.