Skip to content

Go: Update error info - #16619

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
JinHai-CN:fix518
Jul 3, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
JinHai-CN:fix518

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

As title.

Signed-off-by: Jin Hai <[email protected]>
@JinHai-CN JinHai-CN added the ci Continue Integration label Jul 3, 2026
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 3, 2026 10:34
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR modifies internal/admin/enterprise_service.go to change the returned error messages across most enterprise-admin service methods from "implemented in enterprise edition" to "not supported," affecting role, model/provider, system license, user/account, and ingestion task endpoints. Function signatures are unchanged.

Changes

Enterprise Service Not-Supported Conversion

Layer / File(s) Summary
Role, resource, and model/provider listing endpoints
internal/admin/enterprise_service.go
Role management, resource/permission, and model/provider/instance listing/show/check endpoints now return "not supported" instead of enterprise-edition messaging.
Provider/model alteration and instance enablement
internal/admin/enterprise_service.go
AlterProviderInstance, AddModelInstance, DeleteModelInstances, ListInstanceModels, EnableOrDisableModel switched to "not supported" responses.
Model add/delete and system license/fingerprint
internal/admin/enterprise_service.go
AddModels, DeleteModels, GetSystemFingerprint, SetSystemLicense, ShowSystemLicense, UpdateSystemLicenseConfig now return "not supported" errors, with SetSystemLicense returning a Go error.
User activity, summary, and role/permission endpoints
internal/admin/enterprise_service.go
ShowUserActivity, ShowUserDatasetSummary, ShowUserSummary, ShowUserStorage, ShowUserQuota, ShowUserIndex, UpdateUserRole, ShowUserPermission, ListUser* methods, ShowUsersSummary, and ShowUsersActivity now return "not supported."
Users reports, analytics, and data-ingestion summary
internal/admin/enterprise_service.go
ListUsersReports, ListUsersStorage, ListUsersDocuments, ListUsersIndex, ListUsersQuota, plan/quota summaries, ingestion task summary, and data orphan/storage/purge endpoints now return "not supported."
Purge and API-key endpoints
internal/admin/enterprise_service.go
PurgeUserData, PurgeUsersData, GenerateUserAPIKey, DeleteUserAPIKey, ListUserAPIKeys now return "not supported" errors.
Ingestion-task-by-condition endpoints
internal/admin/enterprise_service.go
ListIngestionTasksByCondition, StopIngestionTasksByCondition, RemoveIngestionTasksByCondition now return "not supported," preserving existing validation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • infiniflow/ragflow#16272: Modifies the same internal/admin/enterprise_service.go model/provider listing methods, directly interacting with handler/router changes affected by this PR.

Poem

A rabbit hopped through code so neat,
Turned "enterprise" stubs to "not supported," complete.
No more pretend features, just honest replies,
Every endpoint now speaks true, no more disguise. 🐰
Thump thump — the refactor's done, clean and discrete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only says 'As title' and omits the required summary and background context. Add a Summary section describing the PR goal, background, and the specific behavior or areas changed.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title is related to the change, but it is broad and does not name the main enterprise-service error behavior update.

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 draft July 3, 2026 10:37
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 3, 2026 10:37

@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.

Caution

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

⚠️ Outside diff range comments (2)
internal/admin/enterprise_service.go (2)

1058-1070: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not echo the API key in delete responses.

DeleteUserAPIKey includes the raw key value in the response map even though the operation is unsupported. Avoid reflecting secrets in API payloads.

Proposed fix
 	result := map[string]interface{}{
 		"command":  "delete_user_api_key",
 		"email":    user.Email,
 		"nickname": user.Nickname,
-		"api_key":  key,
-		"error":    "'Delete user API key' is not supported",
+		"error":    "'delete user API key' is not supported",
 	}
🤖 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/admin/enterprise_service.go` around lines 1058 - 1070,
DeleteUserAPIKey is echoing the raw API key in its response payload, which
should be removed. Update the result map built in Service.DeleteUserAPIKey so it
no longer includes the key field, while keeping the existing command, email,
nickname, and error values unchanged. Keep the unsupported-operation behavior
intact and ensure no secret values are reflected in the returned map.

257-265: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not echo newAPIKey in the unsupported response.

AlterProviderInstance receives req.APIKey from the handler and returns it as new_api_key, so a failed/unsupported admin call can expose the provider secret back through the API response. Remove the field or return only a masked/boolean indicator.

Proposed fix
 	return map[string]interface{}{
 		"command":           "alter_provider_instance",
 		"user_id":           userID,
 		"provider_id":       providerName,
 		"instance_name":     instanceName,
 		"new_instance_name": newInstanceName,
-		"new_api_key":       newAPIKey,
 		"error":             "'alter provider instance' is not supported",
 	}, nil
🤖 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/admin/enterprise_service.go` around lines 257 - 265, The unsupported
response from AlterProviderInstance is echoing the sensitive newAPIKey value
back to the caller. Update the Service.AlterProviderInstance return payload to
remove the new_api_key field entirely or replace it with a non-sensitive
indicator (for example, a boolean or masked value), and keep the rest of the
command metadata unchanged.
🧹 Nitpick comments (1)
internal/admin/enterprise_service.go (1)

829-829: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Normalize the unsupported message casing.

Earlier messages use lowercase command text ('list roles' is not supported), but these use leading capitals ('List users reports'...). Since this PR updates user-facing error strings, keep the format consistent.

Also applies to: 843-843, 857-857, 871-871, 901-901, 912-912, 923-923, 934-934, 945-945, 956-956, 967-967, 978-978, 990-990, 1009-1009, 1033-1033, 1051-1051, 1089-1089, 1104-1104, 1126-1126, 1148-1148

🤖 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/admin/enterprise_service.go` at line 829, Normalize the user-facing
unsupported error strings in enterprise_service.go so they match the existing
lowercase command-text style used elsewhere, such as the messages built in the
related report/list helper branches; update the string literals returned for the
affected unsupported cases (including the one in the List Users Reports path and
the other referenced branches) to use lowercase command names consistently.
🤖 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.

Outside diff comments:
In `@internal/admin/enterprise_service.go`:
- Around line 1058-1070: DeleteUserAPIKey is echoing the raw API key in its
response payload, which should be removed. Update the result map built in
Service.DeleteUserAPIKey so it no longer includes the key field, while keeping
the existing command, email, nickname, and error values unchanged. Keep the
unsupported-operation behavior intact and ensure no secret values are reflected
in the returned map.
- Around line 257-265: The unsupported response from AlterProviderInstance is
echoing the sensitive newAPIKey value back to the caller. Update the
Service.AlterProviderInstance return payload to remove the new_api_key field
entirely or replace it with a non-sensitive indicator (for example, a boolean or
masked value), and keep the rest of the command metadata unchanged.

---

Nitpick comments:
In `@internal/admin/enterprise_service.go`:
- Line 829: Normalize the user-facing unsupported error strings in
enterprise_service.go so they match the existing lowercase command-text style
used elsewhere, such as the messages built in the related report/list helper
branches; update the string literals returned for the affected unsupported cases
(including the one in the List Users Reports path and the other referenced
branches) to use lowercase command names consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e005332a-b460-4cc8-89dd-740518fc36dd

📥 Commits

Reviewing files that changed from the base of the PR and between 83d09b1 and fbae404.

📒 Files selected for processing (1)
  • internal/admin/enterprise_service.go

@JinHai-CN
JinHai-CN merged commit 6b57169 into infiniflow:main Jul 3, 2026
12 of 15 checks passed
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 3, 2026
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant