Skip to content

Conversation

@uglide
Copy link
Contributor

@uglide uglide commented Oct 20, 2025

Introduces command flags to simplify command routing.

@uglide uglide requested a review from Copilot October 20, 2025 10:42
Copy link
Contributor

Copilot AI left a 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.

@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Test Results

   280 files  ±0    280 suites  ±0   11m 35s ⏱️ +10s
10 188 tests ±0  9 123 ✅ ±0  1 065 💤 ±0  0 ❌ ±0 
 2 703 runs  ±0  2 703 ✅ ±0      0 💤 ±0  0 ❌ ±0 

Results for commit 879cb0b. ± Comparison against base commit e7bf717.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@ggivo ggivo left a 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.

Copy link
Contributor

@atakavci atakavci left a 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.


public class CommandObject<T> {

/**
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

uglide and others added 3 commits October 24, 2025 17:08
- Add new interface and move CommandFlag enum there
- Generate StaticCommandFlagsRegistry instead of embedding generated code into CommandObject
- Allow passing custom CommandFlagsRegistry to ClusterClientBuilder
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.

3 participants