Skip to content

[ISSUE #6343]✨Organize and standardize the SubCommands and Commands in rocketmq-admin-core#6345

Merged
mxsm merged 1 commit intomxsm:mainfrom
WaterWhisperer:enhance-6343
Feb 16, 2026
Merged

[ISSUE #6343]✨Organize and standardize the SubCommands and Commands in rocketmq-admin-core#6345
mxsm merged 1 commit intomxsm:mainfrom
WaterWhisperer:enhance-6343

Conversation

@WaterWhisperer
Copy link
Contributor

@WaterWhisperer WaterWhisperer commented Feb 16, 2026

Which Issue(s) This PR Fixes(Closes)

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • Refactor
    • Restructured command architecture across auth, broker, consumer, controller, namesrv, and topic commands for improved consistency.
    • Standardized command variant naming conventions and simplified public API signatures.
    • Reorganized subcommand module structure and imports throughout the admin tool.

@rocketmq-rust-bot
Copy link
Collaborator

🔊@WaterWhisperer 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Walkthrough

The PR standardizes command structures across the rocketmq-admin-core module by consistently renaming command types to follow a "SubCommand" convention and refactoring enum variant names to use more concise, direct names while simplifying import paths from fully-qualified module references to direct type imports.

Changes

Cohort / File(s) Summary
Auth Commands Refactoring
commands/auth_commands.rs
Renamed all twelve auth subcommand types with explicit public imports; refactored AuthCommands enum variants to use concrete subcommand types (e.g., GetAcl(GetAclSubCommand)) instead of nested module paths; added new ListUsers variant.
Broker Commands Standardization
commands/broker_commands.rs, commands/broker_commands/clean_unused_topic_sub_command.rs, commands/broker_commands/delete_expired_commit_log_sub_command.rs, commands/broker_commands/send_msg_status_sub_command.rs
Renamed command types to SubCommand variants across four broker subcommands (e.g., CleanUnusedTopicCommandCleanUnusedTopicSubCommand); updated enum variant signatures and dispatch logic to reflect new type names.
Consumer Commands Reorganization
commands/consumer_commands.rs
Renamed seven ConsumerCommands enum variants for clarity (e.g., ConsumerStatusSubCommandConsumerStatus, DeleteSubGroupDeleteSubscriptionGroup); rearranged variant mapping to new subcommand types; updated match arms accordingly.
Controller Commands Refactoring
commands/controller_commands.rs, commands/controller_commands/clean_broker_metadata_sub_command.rs
Simplified four controller enum variants to direct names (e.g., GetControllerConfigSubCommandGetControllerConfig); renamed CleanBrokerMetadataCommand to CleanBrokerMetadataSubCommand and removed tests module; updated imports and dispatch logic.
Nameserver Commands Standardization
commands/namesrv_commands.rs, commands/namesrv_commands/delete_kv_config_sub_command.rs, commands/namesrv_commands/get_namesrv_config_sub_command.rs, commands/namesrv_commands/update_kv_config_sub_command.rs, commands/namesrv_commands/update_namesrv_config_sub_command.rs
Renamed six nameserver command modules and subcommand types (e.g., DeleteKvConfigCommandDeleteKvConfigSubCommand); refactored enum variants to use concise names (e.g., DeleteKvConfigCommandDeleteKvConfig); updated error messages and imports.
Topic Commands Reorganization
commands/topic_commands.rs, commands/topic_commands/update_order_conf_sub_command.rs
Renamed update_order_conf_command module to update_order_conf_sub_command; simplified enum variant imports from fully-qualified paths to direct types; renamed TopicClusterList to TopicCluster; added new UpdateTopicList variant; refactored all twelve topic subcommand variant signatures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Whiskers twitch with glee
Commands renamed with consistency,
SubCommand names flow clean,
Variants streamlined, keen!
Organization dreams come true,
RocketMQ admin shines anew! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

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.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (7 files):

⚔️ rocketmq-example/Cargo.toml (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/auth_commands.rs (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/broker_commands.rs (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/consumer_commands.rs (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/controller_commands.rs (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/namesrv_commands.rs (content)
⚔️ rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/topic_commands.rs (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title '[ISSUE #6343]✨Organize and standardize the SubCommands and Commands in rocketmq-admin-core' accurately describes the primary change: standardizing command and subcommand naming conventions across modules.
Linked Issues check ✅ Passed The PR implements standardization of SubCommand naming conventions across auth, broker, consumer, controller, namesrv, and topic commands modules, addressing the organizational enhancement goal stated in issue #6343.
Out of Scope Changes check ✅ Passed All changes are focused on standardizing command and subcommand types across modules. Test removal in clean_broker_metadata_sub_command.rs is a structural change aligned with the refactoring, not out-of-scope.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch enhance-6343
  • Post resolved changes as copyable diffs in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/broker_commands/send_msg_status_sub_command.rs (1)

91-91: ⚠️ Potential issue | 🟡 Minor

Inconsistent error message: still references the old name.

Line 91 still uses "SendMsgStatusCommand: Failed to start producer" while lines 99 and 118 were updated to "SendMsgStatusSubCommand". This should be updated for consistency.

Proposed fix
-            .map_err(|e| RocketMQError::Internal(format!("SendMsgStatusCommand: Failed to start producer: {}", e)))?;
+            .map_err(|e| RocketMQError::Internal(format!("SendMsgStatusSubCommand: Failed to start producer: {}", e)))?;
🧹 Nitpick comments (4)
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/auth_commands.rs (1)

56-61: Minor naming inconsistency: CLI name "copyUser" (singular) vs variant CopyUsers (plural).

The command name exposed to users is copyUser (singular) but the enum variant and type use plural CopyUsers/CopyUsersSubCommand. Other commands like listUsers (line 113) are consistently plural. Consider aligning the CLI name to "copyUsers" for consistency, or renaming the variant — unless the singular form is intentional to match an upstream Java convention.

rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/consumer_commands.rs (1)

92-98: Nit: Inconsistent match arm variable naming.

Lines 92–97 bind the inner value as cmd, but Line 98 uses value. Pick one name consistently across all arms.

Suggested fix
-            ConsumerCommands::UpdateSubGroup(value) => value.execute(rpc_hook).await,
+            ConsumerCommands::UpdateSubGroup(cmd) => cmd.execute(rpc_hook).await,
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/controller_commands.rs (1)

64-70: Nit: Inconsistent match arm variable naming.

Line 66 binds as cmd while Lines 67–69 use value.

Suggested fix — use `cmd` everywhere
-            ControllerCommands::GetControllerConfig(value) => value.execute(rpc_hook).await,
-            ControllerCommands::GetControllerMetadata(value) => value.execute(rpc_hook).await,
-            ControllerCommands::UpdateControllerConfig(value) => value.execute(rpc_hook).await,
+            ControllerCommands::GetControllerConfig(cmd) => cmd.execute(rpc_hook).await,
+            ControllerCommands::GetControllerMetadata(cmd) => cmd.execute(rpc_hook).await,
+            ControllerCommands::UpdateControllerConfig(cmd) => cmd.execute(rpc_hook).await,
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/broker_commands.rs (1)

99-111: Nit: Inconsistent match arm variable naming.

Line 105 binds as cmd while all other arms use value.

Suggested fix
-            BrokerCommands::GetBrokerConfig(cmd) => cmd.execute(rpc_hook).await,
+            BrokerCommands::GetBrokerConfig(value) => value.execute(rpc_hook).await,

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.44%. Comparing base (ec31dd9) to head (c5ad2dc).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...esrv_commands/update_namesrv_config_sub_command.rs 0.00% 7 Missing ⚠️
...ketmq-admin-core/src/commands/consumer_commands.rs 0.00% 5 Missing ⚠️
...ller_commands/clean_broker_metadata_sub_command.rs 0.00% 5 Missing ⚠️
...tmq-admin-core/src/commands/controller_commands.rs 0.00% 3 Missing ⚠️
...cketmq-admin-core/src/commands/namesrv_commands.rs 0.00% 3 Missing ⚠️
.../broker_commands/clean_unused_topic_sub_command.rs 0.00% 2 Missing ⚠️
..._commands/delete_expired_commit_log_sub_command.rs 0.00% 2 Missing ⚠️
...nds/broker_commands/send_msg_status_sub_command.rs 0.00% 2 Missing ⚠️
...s/namesrv_commands/delete_kv_config_sub_command.rs 0.00% 2 Missing ⚠️
...s/namesrv_commands/update_kv_config_sub_command.rs 0.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6345      +/-   ##
==========================================
- Coverage   42.47%   42.44%   -0.04%     
==========================================
  Files         917      917              
  Lines      128641   128579      -62     
==========================================
- Hits        54645    54574      -71     
- Misses      73996    74005       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

@WaterWhisperer LGTM, 感谢你对RocketMQ-Rust项目的持续贡献,今天除夕祝你和你的家人马年身体健康万事如意。马到成功。

@mxsm mxsm merged commit 1f8ec58 into mxsm:main Feb 16, 2026
9 of 20 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Feb 16, 2026
@WaterWhisperer WaterWhisperer deleted the enhance-6343 branch February 16, 2026 06:10
@WaterWhisperer
Copy link
Contributor Author

@WaterWhisperer LGTM, 感谢你对RocketMQ-Rust项目的持续贡献,今天除夕祝你和你的家人马年身体健康万事如意。马到成功。

@mxsm 谢谢,也祝您除夕快乐!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement✨] Organize and standardize the SubCommands and Commands in rocketmq-admin-core

4 participants