Skip to content

Correct VLINKS return types - #3839

Open
hutiefang76 wants to merge 1 commit into
redis:mainfrom
hutiefang76:codex/lettuce-3404-vlinks-signature
Open

Correct VLINKS return types#3839
hutiefang76 wants to merge 1 commit into
redis:mainfrom
hutiefang76:codex/lettuce-3404-vlinks-signature

Conversation

@hutiefang76

@hutiefang76 hutiefang76 commented Jul 11, 2026

Copy link
Copy Markdown

Fixes #3404

VLINKS returns one collection per HNSW graph layer. The existing outputs flatten those layers into a single list or map, which also drops empty layers.

This change:

  • exposes List<List<V>> and List<Map<V, Double>> through the sync, async, cluster, and coroutine APIs
  • emits one item per graph layer in reactive APIs (Flux<List<V>> and Flux<Map<V, Double>>)
  • adds typed outputs that preserve graph-layer boundaries for RESP2 arrays and RESP3 maps
  • covers empty layers, missing keys, wrong key types, and invalid score responses

Tests:

  • RedisVectorSetCommandBuilderUnitTests: 38 passed on JDK 8
  • RedisVectorSetAdvancedIntegrationTests, RedisVectorSetResp2IntegrationTests, and RedisVectorSetIntegrationTests: 87 passed against Redis 8.6.2 on JDK 17
  • formatter validation and six API generator suites passed

Note

Medium Risk
Breaking API change on experimental vector-set commands; behavior change is intentional correctness fix with broad surface area (sync/async/reactive/cluster/Kotlin).

Overview
Fixes incorrect modeling of Redis VLINKS responses: the server returns one collection per HNSW graph layer, but Lettuce previously flattened layers into a single List or Map and could drop empty layers.

vlinks and vlinksWithScores now expose List<List<V>> and List<Map<V, Double>> across sync, async, reactive, cluster, coroutines, and API templates. Reactive APIs emit Flux<List<V>> / Flux<Map<V, Double>> (one element per layer) instead of dissolving into flat streams or a single Mono.

Command decoding switches from ValueListOutput / ValueDoubleMapOutput to new ValueListListOutput and ValueDoubleMapListOutput, preserving layer boundaries for RESP2 arrays and RESP3 maps. Unit tests cover layered decode, RESP3 maps, and invalid scores; integration tests were updated for the new shapes (including merging score maps per layer where assertions need flat neighbor scores).

Breaking change for callers of these @Experimental methods who assumed a flat list or map.

Reviewed by Cursor Bugbot for commit f55d89a. Bugbot is set up for automated code reviews on this repo. Configure here.

@hutiefang76
hutiefang76 force-pushed the codex/lettuce-3404-vlinks-signature branch from b42cae6 to 851cbb9 Compare July 11, 2026 22:11
VLINKS returns one collection per HNSW graph level. Preserve those levels for plain and WITHSCORES responses across all command APIs and decode both RESP2 arrays and RESP3 maps.
@hutiefang76
hutiefang76 force-pushed the codex/lettuce-3404-vlinks-signature branch from 851cbb9 to f55d89a Compare July 11, 2026 22:25
@a-TODO-rov

Copy link
Copy Markdown
Collaborator

Thanks @hutiefang76
Will review this soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VLINKS has incorrect signature

2 participants