Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds many new DTO types, an OpenAPI-aware dto.Router for registering Gin routes with go-fuego metadata, OpenAPI engine/spec cleanup and Scalar UI wiring, updates API router initialization to accept an optional fuego engine and re-registers routes using dto.NewRouter, and bumps toolchain and dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Gin as Gin Router
participant DTO as dto.Router
participant Fuego as fuego.Engine
participant Spec as OpenAPI Spec/UI
Dev->>Gin: call SetApiRouter(router, engine)
Gin->>DTO: NewRouter(group, engine, tag, security)
DTO->>Gin: register route handlers (fuegogin.*Gin / Gin handlers)
alt engine != nil
DTO->>Fuego: attach OpenAPI options (GinResp/GinBody, operationId, security)
Fuego->>Spec: generate and expose spec (/openapi.json, /swagger)
Spec->>Dev: Scalar UI served for docs
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
🧹 Nitpick comments (4)
dto/topup_creem.go (1)
11-69: Consider extracting webhook sub-objects into named DTO types.
CreemWebhookEventis quite deeply nested with anonymous structs, which makes reuse and focused tests harder. Splittingobject/order/product/customerinto named types would improve maintainability without behavior changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/topup_creem.go` around lines 11 - 69, The CreemWebhookEvent struct currently embeds deep anonymous structs (Object, Order, Product, Customer) which hampers reuse and testing; refactor by extracting those anonymous sub-objects into separate named DTO types (e.g., CreemObject, CreemOrder, CreemProduct, CreemCustomer) and replace the inline definitions in CreemWebhookEvent with fields of those new types (preserving JSON tags and field names like Object, Order, Product, Customer); update any constructors, unmarshalling or test code to use the new types and run gofmt/golangci-lint to ensure no other references break.dto/user.go (1)
23-37: Consider using pointer types for optional bool fields in settings update.
AcceptUnsetModelRatioModel(line 35) andRecordIpLog(line 36) are non-pointer bools withoutomitempty. When a client omits these fields in the JSON request, they'll default tofalse, potentially overwriting existing user settings unintentionally.If these fields should only update when explicitly provided, consider using
*boolwithomitempty(as done forUpstreamModelUpdateNotifyEnabledon line 34).♻️ Suggested change
- AcceptUnsetModelRatioModel bool `json:"accept_unset_model_ratio_model"` - RecordIpLog bool `json:"record_ip_log"` + AcceptUnsetModelRatioModel *bool `json:"accept_unset_model_ratio_model,omitempty"` + RecordIpLog *bool `json:"record_ip_log,omitempty"`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/user.go` around lines 23 - 37, Update UpdateUserSettingRequest so the two optional bool fields AcceptUnsetModelRatioModel and RecordIpLog are pointers with `omitempty` in their json tags (mirroring UpstreamModelUpdateNotifyEnabled) so omitted fields don't default to false and overwrite existing settings; then update any code that reads these fields (handlers/validators) to handle nil vs true/false (dereference safely and treat nil as "not provided").dto/api_responses.go (2)
98-103: Extract the nested error payload into a named type.The anonymous struct under
RelayNotImplementedError.Errorworks, but a named type is easier to reuse and yields cleaner schema components.🧩 Suggested small refactor
+type RelayErrorBody struct { + Message string `json:"message"` + Type string `json:"type"` +} + type RelayNotImplementedError struct { - Error struct { - Message string `json:"message"` - Type string `json:"type"` - } `json:"error"` + Error RelayErrorBody `json:"error"` }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/api_responses.go` around lines 98 - 103, Replace the anonymous nested struct in RelayNotImplementedError.Error with a named type (e.g., RelayErrorPayload) so the payload can be reused and appears as a proper schema component; define the new struct with the same fields and json tags (Message string `json:"message"`, Type string `json:"type"`), change RelayNotImplementedError to use Error RelayErrorPayload `json:"error"`, and update any other references to the anonymous type to use RelayErrorPayload.
48-60: Avoid broadanyin OpenAPI-facing response DTOs.Using
anyin documentation structs makes generated schemas too loose (object/unknown), which weakens API discoverability for consumers. Prefer concrete structs (or at leastmap[string]any/[]map[string]anyfor object collections) where shape is known.♻️ Example direction (typed or semi-typed replacements)
type AnthropicModelList struct { - Data any `json:"data"` + Data []map[string]any `json:"data"` FirstID string `json:"first_id"` HasMore bool `json:"has_more"` LastID string `json:"last_id"` } type GeminiModelList struct { - Models any `json:"models"` - NextPageToken any `json:"nextPageToken"` + Models []map[string]any `json:"models"` + NextPageToken string `json:"nextPageToken,omitempty"` } type CompletionResponse struct { ID string `json:"id"` Object string `json:"object"` Created int64 `json:"created"` Model string `json:"model"` - Choices []any `json:"choices"` + Choices []map[string]any `json:"choices"` Usage CompletionUsage `json:"usage"` }Also applies to: 71-80, 137-186, 190-194
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/api_responses.go` around lines 48 - 60, The DTOs AnthropicModelList and GeminiModelList use broad any types which produce weak OpenAPI schemas; update these structs by replacing any with concrete types or at minimum structured container types (e.g., for AnthropicModelList.Data use []map[string]any or a defined ModelSummary struct instead of any, and for GeminiModelList.Models use []map[string]any or a concrete list item type; also change NextPageToken to string/null-able string if appropriate) and apply the same pattern to other DTOs flagged in the review so generated schemas are explicit and discoverable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@router/openapi.go`:
- Around line 34-39: The current loop over spec.Paths.Map() and
pathItem.Operations() uses strings.Index to find marker ("---\n\n") anywhere in
op.Description which can truncate legitimate markdown; change the logic so the
marker is only considered a prefix (allowing optional leading whitespace) before
stripping. Specifically, for each op.Description check after trimming leading
whitespace (e.g., spaces, tabs, CR/LF) whether it HasPrefix(marker) and only
then set op.Description = strings.TrimSpace(the remainder), referencing the same
symbols (marker, op.Description, pathItem.Operations(), spec.Paths.Map()) so
accidental internal occurrences are not removed.
---
Nitpick comments:
In `@dto/api_responses.go`:
- Around line 98-103: Replace the anonymous nested struct in
RelayNotImplementedError.Error with a named type (e.g., RelayErrorPayload) so
the payload can be reused and appears as a proper schema component; define the
new struct with the same fields and json tags (Message string `json:"message"`,
Type string `json:"type"`), change RelayNotImplementedError to use Error
RelayErrorPayload `json:"error"`, and update any other references to the
anonymous type to use RelayErrorPayload.
- Around line 48-60: The DTOs AnthropicModelList and GeminiModelList use broad
any types which produce weak OpenAPI schemas; update these structs by replacing
any with concrete types or at minimum structured container types (e.g., for
AnthropicModelList.Data use []map[string]any or a defined ModelSummary struct
instead of any, and for GeminiModelList.Models use []map[string]any or a
concrete list item type; also change NextPageToken to string/null-able string if
appropriate) and apply the same pattern to other DTOs flagged in the review so
generated schemas are explicit and discoverable.
In `@dto/topup_creem.go`:
- Around line 11-69: The CreemWebhookEvent struct currently embeds deep
anonymous structs (Object, Order, Product, Customer) which hampers reuse and
testing; refactor by extracting those anonymous sub-objects into separate named
DTO types (e.g., CreemObject, CreemOrder, CreemProduct, CreemCustomer) and
replace the inline definitions in CreemWebhookEvent with fields of those new
types (preserving JSON tags and field names like Object, Order, Product,
Customer); update any constructors, unmarshalling or test code to use the new
types and run gofmt/golangci-lint to ensure no other references break.
In `@dto/user.go`:
- Around line 23-37: Update UpdateUserSettingRequest so the two optional bool
fields AcceptUnsetModelRatioModel and RecordIpLog are pointers with `omitempty`
in their json tags (mirroring UpstreamModelUpdateNotifyEnabled) so omitted
fields don't default to false and overwrite existing settings; then update any
code that reads these fields (handlers/validators) to handle nil vs true/false
(dereference safely and treat nil as "not provided").
🪄 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: 1b55bcd8-a9b6-482b-bfe6-436454aa1429
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
There was a problem hiding this comment.
🧹 Nitpick comments (1)
dto/router.go (1)
121-134: Minor: Consider simplifying first character handling.The expression
rune(strings.ToUpper(id[:1])[0])on line 126 is functional but verbose. Since Go identifiers are ASCII, a simpler approach would be:b.WriteByte(id[0] &^ 0x20) // ASCII uppercaseOr use
unicode.ToUpper(rune(id[0]))for clarity. This is purely stylistic—the current code works correctly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/router.go` around lines 121 - 134, The handlerSummary function uses a verbose expression to uppercase the first character (rune(strings.ToUpper(id[:1])[0])); replace that with a clearer, simpler approach such as using unicode.ToUpper(rune(id[0])) or the ASCII bitwise trick (id[0] &^ 0x20) to produce the uppercase first rune before writing it to the strings.Builder; update the code in handlerSummary so the first-character conversion is done using one of these clearer alternatives and keep the rest of the loop intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@dto/router.go`:
- Around line 121-134: The handlerSummary function uses a verbose expression to
uppercase the first character (rune(strings.ToUpper(id[:1])[0])); replace that
with a clearer, simpler approach such as using unicode.ToUpper(rune(id[0])) or
the ASCII bitwise trick (id[0] &^ 0x20) to produce the uppercase first rune
before writing it to the strings.Builder; update the code in handlerSummary so
the first-character conversion is done using one of these clearer alternatives
and keep the rest of the loop intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5564c16d-53cd-4bf2-a4c0-aea0ca4136e9
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (10)
- dto/group.go
- dto/setup.go
- dto/responses.go
- dto/topup_creem.go
- dto/checkin.go
- dto/twofa.go
- dto/subscription.go
- dto/token.go
- dto/misc.go
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (5)
- router/main.go
- router/openapi.go
- dto/user.go
- dto/topup.go
- go.mod
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
router/openapi.go (1)
16-29: External CDN dependency for Scalar UI.The Scalar API reference UI is loaded from
cdn.jsdelivr.net. This is a reasonable approach for a feature gated behindENABLE_OPENAPI, but be aware that:
- It requires internet access to render the UI
- CDN availability affects the swagger page
For production deployments, consider offering a configuration option to self-host the Scalar script or pin to a specific version for stability.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/openapi.go` around lines 16 - 29, scalarUIHandler currently injects a hardcoded external script src "https://cdn.jsdelivr.net/npm/@scalar/api-reference", which makes the UI reliant on internet/CDN availability; update scalarUIHandler to accept a configurable script URL (or flag to self-host) instead of the hardcoded src, default the value to a pinned version (e.g. include a versioned package URL) and add logic to serve a local static file when self-hosting is enabled so deployments can opt out of the external CDN; reference the scalarUIHandler function and specURL parameter to locate where to replace the inline page string and make the script source configurable.router/api-router.go (1)
331-334: Consider adding response types to self log/data routes.The
/self/statand/selflog routes have response type annotations, but/self/search(line 334) uses direct gin registration without OpenAPI documentation. For consistency, consider documenting this endpoint as well if it's user-facing.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/api-router.go` around lines 331 - 334, The /self/search route is registered directly with logRoute.GET and lacks OpenAPI response types; replace that direct registration with the documented router helper used above (use the same dto.NewRouter instance or logUser) and register the endpoint via logUser.GinGet with the same middleware and a dto.GinResp type matching controller.SearchUserLogs (e.g. dto.GinResp[dto.Response[dto.PageData[model.Log]]]()) plus dto.PageParams() so the endpoint is included in the API docs and has consistent response/type metadata.dto/router.go (1)
49-62: Silent fallback when both operation IDs are taken.If both the handler-derived ID and path-derived ID are already claimed,
coreOptssilently omits theoperationIdandsummary(line 56 check). This could happen with duplicate route registrations. Consider logging a warning in this case to aid debugging.💡 Suggested improvement
func (r *Router) coreOpts(method string, path string, handler any, extra []func(*fuego.BaseRoute)) []func(*fuego.BaseRoute) { id := claimID(handlerID(handler)) if id == "" { id = claimID(pathToOperationID(method, r.basePath+path)) } + if id == "" { + // Both handler-based and path-based IDs were already claimed + // This indicates duplicate route registration + // Consider logging: log.Printf("Warning: duplicate operationId for %s %s", method, r.basePath+path) + } opts := make([]func(*fuego.BaseRoute), 0, 3+len(r.security)+len(extra))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/router.go` around lines 49 - 62, coreOpts can silently omit operationId/summary when both handlerID(handler) and pathToOperationID(method, r.basePath+path) produce an already-claimed id (id == ""), so add a warning log in that branch to aid debugging: inside coreOpts after the id=="" check (where it currently skips setting Summary/OperationID), emit a warning including method, full path (r.basePath+path), the handler-derived id (handlerID(handler)), and the path-derived id (pathToOperationID(...)) and reference handlerSummary(handler) as appropriate; use the project's logger API (e.g. r.logger.Warnf or equivalent) or the standard log package if no logger exists, so duplicate route registrations are clearly reported.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@go.mod`:
- Line 21: go.mod bumped gin to v1.12.0 which introduces breaking changes;
either revert to the previous major (v1.9.x) or update code to follow the new
APIs: ensure your module's Go version meets gin's minimum (set go 1.24/1.25 in
go.mod), update all calls to SaveUploadedFile(...) to pass the new optional
permission argument, change any code that reads/writes gin.Context.Keys to treat
it as map[any]any (use proper type assertions/casts), and replace usages of
render.tomlContentType and render.writeHeader with the new render package APIs;
after changes run `go test`/`go vet` and fix any remaining type or signature
errors referencing SaveUploadedFile, gin.Context.Keys, render.tomlContentType,
or render.writeHeader.
---
Nitpick comments:
In `@dto/router.go`:
- Around line 49-62: coreOpts can silently omit operationId/summary when both
handlerID(handler) and pathToOperationID(method, r.basePath+path) produce an
already-claimed id (id == ""), so add a warning log in that branch to aid
debugging: inside coreOpts after the id=="" check (where it currently skips
setting Summary/OperationID), emit a warning including method, full path
(r.basePath+path), the handler-derived id (handlerID(handler)), and the
path-derived id (pathToOperationID(...)) and reference handlerSummary(handler)
as appropriate; use the project's logger API (e.g. r.logger.Warnf or equivalent)
or the standard log package if no logger exists, so duplicate route
registrations are clearly reported.
In `@router/api-router.go`:
- Around line 331-334: The /self/search route is registered directly with
logRoute.GET and lacks OpenAPI response types; replace that direct registration
with the documented router helper used above (use the same dto.NewRouter
instance or logUser) and register the endpoint via logUser.GinGet with the same
middleware and a dto.GinResp type matching controller.SearchUserLogs (e.g.
dto.GinResp[dto.Response[dto.PageData[model.Log]]]()) plus dto.PageParams() so
the endpoint is included in the API docs and has consistent response/type
metadata.
In `@router/openapi.go`:
- Around line 16-29: scalarUIHandler currently injects a hardcoded external
script src "https://cdn.jsdelivr.net/npm/@scalar/api-reference", which makes the
UI reliant on internet/CDN availability; update scalarUIHandler to accept a
configurable script URL (or flag to self-host) instead of the hardcoded src,
default the value to a pinned version (e.g. include a versioned package URL) and
add logic to serve a local static file when self-hosting is enabled so
deployments can opt out of the external CDN; reference the scalarUIHandler
function and specURL parameter to locate where to replace the inline page string
and make the script source configurable.
🪄 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: 81946b9f-7b78-44d2-b44d-803b2b720896
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (10)
- dto/group.go
- dto/setup.go
- dto/token.go
- dto/topup_creem.go
- dto/checkin.go
- dto/responses.go
- dto/twofa.go
- dto/user.go
- dto/misc.go
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (2)
- router/main.go
- dto/pricing.go
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@router/api-router.go`:
- Around line 350-351: The data routes are being registered on dataRoute without
applying the authentication middleware even though the handler uses
secDashboard(); update the router setup so dataUser is created with the same
authenticated middleware as the log routes — apply secDashboard() (or the
appropriate auth middleware) to the router that backs dto.NewRouter for
dataRoute (or pass the middleware into dto.NewRouter when constructing dataUser)
so that GinGet("/self", controller.GetUserQuotaDates, dto.PageParams()) runs
behind authentication.
- Around line 340-342: logUser routes are missing user auth so
controller.GetLogsSelfStat and controller.GetUserLogs will not find auth-set
context values; wrap the group with the user authentication middleware before
creating the router. Replace using dto.NewRouter(engine, logRoute, "Logs",
secDashboard()) on the raw logRoute with creating the route group via
logRoute.Group(...) or apply middleware.UserAuth() (the same pattern used for
logAdmin with middleware.AdminAuth()) so the dto.NewRouter call for logUser gets
the authenticated group and the handlers (GetLogsSelfStat, GetUserLogs) receive
proper context values.
🪄 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: 8c88a6cc-9795-43e9-b4e8-be0acd618a10
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (11)
- dto/setup.go
- dto/topup.go
- dto/topup_creem.go
- dto/group.go
- dto/token.go
- dto/checkin.go
- dto/twofa.go
- go.mod
- dto/api_responses.go
- dto/subscription.go
- dto/misc.go
🚧 Files skipped from review as they are similar to previous changes (2)
- router/main.go
- dto/responses.go
There was a problem hiding this comment.
🧹 Nitpick comments (5)
dto/user.go (3)
23-37: DTO diverges from controller's local type definition.The controller at
controller/user.go:1044-1054defines a localUpdateUserSettingRequestthat lacksAcceptUnsetModelRatioModelandRecordIpLogfields present here. The controller still usesc.ShouldBindJSON(&req)with its local type, so these additional fields won't be processed by the handler.Either update the controller to use this DTO, or align the fields to avoid confusion between the documented API and actual behavior.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/user.go` around lines 23 - 37, The DTO type UpdateUserSettingRequest in dto/user.go contains AcceptUnsetModelRatioModel and RecordIpLog which are missing from the local UpdateUserSettingRequest defined in controller/user.go (the handler uses c.ShouldBindJSON(&req)), causing those fields to be ignored; fix by aligning types: either replace the controller's local UpdateUserSettingRequest with the dto.user.UpdateUserSettingRequest (import and use dto type in the handler) so c.ShouldBindJSON binds all fields, or remove the extra fields from dto/user.go so both definitions match — ensure the handler uses the same UpdateUserSettingRequest symbol as the DTO to avoid divergence.
12-16: Duplicate type definition exists in controller/user.go.This
LoginRequestDTO duplicates the local type definition incontroller/user.go:27-30. The controller still uses its local type withjson.NewDecoderinstead of this DTO. While the OpenAPI spec will reflect this DTO's schema, the actual handler binding differs.Consider migrating the controller to use this DTO for consistency, or document that this is intentionally for OpenAPI documentation only.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/user.go` around lines 12 - 16, The LoginRequest struct in dto (LoginRequest) duplicates a local type defined in the controller and the handler currently decodes into the local type with json.NewDecoder; update the controller to import and use the dto.LoginRequest type (replace the local type and any usages in the handler that call json.NewDecoder into the local struct) so the request binding and OpenAPI schema are consistent, or alternatively remove/annotate the dto.LoginRequest if you intend it only for OpenAPI; ensure all references to the local LoginRequest are switched to the DTO type and that json decoding/validation targets dto.LoginRequest.
56-83:Permissions anyproduces an untyped OpenAPI schema.The
Permissionsfield usesany, which will generate an empty or untyped schema in the OpenAPI spec. If the permissions structure is well-defined, consider creating a typed struct for better API documentation.If the structure genuinely varies at runtime, this is acceptable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/user.go` around lines 56 - 83, The Permissions field on the UserSelfData struct is declared as any which yields an untyped OpenAPI schema; define a concrete type (e.g., a new Permissions struct or named type reflecting the expected permission fields) and replace the Permissions any declaration with that named type (keeping the `json:"permissions"` tag) so the OpenAPI generator produces a typed schema; if the shape truly varies, explicitly use map[string]interface{} (or map[string]any) and document that choice instead of leaving it as plain any.dto/router.go (1)
75-90: Potential panic if handler is nil.
handlerIDusesreflect.ValueOf(f).Pointer()which will panic iffis nil. While unlikely in practice since Gin handlers are typically non-nil, consider adding a nil guard for defensive coding.🛡️ Optional defensive fix
func handlerID(f any) string { + if f == nil { + return "" + } full := strings.TrimSuffix(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), "-fm")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/router.go` around lines 75 - 90, The handlerID function can panic when passed a nil handler because reflect.ValueOf(f).Pointer() is called without a nil check; add a defensive nil guard at the top of handlerID to return an empty string for nil handlers (check the incoming interface and/or reflect.Value before calling Pointer), ensuring you bail out before invoking runtime.FuncForPC(reflect.ValueOf(f).Pointer()) and keep the rest of the logic unchanged.router/api-router.go (1)
85-86: Duplicate/groupsendpoint registered.
controller.GetUserGroupsis registered twice:
- Line 85:
auth.GinGet("/groups", ...)→/api/user/groups(public, no auth)- Line 96:
self.GinGet("/self/groups", ...)→/api/user/self/groups(requires UserAuth)Both routes call the same controller. If intentional (public vs authenticated versions), consider documenting this. If unintentional, remove one to avoid confusion in the OpenAPI spec.
Also applies to: 96-96
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/api-router.go` around lines 85 - 86, Duplicate route registration: auth.GinGet("/groups", controller.GetUserGroups) and self.GinGet("/self/groups", controller.GetUserGroups) both register the same controller for different endpoints, causing confusion in routing/OpenAPI. Decide whether you want a public vs authenticated variant: if unintentional, remove the redundant auth.GinGet("/groups", ...) registration; if intentional, either swap the handler on self.GinGet to an authenticated-specific method (e.g., controller.GetSelfGroups) or add clear documentation/comments explaining the difference and ensure the OpenAPI annotations reflect both endpoints distinctly. Update the code to keep only the intended route/handler pair (reference auth.GinGet, self.GinGet, controller.GetUserGroups).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@dto/router.go`:
- Around line 75-90: The handlerID function can panic when passed a nil handler
because reflect.ValueOf(f).Pointer() is called without a nil check; add a
defensive nil guard at the top of handlerID to return an empty string for nil
handlers (check the incoming interface and/or reflect.Value before calling
Pointer), ensuring you bail out before invoking
runtime.FuncForPC(reflect.ValueOf(f).Pointer()) and keep the rest of the logic
unchanged.
In `@dto/user.go`:
- Around line 23-37: The DTO type UpdateUserSettingRequest in dto/user.go
contains AcceptUnsetModelRatioModel and RecordIpLog which are missing from the
local UpdateUserSettingRequest defined in controller/user.go (the handler uses
c.ShouldBindJSON(&req)), causing those fields to be ignored; fix by aligning
types: either replace the controller's local UpdateUserSettingRequest with the
dto.user.UpdateUserSettingRequest (import and use dto type in the handler) so
c.ShouldBindJSON binds all fields, or remove the extra fields from dto/user.go
so both definitions match — ensure the handler uses the same
UpdateUserSettingRequest symbol as the DTO to avoid divergence.
- Around line 12-16: The LoginRequest struct in dto (LoginRequest) duplicates a
local type defined in the controller and the handler currently decodes into the
local type with json.NewDecoder; update the controller to import and use the
dto.LoginRequest type (replace the local type and any usages in the handler that
call json.NewDecoder into the local struct) so the request binding and OpenAPI
schema are consistent, or alternatively remove/annotate the dto.LoginRequest if
you intend it only for OpenAPI; ensure all references to the local LoginRequest
are switched to the DTO type and that json decoding/validation targets
dto.LoginRequest.
- Around line 56-83: The Permissions field on the UserSelfData struct is
declared as any which yields an untyped OpenAPI schema; define a concrete type
(e.g., a new Permissions struct or named type reflecting the expected permission
fields) and replace the Permissions any declaration with that named type
(keeping the `json:"permissions"` tag) so the OpenAPI generator produces a typed
schema; if the shape truly varies, explicitly use map[string]interface{} (or
map[string]any) and document that choice instead of leaving it as plain any.
In `@router/api-router.go`:
- Around line 85-86: Duplicate route registration: auth.GinGet("/groups",
controller.GetUserGroups) and self.GinGet("/self/groups",
controller.GetUserGroups) both register the same controller for different
endpoints, causing confusion in routing/OpenAPI. Decide whether you want a
public vs authenticated variant: if unintentional, remove the redundant
auth.GinGet("/groups", ...) registration; if intentional, either swap the
handler on self.GinGet to an authenticated-specific method (e.g.,
controller.GetSelfGroups) or add clear documentation/comments explaining the
difference and ensure the OpenAPI annotations reflect both endpoints distinctly.
Update the code to keep only the intended route/handler pair (reference
auth.GinGet, self.GinGet, controller.GetUserGroups).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5cb5749e-c451-4950-baed-33c40bd1502d
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (11)
- dto/setup.go
- dto/topup_creem.go
- dto/topup.go
- dto/responses.go
- dto/checkin.go
- dto/twofa.go
- dto/token.go
- go.mod
- dto/misc.go
- dto/group.go
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (4)
- router/main.go
- dto/pricing.go
- dto/subscription.go
- router/openapi.go
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
controller/user.go (1)
3-5:⚠️ Potential issue | 🟠 MajorReplace direct
encoding/jsonusage with the shared wrappers.This file now decodes and marshals JSON through
encoding/jsonin business code (Login,generateDefaultSidebarConfig, andUpdateSelf). That bypasses the repository’s required wrapper layer.Proposed fix
-import ( - "encoding/json" +import ( "errors" "fmt" @@ - err := json.NewDecoder(c.Request.Body).Decode(&loginRequest) + err := common.DecodeJson(c.Request.Body, &loginRequest) @@ - configBytes, err := json.Marshal(defaultConfig) + configBytes, err := common.Marshal(defaultConfig) @@ - requestDataBytes, err := json.Marshal(requestData) + requestDataBytes, err := common.Marshal(requestData) if err != nil { return dto.FailMsg(common.TranslateMessage(ginCtx, i18n.MsgInvalidParams)) } - err = json.Unmarshal(requestDataBytes, &user) + err = common.Unmarshal(requestDataBytes, &user)As per coding guidelines, "All JSON marshal/unmarshal operations MUST use wrapper functions from
common/json.go(common.Marshal,common.Unmarshal,common.UnmarshalJsonStr,common.DecodeJson,common.GetJsonType). Do NOT directly import or callencoding/jsonin business code."Also applies to: 27-35, 395-399, 543-549
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@controller/user.go` around lines 3 - 5, The file imports and directly uses encoding/json in business functions (Login, generateDefaultSidebarConfig, UpdateSelf and the ranges noted) which violates the wrapper rule; replace all encoding/json Marshal/Unmarshal/Decoder usage in those functions with the repository wrappers from common/json.go (e.g., use common.Unmarshal or common.UnmarshalJsonStr for parsing JSON inputs, common.Marshal for producing JSON, and common.DecodeJson or common.GetJsonType where streaming/typing is needed), remove the encoding/json import, and ensure calls reference the common package (adjust variable names/signatures if needed to match the wrapper APIs).controller/topup.go (1)
204-217:⚠️ Potential issue | 🔴 CriticalToken-mode orders can under-credit the user.
When token display mode is enabled,
req.Amountis divided byQuotaPerUnitand truncated withIntPart()before the order is stored. The notify path later multiplies that persisted integer back byQuotaPerUnit, so any request that is not an exact multiple loses quota after a successful payment.Possible guard in the request path
amount := req.Amount if operation_setting.GetQuotaDisplayType() == operation_setting.QuotaDisplayTypeTokens { dAmount := decimal.NewFromInt(int64(amount)) dQuotaPerUnit := decimal.NewFromFloat(common.QuotaPerUnit) + if !dAmount.Mod(dQuotaPerUnit).IsZero() { + return dto.Fail[dto.EpayPayResponse]("充值数量必须是固定额度的整数倍") + } amount = dAmount.Div(dQuotaPerUnit).IntPart() }Also applies to: 336-339
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@controller/topup.go` around lines 204 - 217, The code truncates token-mode orders by using IntPart() (in the block checking operation_setting.GetQuotaDisplayType() == operation_setting.QuotaDisplayTypeTokens), causing under-credit when notify multiplies the persisted integer back by common.QuotaPerUnit; fix by preserving the fractional value instead of truncating — either compute tokenCount with proper rounding (use decimal.Ceil() to avoid losing quota) or store both the displayed token integer and the original/requested amount (e.g., add a RawAmount or FractionalAmount field to model.TopUp) so the notify path can use the precise value; update the logic around decimal.NewFromInt/int division and the notify flow to read the preserved value rather than relying on the truncated Amount.
🧹 Nitpick comments (4)
dto/api_responses.go (1)
76-80: Use a concrete type forlast_used_at.
controller/passkey.goalways feeds this fromcredential.LastUsedAt, soanythrows away thedate-timeshape in the generated spec. Prefer*time.Timehere so the OpenAPI output stays useful.♻️ Proposed refactor
package dto + +import "time" @@ type PasskeyStatusData struct { Enabled bool `json:"enabled"` - LastUsedAt any `json:"last_used_at,omitempty"` + LastUsedAt *time.Time `json:"last_used_at,omitempty"` }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/api_responses.go` around lines 76 - 80, The PasskeyStatusData struct currently uses a generic any for LastUsedAt which loses the date-time schema; change PasskeyStatusData.LastUsedAt to a concrete pointer type (*time.Time) and add the time import so the OpenAPI generator preserves the date-time format—ensure the field remains omitempty and that places that assign credential.LastUsedAt (e.g., controller/passkey.go) continue to pass the same value type.controller/pricing.go (2)
70-80: Return type differs from other handlers.
GetPricingreturns(dto.PricingData, error)directly with an embeddedSuccessfield, while most other migrated handlers return(*dto.Response[T], error). This is functionally correct sincedto.PricingDataalready contains aSuccessfield, but it creates an inconsistent API contract pattern across handlers.This is acceptable if intentional for this specific endpoint's response shape requirements.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@controller/pricing.go` around lines 70 - 80, GetPricing currently returns dto.PricingData directly (including its own Success field) which diverges from the standard handler signature; change GetPricing to return (*dto.Response[dto.PricingData], error) and wrap the existing dto.PricingData payload inside dto.Response (set Response.Success to true and Response.Data to the PricingData result), updating the function signature and return sites so the endpoint matches other handlers that return *dto.Response[T].
36-50: Inconsistent user ID extraction and silent failure on type assertion.This handler uses
dto.GinCtx(c).Get("id")(line 38) whereas other migrated handlers in this PR usedto.UserID(c). Additionally, when the type assertion fails at line 47, the handler returns an emptydto.PricingData{}withnilerror, which silently masks potential authentication issues.Consider using the consistent
dto.UserID(c)pattern, or at minimum, add logging when the type assertion fails to aid debugging.♻️ Suggested improvement for consistency
func GetPricing(c fuego.ContextNoBody) (dto.PricingData, error) { pricing := model.GetPricing() - userId, exists := dto.GinCtx(c).Get("id") + userId := dto.UserID(c) usableGroup := map[string]string{} groupRatio := map[string]float64{} for s, f := range ratio_setting.GetGroupRatioCopy() { groupRatio[s] = f } var group string - if exists { - userID, ok := userId.(int) - if !ok { - return dto.PricingData{}, nil - } - user, err := model.GetUserCache(userID) + if userId > 0 { + user, err := model.GetUserCache(userId) if err == nil {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@controller/pricing.go` around lines 36 - 50, GetPricing currently reads the user id via dto.GinCtx(c).Get("id") and silently returns an empty dto.PricingData{} on a failed type assertion; replace the manual extraction with the standardized dto.UserID(c) call (and remove the dto.GinCtx(c).Get usage) and ensure failures return a proper error (or at minimum log the assertion failure) before returning, updating the flow around model.GetUserCache and the returned dto.PricingData to surface authentication/type errors instead of nil.dto/query_params.go (1)
5-7: Modelstatus_onlyas a boolean.OpenAPI will publish this as a string today, and
controller/token.gohas to special-case"true". Usingboolhere makes the generated schema accurate and avoids clients sending surprising truthy values.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/query_params.go` around lines 5 - 7, Change the StatusOnlyParams.StatusOnly field from string to bool so the OpenAPI schema models status_only as a boolean: update the struct declaration in StatusOnlyParams (field StatusOnly) to type bool and adjust its description if needed; then remove or replace the special-case string handling in controller/token.go that checks for the literal "true" and instead read/interpret the boolean value provided by the parsed query parameter.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@controller/custom_oauth.go`:
- Around line 92-107: The code currently only validates scheme/host but must
also block private/loopback/link-local and cloud metadata addresses before
issuing the HTTP request; after parsing targetURL (parsedURL) and before
client.Do(resp), resolve the host (use parsedURL.Hostname()) to IPs and reject
any address that is loopback, IPv4 RFC1918 (10/8, 172.16/12, 192.168/16),
link-local (169.254.0.0/16 or fe80::/10), multicast/unspecified, and known
metadata addresses (e.g., 169.254.169.254) or IPv6 equivalents; also reject
literal IP hosts that match those ranges. Implement the check in the same
function that creates httpReq (before calling client.Do) and return a
dto.Fail[dto.FetchDiscoveryData] with an appropriate message when any resolved
IP is disallowed.
In `@controller/misc.go`:
- Around line 205-206: The code currently returns different messages based on
model.IsEmailAlreadyTaken (e.g., dto.FailMsg("邮箱地址已被占用") vs a "未注册" message),
which leaks account existence; change both code paths (the branch using
model.IsEmailAlreadyTaken and the similar branch at lines 230-231) to return the
same generic response (e.g., a neutral dto.FailMsg or dto.SuccessMsg) regardless
of whether the email exists, while keeping the internal existence check for flow
control only; update the handlers that call model.IsEmailAlreadyTaken so they do
not expose difference in their returned messages.
- Around line 249-265: The ResetPassword handler returns the newly generated
password to the client (using common.GenerateVerificationCode and
model.ResetUserPasswordByEmail) which leaks credentials; instead stop returning
the password: after verifying the token (common.VerifyCodeWithKey) and resetting
the password (model.ResetUserPasswordByEmail), delete the reset key
(common.DeleteKey) and return a generic success response (dto.Ok without the
password) and trigger a secure out-of-band deliverability path (e.g., call your
mailer/notification function to email the user a password reset confirmation or
a one-time login link) or require the user to set a new password via a dedicated
front-end flow—do not include the generated password in the API response.
In `@controller/token.go`:
- Around line 190-193: The DeleteToken handler uses PathParamInt("id") which
converts malformed ids to 0; change it to use PathParamIntErr("id") in
DeleteToken to validate the path parameter and return the same client error
behavior as other token endpoints, and only call model.DeleteTokenById(id,
dto.UserID(c)) when PathParamIntErr succeeds—propagate the parameter-parsing
error immediately instead of passing a possibly-invalid id into
model.DeleteTokenById.
In `@controller/user.go`:
- Around line 685-723: The switch over req.Action in the ManageUser handler
currently ignores unknown actions and proceeds to return success; add a default
branch to the switch that rejects any unsupported req.Action by returning
dto.Fail[dto.ManageUserData] (use common.TranslateMessage(ginCtx,
i18n.MsgUserUnknownAction) or a suitable message) so unknown actions do not fall
through and mutate or report success; keep existing behavior for "delete" vs
non-delete (the existing req.Action != "delete" Update call is fine).
In `@dto/custom_oauth.go`:
- Around line 43-63: The struct CreateCustomOAuthProviderRequest currently uses
Gin's `binding:"required"` tags which go unrecognized by our validator; replace
those `binding:"required"` tags with `validate:"required"` for required fields
(e.g., Name, Slug, ClientId, ClientSecret, AuthorizationEndpoint, TokenEndpoint,
UserInfoEndpoint) or add explicit request-body validation in the handler that
calls ContextWithBody[T].Body(); apply the same fix to the corresponding update
struct (e.g., UpdateCustomOAuthProviderRequest/members around lines ~98-100) so
go-playground/validator enforces the required fields.
In `@dto/responses.go`:
- Around line 61-65: Response[T] currently always serializes a "data" field even
for error responses; change the JSON tag on Data to omit empty values
(json:"data,omitempty") so Fail[T]/FailPage[T] produce the legacy message-only
envelope when Data is zero-value, and scan the related response types around the
other declarations (the symbols Response[T], Fail[T], FailPage[T]) to apply the
same json:"...,omitempty" change where appropriate and run tests to confirm no
regressions.
In `@dto/router.go`:
- Around line 16-17: The package-global usedOperationIDs causes operationId
collisions across multiple spec builds; instead make the map instance-scoped and
pass it through the build options so each OpenAPI engine gets its own set.
Replace the top-level var usedOperationIDs sync.Map with a field (e.g.,
UsedOperationIDs sync.Map or map[string]struct{}) on the coreOpts/context struct
and update all usages (the initialization and collision checks currently
touching usedOperationIDs and the coreOpts fallback logic) to reference that
per-build field so each spec build has an isolated operationId tracker.
In `@router/api-router.go`:
- Around line 99-101: The PUT route for UpdateSelf is registered as bodyless but
controller.UpdateSelf reads JSON; change the registration from dto.Put(self,
"/self", controller.UpdateSelf) to a body-aware registration and declare the
request payload type: either use dto.PutB(self, "/self", controller.UpdateSelf,
dto.GinBody[UpdateSelfRequest]{}) or dto.GinPut(self, "/self",
controller.UpdateSelf, dto.GinBody[UpdateSelfRequest]{}) and add an
UpdateSelfRequest DTO matching the JSON shape consumed by controller.UpdateSelf
(fields used in controller/user.go) so the generated spec documents the body.
- Around line 76-78: The login route declaration uses
dto.Response[dto.LoginData] but controller.Login can also return
dto.Login2FAData for the "2FA required" path; update the route response type to
include both shapes (e.g., a union/variant or a wrapper that accepts
dto.LoginData and dto.Login2FAData) so generated clients and OpenAPI reflect the
2FA branch—locate the userPublicTurnstile route where
dto.GinResp[dto.Response[dto.LoginData]]() is used for controller.Login and
replace it with the appropriate combined/alternative response type that covers
dto.Login2FAData as well.
In `@setting/console_setting/validation.go`:
- Around line 12-13: Replace direct json.Unmarshal calls in parseJSONArray and
getJSONList with the repository wrapper common.UnmarshalJsonStr: call
common.UnmarshalJsonStr(payloadString, &target) (or appropriate variable)
instead of json.Unmarshal, handle/propagate the returned error consistent with
existing error handling, and remove the now-unused encoding/json import from the
file; the functions to change are parseJSONArray and getJSONList and the wrapper
is common.UnmarshalJsonStr.
---
Outside diff comments:
In `@controller/topup.go`:
- Around line 204-217: The code truncates token-mode orders by using IntPart()
(in the block checking operation_setting.GetQuotaDisplayType() ==
operation_setting.QuotaDisplayTypeTokens), causing under-credit when notify
multiplies the persisted integer back by common.QuotaPerUnit; fix by preserving
the fractional value instead of truncating — either compute tokenCount with
proper rounding (use decimal.Ceil() to avoid losing quota) or store both the
displayed token integer and the original/requested amount (e.g., add a RawAmount
or FractionalAmount field to model.TopUp) so the notify path can use the precise
value; update the logic around decimal.NewFromInt/int division and the notify
flow to read the preserved value rather than relying on the truncated Amount.
In `@controller/user.go`:
- Around line 3-5: The file imports and directly uses encoding/json in business
functions (Login, generateDefaultSidebarConfig, UpdateSelf and the ranges noted)
which violates the wrapper rule; replace all encoding/json
Marshal/Unmarshal/Decoder usage in those functions with the repository wrappers
from common/json.go (e.g., use common.Unmarshal or common.UnmarshalJsonStr for
parsing JSON inputs, common.Marshal for producing JSON, and common.DecodeJson or
common.GetJsonType where streaming/typing is needed), remove the encoding/json
import, and ensure calls reference the common package (adjust variable
names/signatures if needed to match the wrapper APIs).
---
Nitpick comments:
In `@controller/pricing.go`:
- Around line 70-80: GetPricing currently returns dto.PricingData directly
(including its own Success field) which diverges from the standard handler
signature; change GetPricing to return (*dto.Response[dto.PricingData], error)
and wrap the existing dto.PricingData payload inside dto.Response (set
Response.Success to true and Response.Data to the PricingData result), updating
the function signature and return sites so the endpoint matches other handlers
that return *dto.Response[T].
- Around line 36-50: GetPricing currently reads the user id via
dto.GinCtx(c).Get("id") and silently returns an empty dto.PricingData{} on a
failed type assertion; replace the manual extraction with the standardized
dto.UserID(c) call (and remove the dto.GinCtx(c).Get usage) and ensure failures
return a proper error (or at minimum log the assertion failure) before
returning, updating the flow around model.GetUserCache and the returned
dto.PricingData to surface authentication/type errors instead of nil.
In `@dto/api_responses.go`:
- Around line 76-80: The PasskeyStatusData struct currently uses a generic any
for LastUsedAt which loses the date-time schema; change
PasskeyStatusData.LastUsedAt to a concrete pointer type (*time.Time) and add the
time import so the OpenAPI generator preserves the date-time format—ensure the
field remains omitempty and that places that assign credential.LastUsedAt (e.g.,
controller/passkey.go) continue to pass the same value type.
In `@dto/query_params.go`:
- Around line 5-7: Change the StatusOnlyParams.StatusOnly field from string to
bool so the OpenAPI schema models status_only as a boolean: update the struct
declaration in StatusOnlyParams (field StatusOnly) to type bool and adjust its
description if needed; then remove or replace the special-case string handling
in controller/token.go that checks for the literal "true" and instead
read/interpret the boolean value provided by the parsed query parameter.
🪄 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: c0b345d0-8d79-489d-aae5-da976740acc6
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (46)
controller/checkin.gocontroller/custom_oauth.gocontroller/group.gocontroller/log.gocontroller/misc.gocontroller/oauth.gocontroller/passkey.gocontroller/pricing.gocontroller/setup.gocontroller/subscription.gocontroller/subscription_payment_creem.gocontroller/subscription_payment_epay.gocontroller/subscription_payment_stripe.gocontroller/token.gocontroller/topup.gocontroller/topup_creem.gocontroller/topup_stripe.gocontroller/twofa.gocontroller/uptime_kuma.gocontroller/usedata.gocontroller/user.godto/api_responses.godto/checkin.godto/custom_oauth.godto/group.godto/misc.godto/params.godto/pricing.godto/query_params.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/uptime_kuma.godto/user.gogo.modmodel/twofa.gorouter/api-router.gorouter/main.gorouter/openapi.gosetting/console_setting/validation.gotypes/oauth_errors.go
✅ Files skipped from review due to trivial changes (11)
- dto/group.go
- dto/setup.go
- dto/checkin.go
- dto/token.go
- dto/uptime_kuma.go
- go.mod
- dto/user.go
- dto/twofa.go
- dto/topup.go
- dto/misc.go
- dto/subscription.go
🚧 Files skipped from review as they are similar to previous changes (3)
- router/main.go
- dto/topup_creem.go
- dto/pricing.go
There was a problem hiding this comment.
🧹 Nitpick comments (2)
router/openapi.go (1)
16-29: Consider pinning the Scalar CDN version for stability and security.The CDN URL
https://cdn.jsdelivr.net/npm/@scalar/api-referencefetches the latest version, which could introduce breaking changes or security issues without warning.💡 Suggested improvement
-<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> +<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.0"></script>Pin to a specific version (check for the current stable release) to ensure consistent behavior and allow controlled upgrades.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/openapi.go` around lines 16 - 29, The script src in scalarUIHandler currently uses an unpinned CDN URL ("https://cdn.jsdelivr.net/npm/@scalar/api-reference") which can introduce breaking changes; update the script tag in the page string to reference a specific pinned version (e.g. "@scalar/api-reference@x.y.z") so the page variable uses a fixed release, keeping specURL and the rest of scalarUIHandler unchanged; choose the current stable version and replace the src accordingly to ensure reproducible, secure behavior.dto/router.go (1)
78-90: Consider handling edge case where function name starts with uppercase after package prefix.The
handlerIDfunction lowercases the first character (line 87), which is correct for Go exported functions. However, if a function name is all uppercase (e.g.,API), this producesaPIrather thanapi.This is minor since controller functions typically use PascalCase, but worth noting.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/router.go` around lines 78 - 90, handlerID currently lowercases only the first byte which yields "aPI" for names like "API"; update handlerID to detect all-uppercase names and turn them fully lowercase, and otherwise lowercase the first Unicode rune correctly. Inside handlerID (function handlerID), replace the len(full)>0 branch with logic that: if full == strings.ToUpper(full) then set full = strings.ToLower(full); else lowercase just the first rune using unicode.ToLower on the first rune and append the remainder. This ensures correct handling for all-uppercase identifiers and Unicode function names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@dto/router.go`:
- Around line 78-90: handlerID currently lowercases only the first byte which
yields "aPI" for names like "API"; update handlerID to detect all-uppercase
names and turn them fully lowercase, and otherwise lowercase the first Unicode
rune correctly. Inside handlerID (function handlerID), replace the len(full)>0
branch with logic that: if full == strings.ToUpper(full) then set full =
strings.ToLower(full); else lowercase just the first rune using unicode.ToLower
on the first rune and append the remainder. This ensures correct handling for
all-uppercase identifiers and Unicode function names.
In `@router/openapi.go`:
- Around line 16-29: The script src in scalarUIHandler currently uses an
unpinned CDN URL ("https://cdn.jsdelivr.net/npm/@scalar/api-reference") which
can introduce breaking changes; update the script tag in the page string to
reference a specific pinned version (e.g. "@scalar/api-reference@x.y.z") so the
page variable uses a fixed release, keeping specURL and the rest of
scalarUIHandler unchanged; choose the current stable version and replace the src
accordingly to ensure reproducible, secure behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 64d546ec-8d5b-4131-a260-43f0603b2b8e
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (13)
- dto/group.go
- dto/setup.go
- dto/pricing.go
- dto/checkin.go
- dto/topup_creem.go
- dto/token.go
- dto/twofa.go
- dto/user.go
- dto/subscription.go
- dto/topup.go
- dto/misc.go
- go.mod
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (1)
- dto/responses.go
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
router/api-router.go (2)
99-99:⚠️ Potential issue | 🟠 MajorRegister
UpdateSelfas a body-bearing PUT.
controller.UpdateSelfconsumes JSON, but thisGinPutcall does not declare a request body, so the OpenAPI spec advertises a bodyless update route. Switch this to a body-aware registration and attach the DTO for the JSON payload.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/api-router.go` at line 99, The route is registered with self.GinPut("/self", controller.UpdateSelf) but UpdateSelf consumes JSON, so change the registration to the body-aware variant (e.g., GinPutBody or GinPutWithBody depending on your router helpers) and pass the request DTO type used by controller.UpdateSelf (e.g., UpdateSelfRequest) so the OpenAPI spec includes the JSON body; update the call to something like self.GinPutBody("/self", controller.UpdateSelf, dto.UpdateSelfRequest{}) (or the correct helper signature) to attach the DTO for the JSON payload.
78-79:⚠️ Potential issue | 🟠 MajorDocument
/api/user/loginwith a concrete success schema.Without
dto.GinResp[...], this route falls back to the genericApiResponseschema fromdto/router.go, so the generated spec still does not describe the actual login payload. For a core auth endpoint, that leaves generated clients blind; if login has multiple success shapes, model them explicitly instead of dropping the response type.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/api-router.go` around lines 78 - 79, The POST /api/user/login route is missing a concrete response schema and currently falls back to the generic ApiResponse; update the auth.GinPost call that registers controller.Login to include a specific response descriptor using dto.GinResp with the login success type (e.g., the project’s LoginResponse type) alongside the existing dto.GinBody[dto.LoginRequest]() and dto.TurnstileQuery(); if there are multiple success shapes, model them explicitly (e.g., a union or distinct response types) and pass the appropriate dto.GinResp[...] so the OpenAPI spec documents the actual login payload instead of the generic ApiResponse from dto/router.go.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@router/api-router.go`:
- Around line 333-353: The admin-only routers (logAdmin and dataAdmin) are being
created via dto.NewRouter which causes them to appear in the OpenAPI spec;
change those to register on plain Gin instead of dto.NewRouter (i.e., use the
admin Group returned by logRoute.Group("", middleware.AdminAuth()) and
dataRoute.Group("", middleware.AdminAuth()) and call Gin handlers directly) and
remove dto.NewRouter usage for logAdmin and dataAdmin. Conversely, ensure the
consumer-facing search route (currently registered as
logUserRoute.GET("/self/search", middleware.SearchRateLimit(),
controller.SearchUserLogs)) is created on the OpenAPI-aware router (use the
user-facing dto.NewRouter instance - e.g., add a GinGet mapping like
logUser.GinGet("/self/search", controller.SearchUserLogs, dto.GinResp[...],
dto.PageParams() or appropriate params) so it appears in /openapi.json). Update
references to dto.NewRouter, logAdmin, dataAdmin,
logUserRoute.GET("/self/search"), and controller.SearchUserLogs accordingly.
---
Duplicate comments:
In `@router/api-router.go`:
- Line 99: The route is registered with self.GinPut("/self",
controller.UpdateSelf) but UpdateSelf consumes JSON, so change the registration
to the body-aware variant (e.g., GinPutBody or GinPutWithBody depending on your
router helpers) and pass the request DTO type used by controller.UpdateSelf
(e.g., UpdateSelfRequest) so the OpenAPI spec includes the JSON body; update the
call to something like self.GinPutBody("/self", controller.UpdateSelf,
dto.UpdateSelfRequest{}) (or the correct helper signature) to attach the DTO for
the JSON payload.
- Around line 78-79: The POST /api/user/login route is missing a concrete
response schema and currently falls back to the generic ApiResponse; update the
auth.GinPost call that registers controller.Login to include a specific response
descriptor using dto.GinResp with the login success type (e.g., the project’s
LoginResponse type) alongside the existing dto.GinBody[dto.LoginRequest]() and
dto.TurnstileQuery(); if there are multiple success shapes, model them
explicitly (e.g., a union or distinct response types) and pass the appropriate
dto.GinResp[...] so the OpenAPI spec documents the actual login payload instead
of the generic ApiResponse from dto/router.go.
🪄 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: 11b5b0e7-7189-45e0-9a0e-68a3f7d49196
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (13)
- dto/group.go
- dto/setup.go
- dto/topup_creem.go
- dto/checkin.go
- dto/token.go
- dto/subscription.go
- dto/twofa.go
- dto/router.go
- dto/user.go
- dto/topup.go
- dto/misc.go
- dto/responses.go
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (2)
- dto/pricing.go
- go.mod
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@dto/router.go`:
- Around line 121-133: The handlerSummary function currently inserts a space
before every uppercase rune, splitting acronyms; change the logic in
handlerSummary (inspect id, b, loop over runes) to only insert a space when the
previous rune is lowercase and the current rune is uppercase (i.e.,
lowercase→uppercase boundary), preserving consecutive uppercase runs like "API"
or "OAuth"; also set the first rune to its uppercase form correctly (use the
first rune of id, uppercased) and then append subsequent runes with the new
spacing rule so GetOAuthBindings becomes "Get OAuth Bindings" and GetAPIKeys
becomes "Get API Keys".
In `@router/openapi.go`:
- Around line 16-28: Update scalarUIHandler to load a pinned Scalar UI bundle
instead of the unversioned jsDelivr URL: replace the script src
"https://cdn.jsdelivr.net/npm/@scalar/api-reference" with a versioned URL using
jsDelivr syntax (e.g.
"https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.52.1"); locate this change
in function scalarUIHandler where the HTML page variable is built (refer to
specURL and the script tag) and either hardcode the chosen version or introduce
a constant/variable for the version so the script tag uses the exact
"@<VERSION>" specifier.
🪄 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: c5e9079a-66b3-4746-874b-66360bf54bee
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (12)
- dto/group.go
- dto/setup.go
- dto/user.go
- dto/topup_creem.go
- dto/checkin.go
- dto/responses.go
- dto/token.go
- dto/subscription.go
- dto/twofa.go
- dto/misc.go
- dto/api_responses.go
- dto/topup.go
🚧 Files skipped from review as they are similar to previous changes (4)
- router/main.go
- dto/pricing.go
- go.mod
- router/api-router.go
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
router/openapi.go (1)
16-22:⚠️ Potential issue | 🟠 MajorPin the Scalar UI bundle to an exact version.
The jsDelivr URL is still unversioned, so the customer-facing docs UI can change silently without a deploy. Please pin
@scalar/api-referenceto a specific release here.Suggested change
-<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> +<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@<PINNED_VERSION>"></script>What is the current exact published version of `@scalar/api-reference`, and what is the recommended jsDelivr URL syntax to pin that version?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/openapi.go` around lines 16 - 22, The unpinned jsDelivr import in scalarUIHandler (the script tag that loads "@scalar/api-reference") risks silent UI changes; replace the unversioned src with a jsDelivr URL pinned to a specific release (use the npm package exact version syntax e.g. .../npm/@scalar/api-reference@<VERSION>...) so the bundle is tied to a semantic version; update the src string construction in scalarUIHandler (which uses specURL) to use the pinned URL, pick the current published `@scalar/api-reference` version from the npm registry and substitute it into the jsDelivr URL, and ensure any documentation or changelog notes which version was pinned.dto/router.go (1)
121-133:⚠️ Potential issue | 🟡 MinorPreserve acronym runs in generated summaries.
This still inserts a space before every uppercase letter, so handlers like
GetOAuthBindingsrender asGet O Auth Bindingsin the public docs.Suggested change
func handlerSummary(id string) string { if len(id) == 0 { return "" } var b strings.Builder b.WriteRune(rune(strings.ToUpper(id[:1])[0])) - for _, r := range id[1:] { - if 'A' <= r && r <= 'Z' { + prev := rune(id[0]) + for _, r := range id[1:] { + if 'a' <= prev && prev <= 'z' && 'A' <= r && r <= 'Z' { b.WriteRune(' ') } b.WriteRune(r) + prev = r } return b.String() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dto/router.go` around lines 121 - 133, handlerSummary currently inserts a space before every uppercase rune which splits acronym runs (e.g., GetOAuthBindings -> Get O Auth ...); update handlerSummary to treat consecutive uppercase letters as a single acronym token by only inserting a space before an uppercase rune when the previous rune exists and is not uppercase (e.g., previous is lowercase or digit) so sequences like "OAuth" stay together; keep the initial capitalization logic and use the same strings.Builder and rune iteration but check the previous rune's case to decide whether to write a space.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@dto/api_responses.go`:
- Around line 4-8: The ApiResponse struct currently marks Data as optional via
the `json:"data,omitempty"` tag which makes generated OpenAPI clients treat
`data` as absent-able; change the struct tag on the Data field in ApiResponse
(symbol: ApiResponse, field: Data) to remove `omitempty` so it reads
`json:"data"` so the OpenAPI schema and generated clients always model the
response envelope with a required data field while keeping the type as `any`.
In `@router/openapi.go`:
- Around line 135-139: The security metadata in tokenOrDashboardSecurity is
incorrect for middleware.TokenOrUserAuth: it currently documents bearerAuth plus
an unrelated accessToken+newApiUser combo and sessionAuth with newApiUser, which
will produce unusable auth metadata; update tokenOrDashboardSecurity (the
variable used for secTokenOrDashboard) so it only lists the two allowed
alternatives accepted by middleware.TokenOrUserAuth — a single bearerAuth
requirement and a single sessionAuth requirement (remove any references to
accessToken or newApiUser) so the OpenAPI security matches
middleware.TokenOrUserAuth.
---
Duplicate comments:
In `@dto/router.go`:
- Around line 121-133: handlerSummary currently inserts a space before every
uppercase rune which splits acronym runs (e.g., GetOAuthBindings -> Get O Auth
...); update handlerSummary to treat consecutive uppercase letters as a single
acronym token by only inserting a space before an uppercase rune when the
previous rune exists and is not uppercase (e.g., previous is lowercase or digit)
so sequences like "OAuth" stay together; keep the initial capitalization logic
and use the same strings.Builder and rune iteration but check the previous
rune's case to decide whether to write a space.
In `@router/openapi.go`:
- Around line 16-22: The unpinned jsDelivr import in scalarUIHandler (the script
tag that loads "@scalar/api-reference") risks silent UI changes; replace the
unversioned src with a jsDelivr URL pinned to a specific release (use the npm
package exact version syntax e.g. .../npm/@scalar/api-reference@<VERSION>...) so
the bundle is tied to a semantic version; update the src string construction in
scalarUIHandler (which uses specURL) to use the pinned URL, pick the current
published `@scalar/api-reference` version from the npm registry and substitute it
into the jsDelivr URL, and ensure any documentation or changelog notes which
version was pinned.
🪄 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: 64df0a7e-1dbb-45fe-b688-2f4df5097137
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (18)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.go
✅ Files skipped from review due to trivial changes (10)
- dto/group.go
- dto/setup.go
- dto/topup_creem.go
- dto/checkin.go
- dto/responses.go
- dto/twofa.go
- dto/token.go
- dto/user.go
- dto/subscription.go
- dto/topup.go
🚧 Files skipped from review as they are similar to previous changes (5)
- router/main.go
- dto/pricing.go
- dto/misc.go
- router/api-router.go
- go.mod
There was a problem hiding this comment.
♻️ Duplicate comments (1)
router/api-router.go (1)
78-79:⚠️ Potential issue | 🟡 MinorDocument the 2FA response branch on login.
controller.Logincan returndto.Login2FADatawhen 2FA is required, but this route only documents the request body and Turnstile query—no response type is specified. Generated clients will not expect the 2FA response shape.Consider adding a response annotation that covers both outcomes, or document this as a known limitation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@router/api-router.go` around lines 78 - 79, The route registration for auth.GinPost calling controller.Login currently documents only the request and Turnstile query but omits response types; update the route metadata to declare both possible responses (successful login and 2FA challenge) so generated clients know about the 2FA branch: add a response annotation/parameter referencing dto.Login2FAData alongside the normal success response (e.g., dto.LoginResponse or whatever success DTO your project uses) on the auth.GinPost call that registers controller.Login (or add a union/multiple response declarations if your routing helpers support it) so both outcomes are documented.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@router/api-router.go`:
- Around line 78-79: The route registration for auth.GinPost calling
controller.Login currently documents only the request and Turnstile query but
omits response types; update the route metadata to declare both possible
responses (successful login and 2FA challenge) so generated clients know about
the 2FA branch: add a response annotation/parameter referencing dto.Login2FAData
alongside the normal success response (e.g., dto.LoginResponse or whatever
success DTO your project uses) on the auth.GinPost call that registers
controller.Login (or add a union/multiple response declarations if your routing
helpers support it) so both outcomes are documented.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3bc5b6f8-07cd-4e1f-aabf-c1815f7b41be
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (19)
dto/api_responses.godto/checkin.godto/group.godto/misc.godto/pricing.godto/responses.godto/router.godto/setup.godto/subscription.godto/token.godto/topup.godto/topup_creem.godto/twofa.godto/user.gogo.modrouter/api-router.gorouter/main.gorouter/openapi.goweb/src/components/table/usage-logs/UsageLogsColumnDefs.jsx
✅ Files skipped from review due to trivial changes (12)
- dto/group.go
- dto/setup.go
- dto/topup_creem.go
- dto/responses.go
- dto/checkin.go
- dto/token.go
- dto/twofa.go
- dto/subscription.go
- dto/user.go
- dto/topup.go
- dto/misc.go
- dto/api_responses.go
🚧 Files skipped from review as they are similar to previous changes (2)
- router/main.go
- dto/pricing.go
…utes Adds optional OpenAPI 3.1 spec generation via Fuego (fuegogin adapter) for the consumer-facing API routes (~60 endpoints). Admin, relay, and channel management routes are left as plain Gin handlers, untouched. Gated by ENABLE_OPENAPI=true env var (off by default). When enabled: - GET /openapi.json returns the generated spec - GET /swagger serves Scalar API Reference UI No controller signatures are changed. Existing behavior is identical. The Fuego engine wraps route registration to collect OpenAPI metadata (tags, security schemes, request/response types) without affecting the HTTP runtime.
|
Closing: no longer maintaining these against upstream. |
📝 变更描述 / Description
Adds optional OpenAPI 3.1 spec generation via Fuego (fuegogin adapter) for the consumer-facing API routes only (~60 endpoints). Admin, relay, and channel management routes stay as plain Gin handlers. Gated by
ENABLE_OPENAPI=true(off by default).This is a scaled-down version of the closed #3292. The original touched 120 files and converted every controller to fuego/dto. This PR takes a different approach: zero controller changes. It wraps existing Gin handlers with
fuegoginfor OpenAPI metadata collection only. The HTTP runtime is identical when the flag is off.What's documented in the spec
What's NOT touched
/v1/*)func(c *gin.Context))web/changes)When enabled (
ENABLE_OPENAPI=true)GET /openapi.jsonreturns the generated specGET /swaggerserves the Scalar API Reference UI🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
Replaces closed #3292 with a reviewable scope.
✅ 提交前检查项 / Checklist
📸 运行证明 / Proof of Work
Backend:
go build -o /dev/null .passes.Frontend:
cd web/default && bun run buildpasses (zero frontend changes).Functional: with
ENABLE_OPENAPI=true,/openapi.jsonserves the spec and/swaggerserves Scalar UI. With the defaultENABLE_OPENAPI=false, no behavior changes.Scope comparison with closed #3292