GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding a registry that maps command names to their flags by uglide · Pull Request #4332 · redis/jedis

Conversation

@uglide

@uglide uglide commented Oct 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Introduces command flags to simplify command routing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@uglide
Add commands flags based on static map
91bb8b1
@uglide
uglide requested a review from Copilot October 20, 2025 10:42
Copilot AI reviewed Oct 20, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a command flags feature to the Jedis library by adding a static registry that maps Redis command names to their flags. The implementation retrieves command metadata from a Redis server and automatically generates flag mappings.

  • Adds a code generator that connects to Redis servers to extract command metadata and generate flag mappings
  • Implements a static command flags registry in CommandObject.java with comprehensive command coverage
  • Provides a getFlags() method for runtime flag lookup with optimized memory usage through shared EnumSet instances

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/test/java/redis/clients/jedis/codegen/README.md Documentation for the command flags registry generator tool
src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java Code generator that retrieves Redis command metadata and updates the static registry
src/main/java/redis/clients/jedis/CommandObject.java Core implementation with CommandFlag enum, static registry, and getFlags() method
pom.xml Maven configuration to exclude code generators from test execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/redis/clients/jedis/CommandObject.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

uglide added 2 commits October 20, 2025 12:59
@uglide
Clean up CommandFlagsRegistryGenerator
a70d8c9
@uglide
more fixes to CommandFlagsRegistryGenerator
51c62d5
@uglide
uglide force-pushed the im/introduce-command-flags branch from e8157fa to 51c62d5 Compare October 20, 2025 10:59
@uglide uglide mentioned this pull request Oct 20, 2025
Align Search APIs and behaviour with Redis 8.0+ #4173
Merged
@uglide
Merge branch 'master' into im/introduce-command-flags
b96f9f7
@github-actions

github-actions Bot commented Oct 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Test Results

   281 files  +1    281 suites  +1   11m 41s ⏱️ -6s
10 197 tests +9  9 132 ✅  - 591  1 065 💤 +600  0 ❌ ±0 
 2 712 runs  +9  2 712 ✅ +  9      0 💤 ±  0  0 ❌ ±0 

Results for commit fdf00b5. ± Comparison against base commit 4776709.

This pull request skips 600 tests.
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHgetdel
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHgetdelBinary
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHgetex
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHgetexBinary
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHsetex
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[1] ‑ testHsetexBinary
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[2] ‑ testHgetdel
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[2] ‑ testHgetdelBinary
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[2] ‑ testHgetex
redis.clients.jedis.commands.commandobjects.CommandObjectsHashCommandsTest[2] ‑ testHgetexBinary
…

♻️ This comment has been updated with latest results.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ggivo
ggivo reviewed Oct 20, 2025
View reviewed changes

@ggivo ggivo left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good.

For better traceability, I would suggest placing the generated code in a dedicated file.
Additionally, wrapping command metadata in in an interface (CommandMetadataRegistry.getFlag()) and providing it as an configurabel instance within CommandObject would be beneficial. The auto-generated registry can serve as the default, but users could replace it with a custom implementation if needed — for example, dynamically loading it from the server or providing a user-defined version.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

uglide reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
atakavci
atakavci reviewed Oct 20, 2025
View reviewed changes

@atakavci atakavci left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Adding the version of server - the generator running against- as part of generated content would be nice as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

uglide reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread src/main/java/redis/clients/jedis/CommandObject.java Outdated

public class CommandObject<T> {

/**

@atakavci atakavci Oct 20, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lets not do this and put everything into a seperate completely auto-generate class like CommandFlagRegistry or some provider class,, and use generated content at once without need of regex or any other searching/parsing. Then just consume it from CommandObject as needed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

uglide reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@uglide uglide Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
uglide and others added 3 commits October 24, 2025 17:08
@uglide
Introduce CommandFlagsRegistry interface
acb6cfd
- Add new interface and move CommandFlag enum there
- Generate StaticCommandFlagsRegistry instead of embedding generated code into CommandObject
- Allow passing custom CommandFlagsRegistry to ClusterClientBuilder
@uglide
Fix formatting
6b0efcc
@uglide
Merge branch 'master' into im/introduce-command-flags
879cb0b
ggivo
ggivo reviewed Oct 29, 2025
View reviewed changes
Comment thread src/main/java/redis/clients/jedis/StaticCommandFlagsRegistry.java Outdated
Comment on lines +920 to +924
public EnumSet<CommandFlag> getFlags(ProtocolCommand cmd) {
byte[] raw = cmd.getRaw();
String commandName = SafeEncoder.encode(raw).toUpperCase();
return COMMAND_FLAGS_REGISTRY.getOrDefault(commandName, EMPTY_FLAGS);
}

@ggivo ggivo Oct 29, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This does not seem to work for subcommands like "CLUSTER INFO", "CONFIG GET" ...
In this case, ProtocolCommand is actually only "CLUSTER"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@uglide uglide Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I've addressed this problem. See my latest commit ff09e22

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
uglide and others added 7 commits November 3, 2025 09:48
@uglide
Add support for sub-commands
ff09e22
@uglide
Merge remote-tracking branch 'origin/im/introduce-command-flags' into…
bd77e1d
… im/introduce-command-flags
@uglide
Use CommandArguments in the interface and hierarchical approach in st…
09d63d5
…atic registry
@uglide
Expose get() on CommandArguments for cleaner code
5d37c0d
@uglide
Merge branch 'master' into im/introduce-command-flags
946f02a
@uglide
Use byte array based look up to improve performance
8646d1e
@uglide
Merge remote-tracking branch 'origin/im/introduce-command-flags' into…
c7672dc
… im/introduce-command-flags
@ggivo

ggivo commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator

@uglide
I suggest also separating generated code (populating the StaticRegistry) from actual implmenattion so it is easier for maintaining in future
You can check PR with proposal against your branch here : : #4345

uglide reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ggivo and others added 3 commits November 5, 2025 09:56
@ggivo
(clean up) Separate generated command flags registry initialisation f…
bb7bb39
…rom actual implementation (#4345)

* (clean up) Extract generated registry initialization

* regenerate after clean up

* reformat
@uglide
Clean up StaticCommandFlagsRegistry
2a0ee21
@uglide
Merge branch 'master' into im/introduce-command-flags
fdf00b5
@uglide
uglide merged commit dea46c5 into master Nov 5, 2025
@uglide
uglide deleted the im/introduce-command-flags branch November 5, 2025 10:09
ggivo
ggivo reviewed Nov 5, 2025
View reviewed changes

@ggivo ggivo left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ggivo ggivo changed the title Add commands flags based on static map Adding a registry that maps command names to their flags Nov 20, 2025
@ggivo ggivo added this to the 7.1.0 milestone Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@atakavci atakavci atakavci left review comments
@ggivo ggivo ggivo left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

7.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@uglide @ggivo @atakavci
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.