Fix async ClusterPipeline missing nodes_manager and set_response_callback required by JSON module#3989
Merged
petyaslavova merged 1 commit intomasterfrom Mar 6, 2026
Conversation
…nse_callback in ClusterPipeline objects
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an async Redis Cluster pipeline compatibility gap needed by the RedisJSON module, where calling pipeline.json() on redis.asyncio.cluster.ClusterPipeline raised AttributeError due to missing nodes_manager and set_response_callback.
Changes:
- Add
ClusterPipeline.nodes_managerproperty delegating to the underlyingRedisClusterclient. - Add
ClusterPipeline.set_response_callback()delegating to the underlyingRedisClusterclient. - Add async tests covering the delegation behavior and ensuring
pipeline.json()initializes successfully (standalone + cluster).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
redis/asyncio/cluster.py |
Exposes nodes_manager + set_response_callback on async ClusterPipeline via delegation to the composed cluster client. |
tests/test_asyncio/test_cluster.py |
Adds unit tests asserting the new delegation property/method behave as expected for cluster pipelines. |
tests/test_asyncio/test_pipeline.py |
Adds a regression test verifying pipeline.json() no longer raises and registers JSON response callbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vladvildanov
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3936 where calling
.json()on an asyncClusterPipelineraisedAttributeError: 'ClusterPipeline' object has no attribute 'nodes_manager'.Problem
The Redis JSON module requires access to
nodes_manager(for protocol version checking) andset_response_callback(for registering command decoders) during initialization. The asyncClusterPipelineuses a composition pattern—holding a reference tocluster_clientrather than inheriting fromRedisClusterlike the sync implementation—so these members weren't automatically available.Solution
nodes_managerproperty that delegates toself.cluster_client.nodes_managerset_response_callback()method that delegates toself.cluster_client.set_response_callback()Testing
pipeline.json()can now be called without errors on both standalone and cluster pipelinesNotes
The sync
ClusterPipelineis not affected since it inherits directly fromRedisCluster.Note
Low Risk
Low risk: adds simple delegation accessors on
ClusterPipelineand corresponding tests, mainly to unblockpipeline.json()without changing command execution behavior.Overview
Fixes an
AttributeErrorwhen callingpipeline.json()on async cluster pipelines by exposingClusterPipeline.nodes_managerandClusterPipeline.set_response_callback()as delegations to the underlyingRedisClusterclient.Adds async tests verifying these delegations and that
pipeline.json()initializes successfully and registersJSON.*response callbacks on the cluster client.Written by Cursor Bugbot for commit e689342. This will update automatically on new commits. Configure here.