Skip to content

Go CLI: add show users plan summary - #16463

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
JinHai-CN:fix510
Jun 29, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
JinHai-CN:fix510

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

Summary

RAGFlow(admin)> show users plan summary;
+---------+----------------------------------------------------------------+
| field   | value                                                          |
+---------+----------------------------------------------------------------+
| command | show_users_plan_summary                                        |
| error   | 'Show users plan summary' is implemented in enterprise edition |
+---------+----------------------------------------------------------------+

@JinHai-CN JinHai-CN added the ci Continue Integration label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new admin CLI command SHOW USERS PLAN SUMMARY and a corresponding HTTP endpoint GET /api/v1/admin/users/plan/summary. The parser, CLI executor, HTTP handler, service method, and router are all wired together; the service implementation is a placeholder returning an enterprise-edition notice.

Changes

Users Plan Summary Feature

Layer / File(s) Summary
CLI parser and dispatch
internal/cli/admin_parser.go, internal/cli/cli_http.go, internal/cli/admin_command.go
Parser gains a PLAN branch in parseAdminShowUsersCommands and a new parseAdminShowUsersPlan function; dispatch switch routes admin_show_users_plan_command to AdminShowUsersPlanCommand; the command method sends GET to /admin/users/plan/summary and validates the response.
HTTP route, handler, and service
internal/admin/router.go, internal/admin/enterprise_handler.go, internal/admin/enterprise_service.go
Registers GET /users/plan/summary route; handler maps ErrUserNotFound to 404 and other errors to 500; service method returns a placeholder map indicating enterprise-edition implementation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hippity-hop, a new plan in sight,
SHOW USERS PLAN SUMMARY, what a delight!
The parser now listens for PLAN then SUMMARY,
The handler responds, all tidy and merry.
Enterprise edition glimmers ahead —
This rabbit's got features still waiting to spread! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a show users plan summary command to the Go CLI.
Description check ✅ Passed The description includes the required Summary section and a useful example of the new command's output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@JinHai-CN
JinHai-CN marked this pull request as ready for review June 29, 2026 12:57
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 29, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft June 29, 2026 12:57
@JinHai-CN
JinHai-CN marked this pull request as ready for review June 29, 2026 12:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/cli/admin_command.go`:
- Around line 2295-2296: The error text in the new command still uses the copied
“failed to get users activity” message, which points operators to the wrong
operation when this request fails. Update the fmt.Errorf message in the admin
command’s error handling to match the actual action performed by this handler,
using the surrounding command/function name to locate the correct
request-specific wording.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1af3ad24-3c9b-4498-bf66-43aa8f7ed1fe

📥 Commits

Reviewing files that changed from the base of the PR and between 1c0cdd8 and 9296d9e.

📒 Files selected for processing (6)
  • internal/admin/enterprise_handler.go
  • internal/admin/enterprise_service.go
  • internal/admin/router.go
  • internal/cli/admin_command.go
  • internal/cli/admin_parser.go
  • internal/cli/cli_http.go

Comment on lines +2295 to +2296
if err != nil {
return nil, fmt.Errorf("failed to get users activity: %w", err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the copied request error text.

Line 2296 still reports "failed to get users activity", so a network or server failure on this new command will point operators at the wrong endpoint.

Suggested fix
 	resp, err := c.AdminServerClient.Request("GET", apiURL, "admin", nil, nil)
 	if err != nil {
-		return nil, fmt.Errorf("failed to get users activity: %w", err)
+		return nil, fmt.Errorf("failed to get users plan: %w", err)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if err != nil {
return nil, fmt.Errorf("failed to get users activity: %w", err)
if err != nil {
return nil, fmt.Errorf("failed to get users plan: %w", err)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/admin_command.go` around lines 2295 - 2296, The error text in
the new command still uses the copied “failed to get users activity” message,
which points operators to the wrong operation when this request fails. Update
the fmt.Errorf message in the admin command’s error handling to match the actual
action performed by this handler, using the surrounding command/function name to
locate the correct request-specific wording.

@codecov

codecov Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (c0f6429) to head (2ba9c60).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16463   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 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.

@JinHai-CN
JinHai-CN merged commit 6370fce into infiniflow:main Jun 29, 2026
3 checks passed
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 1, 2026
### Summary

```
RAGFlow(admin)> show users plan summary;
+---------+----------------------------------------------------------------+
| field   | value                                                          |
+---------+----------------------------------------------------------------+
| command | show_users_plan_summary                                        |
| error   | 'Show users plan summary' is implemented in enterprise edition |
+---------+----------------------------------------------------------------+
```

Signed-off-by: Jin Hai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant