Repository navigation
LCS command broken for non String codecs - #3919
Conversation
Signed-off-by: yordantsintsov <yordan.tsintsov@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 951b20104e
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 664838eb4a
ℹ️ 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".
…way LcsArgs works. Signed-off-by: yordantsintsov <yordan.tsintsov@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit b69fab7. Configure here.

The LCS command currently expects only
Stringvalues as keys and its output class only decodesStringobjects. This breaks the API for any user that wants to use something different fromString.A perfect example would be if someone decides to use
ByteArrayCodec.INSTANCE. The output class will try to decode it as a String and throw aClassCastExceptioneven though this is a perfectly viable use case.Furthermore, having a single overload that calls only a single
LcsArgsdoes not accurately represent the LCS command. Passing the keys as a vararg field introduces bugs. Developers can add as many keys as they want when in reality the Redis commands accepts only 2.This PR introduces two new overloads that correctly represent the Redis command and deprecates the old method. It also handles the broken parser for the method which casts values to String.
Note
Medium Risk
Public API additions and deprecations change how LCS keys are encoded and routed in cluster; callers on the old
LcsArgs.keys()path keep prior (broken) behavior until they migrate.Overview
Fixes Redis
LCSfor non-Stringkey codecs and cluster routing by addinglcs(key1, key2)andlcs(key1, key2, LcsArgs)across sync, async, reactive, cluster node-selection, and Kotlin coroutine APIs. Keys are sent viaaddKey()so they use the connection’s key codec and expose the first key for slot routing; the two-key overload returns the substring asVviaValueOutput.LcsArgsis now modifiers-only: newLcsArgs.Builderhelpers (justLen(),withIdx(),minMatchLen(),withMatchLen()), whilelcs(LcsArgs),LcsArgs.Builder.keys(), andLcsArgs.by()are deprecated with validation inRedisCommandBuilderto prevent mixing key styles.StringMatchResultOutputno longer assumesStringkeys when decoding the match bulk string, fixingClassCastExceptionwith codecs likeByteArrayCodecand compressed value codecs.Docs and tests cover RESP encoding, cluster first-key exposure, integration scenarios, and deprecated-arg compatibility.
Reviewed by Cursor Bugbot for commit 0600271. Bugbot is set up for automated code reviews on this repo. Configure here.