Preserve binary members as VectorSetRange bounds - #3256
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The shared bound construction fixes the binary corruption issue and is covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes VRANGE bounds to preserve binary members by reusing raw-byte lexicographic bound construction.
Changes:
- Replaces string concatenation with
GetLexRange. - Adds binary-bound and pagination regression tests.
| File | Description |
|---|---|
src/StackExchange.Redis/RedisDatabase.VectorSets.cs |
Builds vector range bounds from raw bytes. |
tests/StackExchange.Redis.Tests/VectorSetIntegrationTests.cs |
Tests binary bounds and finite enumeration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
The Windows failure is |
mgravell
approved these changes
Oct 2, 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.
VectorSetRangeandVectorSetRangeEnumeratebuild the[/(bounds by string concatenation,("(" + value). For a member that is not valid UTF-8,RedisValue.ToString()returns its hex form, so the bound sent to the server is not the member.ZRANGEBYLEXalready builds its bounds from the raw bytes inGetLexRange; this change makesVRANGEuse the same helper.With members
a,band{ 0xFF, 0x01 }, against Redis 8:VectorSetRange(key, start: binary, exclude: Exclude.Start)returned the binary member itself instead of nothing.VectorSetRangeEnumerate(key, count: 1)never ended: aftera, b, 0xFF01it kept returning0xFF01, because each next batch started from the hex text, which sorts before the member.Added
VectorSetRange_BinaryMemberAsBoundandVectorSetRangeEnumerate_BinaryMemberstoVectorSetIntegrationTests. Against Redis 8,--filter VectorSetRangepasses 40 of 40 (RESP2 and RESP3); without the change only the two new tests fail, in both protocols. The library builds for all targets with no warnings.Checklist