Skip to content

Go: refactor API route for EE - #17093

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
JinHai-CN:fix565
Jul 20, 2026
Merged

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

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

Summary

As title.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Enterprise protected and unauthenticated routes are centralized in EE router helpers. The admin router retains model and ingestion-task routes, while RegisterEERouter and RegisterEENoAuthRouter register broader EE endpoint groups.

Changes

Enterprise routing

Layer / File(s) Summary
Protected admin route placement
internal/admin/router.go
Registers model-listing and ingestion-task endpoints in the protected admin route group.
EE protected route wiring
internal/admin/router_ee.go
Adds mappings for EE role, provider, licensing, statistics, credential, sensitive-word, verification-email, and white-list endpoints.
EE unauthenticated route wiring
internal/router/router.go, internal/router/router_ee.go
Replaces inline EE no-auth routes with RegisterEENoAuthRouter, which registers OAuth, Azure, captcha, and OTP endpoints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: size:L

Poem

A bunny wired routes in a neat little row,
Through guarded paths where admin hops go.
OAuth and OTP found homes by the gate,
While models and tasks joined the protected state.
“Centralized!” cried Rabbit, and nibbled a byte.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description only says "As title" and lacks the required summary details and background context. Add a brief Summary that explains what EE route refactor was needed and the problem or context it addresses.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: refactoring API routes for EE support.
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 July 20, 2026 06:27
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 20, 2026
@JinHai-CN JinHai-CN added ci Continue Integration and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 20, 2026

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

🧹 Nitpick comments (1)
internal/admin/router_ee.go (1)

121-125: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove commented-out Go code.

As per coding guidelines, commented-out Go code should be removed.

♻️ Proposed refactor
 	protected.GET("/users/:username/tokens", r.handler.ListUserAPITokens)
-	//protected.POST("/users/:username/keys", r.handler.GenerateUserAPIToken)
 	protected.POST("/users/:username/tokens", r.handler.GenerateUserAPIToken)
 	protected.DELETE("/users/:username/tokens/:token", r.handler.DeleteUserAPIToken)
🤖 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/router_ee.go` around lines 121 - 125, Remove the commented-out
protected.POST route for “/users/:username/keys” from the router registration
near ListUserAPITokens, leaving the active token routes unchanged.

Source: Coding guidelines

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

Nitpick comments:
In `@internal/admin/router_ee.go`:
- Around line 121-125: Remove the commented-out protected.POST route for
“/users/:username/keys” from the router registration near ListUserAPITokens,
leaving the active token routes unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f79821c0-2a74-497b-8445-03559819e2ed

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad27ad and 1cac0fc.

📒 Files selected for processing (4)
  • internal/admin/router.go
  • internal/admin/router_ee.go
  • internal/router/router.go
  • internal/router/router_ee.go
💤 Files with no reviewable changes (1)
  • internal/admin/router.go

@JinHai-CN
JinHai-CN merged commit 6b8a76c into infiniflow:main Jul 20, 2026
9 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant