Skip to content

feat(commands): Introduce subcommand as a first-class command abstraction#3558

Open
geetanshjuneja wants to merge 1 commit into
apache:unstablefrom
geetanshjuneja:feature/subcommand-framework
Open

feat(commands): Introduce subcommand as a first-class command abstraction#3558
geetanshjuneja wants to merge 1 commit into
apache:unstablefrom
geetanshjuneja:feature/subcommand-framework

Conversation

@geetanshjuneja

@geetanshjuneja geetanshjuneja commented Jul 13, 2026

Copy link
Copy Markdown

Description

This PR adds a subcommand registration framework as well resolution of command to the correct subcommand. This PR contains all the changes of #3413 while addressing some reviewer comments in it.
Following changes are included in this PR:

  • MakeSubCmdAttr() is used to register subcommand metadata, such as arity, flags, key specs, and category.
  • Command registration flow now also register the subcommand in a dedicated map which is used to lookup subcommand during command resolution.
  • Updated command creation paths in client, lua command invocation, command get keys.
  • Added a reference implementation for NAMESPACE subcommands without changing its existing behaviour.
  • Added C++ units tests for root command resolution, registered subcommand resolution, unknown subcommand fallback, arity checks, key range extraction, and renamed root command behavior.
  • Added Go integration tests for command getkeys, namespace root command and subcommands.

AI disclosure
Used AI to add namspace subcommand integration tests in tests/gocase/unit/namespace/namespace_test.go.

@geetanshjuneja geetanshjuneja force-pushed the feature/subcommand-framework branch from 41b025b to f2168ea Compare July 13, 2026 08:47
@jihuayu

jihuayu commented Jul 14, 2026

Copy link
Copy Markdown
Member

Hello @geetanshjuneja. Thanks for your contribution. If you used an LLM, please follow our guidelines for AI-assisted contributions: https://kvrocks.apache.org/community/contributing#guidelines-for-ai-assisted-contributions
This does not mean that using an LLM is prohibited. It simply helps us assess the reliability of the code.
I would like the PR description to reflect your own understanding and reasoning, rather than being filled with LLM-generated content.

@geetanshjuneja

Copy link
Copy Markdown
Author

Hi @jihuayu, updated the description. Changes in this PR are exactly same as your PR, once this is merged I can continue refactoring other subcommands.

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