Repository navigation
Go CLI: add show users plan summary - #16463
Conversation
Signed-off-by: Jin Hai <[email protected]>
📝 WalkthroughWalkthroughAdds a new admin CLI command ChangesUsers Plan Summary Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
internal/admin/enterprise_handler.gointernal/admin/enterprise_service.gointernal/admin/router.gointernal/cli/admin_command.gointernal/cli/admin_parser.gointernal/cli/cli_http.go
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get users activity: %w", err) |
There was a problem hiding this comment.
📐 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.
| 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
### 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]>
Summary