Skip to content

Change reply schema for hotkeys get to use map instead of flat array#14749

Merged
minchopaskal merged 2 commits intoredis:unstablefrom
minchopaskal:hotkeys-change-reply-schema
Jan 29, 2026
Merged

Change reply schema for hotkeys get to use map instead of flat array#14749
minchopaskal merged 2 commits intoredis:unstablefrom
minchopaskal:hotkeys-change-reply-schema

Conversation

@minchopaskal
Copy link
Copy Markdown
Collaborator

@minchopaskal minchopaskal commented Jan 28, 2026

Follow #14680
Reply of HOTKEYS GET is an unordered collection of key-value pairs. It is more reasonable to be a map in resp3 instead of flat array.


Note

Medium Risk
Changes the RESP3 wire response shape for HOTKEYS GET from a flat array to a map, which can break client parsing expectations. Logic changes are localized but touch protocol reply formatting and length accounting.

Overview
HOTKEYS GET now replies as a RESP3 map (key/value pairs) rather than a flat array, by switching the deferred length finalization to setDeferredMapLen and updating the internal length accounting to count map entries.

The command spec (hotkeys-get.json) is updated to describe an object/map reply with explicit properties, and unit tests add a RESP3-specific assertion (HELLO 3) that the outer reply is a dict/map while keeping the Top-K hotkey lists as flat arrays of alternating key/value elements.

Written by Cursor Bugbot for commit df125e9. This will update automatically on new commits. Configure here.

@minchopaskal minchopaskal requested a review from sundb January 28, 2026 16:34
@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Jan 28, 2026

🤖 Augment PR Summary

Summary: This PR updates HOTKEYS GET replies to better reflect that the output is an unordered set of key/value metrics.

Changes:

  • Switches the top-level reply encoding from a flat array to a RESP3 map in src/hotkeys.c (while preserving RESP2 compatibility via map-to-array conversion).
  • Reworks length accounting to count map entries rather than array elements.
  • Updates src/commands/hotkeys-get.json reply schema from an array to an object with named fields for the reported metrics and optional sections.

Technical Notes: Conditional fields are included only when slot selection, sampling, or specific metric tracking (CPU/NET) is enabled.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@sundb
Copy link
Copy Markdown
Collaborator

sundb commented Jan 29, 2026

I wonder why the test doesn't fail. Last time we deleted all the "hello 3"

@minchopaskal
Copy link
Copy Markdown
Collaborator Author

I wonder why the test doesn't fail. Last time we deleted all the "hello 3"

mhm. Good idea to add some resp3 tests back

@minchopaskal minchopaskal merged commit 591fc90 into redis:unstable Jan 29, 2026
19 checks passed
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.

2 participants