Skip to content

Fix HGETDEL FIELDS token validation#4049

Merged
enjoy-binbin merged 5 commits into
valkey-io:unstablefrom
lcxn123:unstable
Jun 25, 2026
Merged

Fix HGETDEL FIELDS token validation#4049
enjoy-binbin merged 5 commits into
valkey-io:unstablefrom
lcxn123:unstable

Conversation

@lcxn123

@lcxn123 lcxn123 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Add explicit validation for the FIELDS token before parsing numfields.

Fixes #4045.

Signed-off-by: lcxn123 <156999965+lcxn123@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bc7c309-ae14-41ba-8de3-6212935f2f00

📥 Commits

Reviewing files that changed from the base of the PR and between 2faa8ba and bb510c1.

📒 Files selected for processing (1)
  • tests/unit/type/hash.tcl
✅ Files skipped from review due to trivial changes (1)
  • tests/unit/type/hash.tcl

📝 Walkthrough

Walkthrough

hgetdelCommand now checks that argv[2] is FIELDS case-insensitively and returns a syntax error if it is not. The HGETDEL unit test now expects that syntax error for the malformed call.

Changes

HGETDEL syntax validation

Layer / File(s) Summary
Early FIELDS keyword guard
src/t_hash.c, tests/unit/type/hash.tcl
hgetdelCommand rejects non-fields tokens at argv[2] with shared.syntaxerr, and the HGETDEL error test now expects ERR syntax error for the malformed command.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: validating the HGETDEL FIELDS token.
Description check ✅ Passed The description matches the code change by describing explicit FIELDS validation before numfields parsing.
Linked Issues check ✅ Passed The code and test updates implement #4045 by rejecting missing or misspelled FIELDS with a syntax error.
Out of Scope Changes check ✅ Passed The changes stay focused on HGETDEL FIELDS validation and the related unit test.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@roshkhatri roshkhatri self-requested a review June 24, 2026 20:54

@roshkhatri roshkhatri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@roshkhatri

Copy link
Copy Markdown
Member
*** [err]: HGETDEL - check for syntax and type errors in tests/unit/type/hash.tcl
Expected 'ERR syntax error' to match '*value is not an integer or out of range' (context: type source line 93 file /home/runner/work/valkey/valkey/tests/support/test.tcl cmd {assert_match $pattern $error $detail} proc ::assert_error level 1) 

Can you please look at the failing test? the change seems okay

@roshkhatri roshkhatri self-requested a review June 24, 2026 22:48
@enjoy-binbin enjoy-binbin changed the title Fix HGETDEL FIELDS token validation #4045 Fix HGETDEL FIELDS token validation Jun 25, 2026
Comment thread src/t_hash.c Outdated
lcxn123 and others added 4 commits June 25, 2026 17:04
Signed-off-by: lcxn123 <156999965+lcxn123@users.noreply.github.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Signed-off-by: lcxn123 <156999965+lcxn123@users.noreply.github.com>
Signed-off-by: lcxn123 <156999965+lcxn123@users.noreply.github.com>

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@enjoy-binbin enjoy-binbin merged commit d38ff73 into valkey-io:unstable Jun 25, 2026
61 of 62 checks passed
@github-project-automation github-project-automation Bot moved this to To be backported in Valkey 9.1 Jun 25, 2026
@enjoy-binbin enjoy-binbin added the release-notes This issue should get a line item in the release notes label Jun 25, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Jun 26, 2026
Add explicit validation for the FIELDS token before parsing numfields.

Fixes #4045.

Signed-off-by: lcxn123 <156999965+lcxn123@users.noreply.github.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes This issue should get a line item in the release notes

Projects

Status: To be backported

Development

Successfully merging this pull request may close these issues.

[BUG] HGETDEL does not validate the FIELDS keyword

3 participants