Repository navigation
feat: himport managed fieldsets - #2159
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01115e6257
ℹ️ 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".
| "client", | ||
| "hello", | ||
| "readonly", | ||
| "himport", |
There was a problem hiding this comment.
Normalize HIMPORT before skipping autopipelining
With enableAutoPipelining enabled, a user can issue the command as cluster.call("HIMPORT", "PREPARE", ...); this lowercase skip-list entry is compared case-sensitively, so the uppercase control command is auto-pipelined instead of going through the new direct cluster fan-out path. In that scenario only the selected pipeline node receives PREPARE, and later HIMPORT SET calls routed to other masters can fail with a missing fieldset; normalize commandName before checking this list.
AGENTS.md reference: AGENTS.md:L94-L94
Useful? React with 👍 / 👎.
| * - _since_: 8.10.0 | ||
| */ | ||
| himport(...args: [subcommand: 'PREPARE', fieldsetName: string | Buffer, ...fields: (string | Buffer)[], callback: Callback<'OK'>]): Result<'OK', Context>; | ||
| himport(...args: [subcommand: 'PREPARE', fieldsetName: string | Buffer, ...fields: (string | Buffer)[]]): Result<'OK', Context>; |
There was a problem hiding this comment.
Require a non-empty HIMPORT PREPARE field list
This overload lets redis.himport("PREPARE", "fieldset") type-check because the rest tuple can be empty, but Redis expects at least one field after the fieldset name. TS users can therefore compile calls that only fail at runtime; model the generator input as a required first field plus the remaining fields, and apply the same non-empty shape to SET values.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 2b4c6bf. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba2b6dc869
ℹ️ 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".
| for (const command of commands) { | ||
| const preparation = this.prepareCommand(connection, command); |
There was a problem hiding this comment.
Handle RESET before pipelined HIMPORT SET
When a pipeline contains RESET before a configured HIMPORT SET, this loop either decides no preparation is needed because the cache is already prepared, or sends PREPARE before the batch; Redis then executes RESET ahead of the SET and clears the session fieldsets, so the SET fails with a missing-fieldset error and the pipeline has no recovery path. Please treat earlier RESET (and fieldset-discarding HIMPORT controls) in the same pipeline as invalidating when deciding how to prepare the managed SET.
Useful? React with 👍 / 👎.
| const preparation = binding.coordinator.prepareCommands(connection, commands); | ||
| if (!preparation) { | ||
| return false; |
There was a problem hiding this comment.
Reprepare pipelined HIMPORT SET after reconnect
When a managed HIMPORT pipeline is executed while the underlying Redis connection is reconnecting, this can return false because the old session cache still says the fieldset is prepared, so the batch is only queued in the offline queue. The reconnect path resets the HIMPORT session in beginSession, but offline pipeline replay calls sendCommand with a stream and bypasses HIMPORT interception, so the SET is written to the new physical connection without a matching PREPARE; invalidate on close or force preparation/recheck before replaying the streamed pipeline.
Useful? React with 👍 / 👎.
# [6.0.0](v5.11.1...v6.0.0) (2026-07-31) * Add RESP3 ([#2127](#2127)) ([5d0862e](5d0862e)) ### Bug Fixes * clear stale socket timeout on reconnect ([#2148](#2148)) ([6455dbe](6455dbe)) * **cluster:** recreate stale connection on circular MOVED ([#2135](#2135)) ([08c8967](08c8967)) * **cluster:** validate MOVED slot to prevent Array.prototype pollution ([#2151](#2151)) ([9618206](9618206)), closes [#1267](#1267) * **command:** serialize large integer arguments in decimal notation ([#2136](#2136)) ([09b8d04](09b8d04)) * **redis:** keep reconnecting when connection closes during client setup ([#2099](#2099)) ([#2123](#2123)) ([f9a66bc](f9a66bc)) * **sentinel:** preserve zero preferred slave priority ([#2129](#2129)) ([a3f9f2d](a3f9f2d)) * **tracing:** redact values for GETSET and PSETEX ([#2134](#2134)) ([832765d](832765d)) * **types:** export ScanStreamOptions, RedisStatus and ClusterStatus ([#2158](#2158)) ([cf3bf71](cf3bf71)) ### Features * add LMOVEM and BLMOVEM command support ([#2144](#2144)) ([c26af46](c26af46)) * add Redis 8.10 set cardinality commands ([#2143](#2143)) ([301099b](301099b)) * himport managed fieldsets ([#2159](#2159)) ([729f174](729f174)) * improve default connection resilience ([#2160](#2160)) ([6d0716e](6d0716e)) * support MAXCOUNT and MAXSIZE for stream reads ([#2142](#2142)) ([ae5e41b](ae5e41b)) ### BREAKING CHANGES * ioredis now requires Node.js 20 or newer and uses RESP3 by default. Set `protocol: 2` to retain the v5 wire protocol.
|
🎉 This PR is included in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Note
Medium Risk
Changes the command send path for Redis, Cluster, and pipelines and introduces async gating around managed writes; behavior is experimental and documented ordering caveats apply, but coverage is broad.
Overview
Adds experimental HIMPORT support so clients can declare long-lived fieldsets via
himportFieldsetson standaloneRedisandCluster, then issueHIMPORT SETwithout manually trackingPREPAREon every connection.A new
HimportCoordinatorintercepts managedSETcommands (and matching pipelines), issues internalHIMPORT PREPAREduring connect/handshake and after reconnect orRESET, coalesces preparation per connection, and retries once when Redis reports a missing fieldset. Cluster wiring fansPREPARE/DISCARD/DISCARDALLto all masters, re-prepares on role changes and promoted nodes, and delays ASK redirects until the target master is ready. Unconfigured fieldsets and non-managed pipelines stay explicit/manual.Also adds
Command.isSettled(separate fromisResolved) so timeouts and HIMPORT recovery do not race settled commands, exportsHIMPORTtypings and return types, documents the feature in the README withexamples/himport.js, and adds functional/unit coverage.Reviewed by Cursor Bugbot for commit ba2b6dc. Bugbot is set up for automated code reviews on this repo. Configure here.