Repository navigation
Fix equality for GEO responses without coordinates - #4742
Conversation
|
@jakezwang
Without a reproducer, we cannot verify the fix end-to-end or confirm the scenario is actually resolved. |
Signed-off-by: Jake Wang <jake.wang@argonlabs.tech>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 64573d2. Configure here.
| @ParameterizedTest | ||
| @EnumSource(RedisProtocol.class) | ||
| public void compareRepeatedSearchesWithoutCoordinates(RedisProtocol protocol) { | ||
| EndpointConfig endpoint = Endpoints.getRedisEndpoint("redis2"); |
There was a problem hiding this comment.
IT uses unknown Redis endpoint
Medium Severity
The new GeoRadiusResponseIT looks up endpoint redis2, which is not defined in endpoints.json. Endpoints.getRedisEndpoint then throws TestAbortedException, so the parameterized cases abort instead of exercising geosearch without WITHCOORD. The Redis round-trip coverage described in the PR never runs.
Reviewed by Cursor Bugbot for commit 64573d2. Configure here.
|
This was independently discovered, not a production incident. I have now reproduced it against a real Redis 8.10.2 server with JDK 8 using GEOSEARCH WITHDIST WITHHASH without WITHCOORD. Two identical queries return responses with null coordinates; comparing their lists or doing a HashSet lookup throws NullPointerException on unpatched master. The new |
ggivo
left a comment
There was a problem hiding this comment.
LGTM.
Two minor notes before merging: drop the release notes entry (NPE fix, no user action needed), and move the integration test into GeoCommandsTestBase alongside the other geo tests.
Signed-off-by: Jake Wang <jake.wang@argonlabs.tech>


Summary
Comparing separate
GeoRadiusResponseinstances throwsNullPointerExceptionwhenWITHCOORDwas omitted. UseObjects.equalsfor the optional coordinate, preserving equality and hash-code behavior when coordinates are present.Unit tests cover equality, unequal members, mixed coordinate presence, hash-based lookup, and responses built with
WITHDIST/WITHHASH.Discovery and reproduction
This edge case was explored outside a production application. A reproducer against an actual Redis server is documented in #4746.
The integration regression now lives in
GeoCommandsTestBase, as requested, so it runs through bothRedisClientGeoCommandsTestandClusterGeoCommandsTest, using their existing protocol parameterization. It issues repeated GEOSEARCH commands with WITHDIST and WITHHASH but without WITHCOORD, and checks list equality and HashSet membership. The test uses the shared unique-key registry for cleanup. The release-note entry has been removed as requested.Testing
After merging current master, JDK 8 + Redis 8.10.2: 86 tests passed, zero failures and zero skips across
GeoRadiusResponseTest,RedisClientGeoCommandsTest, andClusterGeoCommandsTest, using an isolated standalone server and a real three-node cluster. The original server-backed reproducer failed with NullPointerException on the unpatched implementation.Closes #4746
Note
Low Risk
Small contract fix in a response DTO’s equals implementation, with focused unit and integration tests; no auth, persistence, or API surface changes.
Overview
Fixes
GeoRadiusResponse.equalsso comparing two responses no longer throws whenWITHCOORDwas not requested. The optionalcoordinatefield is compared withObjects.equalsinstead of callingequalson a possibly null reference; behavior when coordinates are present is unchanged andhashCodealready usedObjects.hashCode.Adds
GeoRadiusResponseTestfor null-coordinate equality, differing members, mixed coordinate presence, and builder-producedWITHDIST/WITHHASHreplies. Adds an integration case onGeoCommandsTestBasethat runs repeatedGEOSEARCHwith distance and hash but without coordinates and asserts list equality, matching hash codes, andHashSetmembership (covers client and cluster geo test subclasses).Reviewed by Cursor Bugbot for commit e0be1ce. Bugbot is set up for automated code reviews on this repo. Configure here.