Repository navigation
fix(client): return null from vector set commands for a missing key or element - #3535
Open
maxymlyskov wants to merge 1 commit into
Open
maxymlyskov wants to merge 1 commit into
maxymlyskov wants to merge 1 commit into
Conversation
…r element When the vector set or the element does not exist, the server replies with nil, and the transforms read the reply anyway. vEmbRaw() threw a TypeError on both protocols, and on RESP2 vEmb(), vInfo() and vLinksWithScores() threw too. vLinks() already returned null. Return null for a nil reply in each command's transform. The VEMB check lives in VEMB.ts, so the shared transformDoubleArrayReply, which the t-digest commands also use, is unchanged. The reply types of vEmb, vEmbRaw, vInfo, vLinks and vLinksWithScores now include null. Fixes redis#3533
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Description
Fixes #3533
When the vector set or the element doesn't exist, the server replies with nil and these transforms read it anyway.
vEmbRaw()throws aTypeErroron both protocols, so it breaks on the default RESP3 client too. On RESP2,vEmb(),vInfo()andvLinksWithScores()throw the same way; on RESP3 they have no transform and already returnnull, likevLinks().With
redis:8, on master:and every one of these calls returns
nullon this branch.Each transform now returns
nullfor a nil reply, likeZRANK_WITHSCORE. VEMB gets its own transform inVEMB.ts, sotransformDoubleArrayReply, which the t-digest commands share, stays as it is. The reply types of the five commands now includenull; forvLinksthat's the only change.The tests call each command on a missing key and a missing element with
testUtils.testAll, on RESP2 and RESP3, and expectnull. The RESP2 ones andvEmbRawon RESP3 fail on master. There's also a types-test that checks each reply type acceptsnull.npm run build && npm testpasses, lint is clean.Checklist
npm testpass with this change (including linting)?Note
Low Risk
Behavioral bugfix in vector-set reply handling and typings; no auth, persistence, or infrastructure changes.
Overview
Fixes TypeError crashes when vector-set commands get a Redis nil reply for a missing key or element.
vEmb,vEmbRaw,vInfo,vLinks, andvLinksWithScoresnow returnnullinstead of running transforms on nil (matching patterns like other commands that handle null replies).RESP2 transforms gain early
reply === nullguards;VEMBuses a dedicated RESP2 transform so sharedtransformDoubleArrayReplystays unchanged for t-digest. Reply typings are widened to| nullon RESP2 and RESP3.Integration tests cover missing key/element on both RESP versions; a
types-testsfile asserts each client method’s return type acceptsnull.Reviewed by Cursor Bugbot for commit effe221. Bugbot is set up for automated code reviews on this repo. Configure here.