refactor: categorize leftover config options#682
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactors configuration names from negation-based to affirmation-based, nests flat config fields into composite types (Database, Analytics, Resources), and updates backend controllers, bootstrap, and frontend schema/components to use the new fields and semantics. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
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.
🧹 Nitpick comments (1)
internal/controller/resources_controller.go (1)
20-27: Consider guarding file server initialization when resources are disabled.The
fileServeris initialized unconditionally even whenconfig.Pathis empty orconfig.Enabledis false. While the handler correctly guards against serving in these cases, creating the file server is unnecessary overhead.♻️ Optional: Guard fileServer initialization
func NewResourcesController(config ResourcesControllerConfig, router *gin.RouterGroup) *ResourcesController { - fileServer := http.StripPrefix("/resources", http.FileServer(http.Dir(config.Path))) + var fileServer http.Handler + if config.Enabled && config.Path != "" { + fileServer = http.StripPrefix("/resources", http.FileServer(http.Dir(config.Path))) + } return &ResourcesController{ config: config, router: router, fileServer: fileServer, } }Note: If you apply this, also add a nil check in
resourcesHandlerbefore callingfileServer.ServeHTTP.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/controller/resources_controller.go` around lines 20 - 27, NewResourcesController currently always creates fileServer even when resources are disabled or Path is empty; update NewResourcesController so it only sets fileServer when config.Enabled is true and config.Path is non-empty (e.g., leave fileServer nil otherwise), and then add a nil check in resourcesHandler before calling fileServer.ServeHTTP to avoid dereferencing a nil pointer when resources are disabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/controller/resources_controller.go`:
- Around line 20-27: NewResourcesController currently always creates fileServer
even when resources are disabled or Path is empty; update NewResourcesController
so it only sets fileServer when config.Enabled is true and config.Path is
non-empty (e.g., leave fileServer nil otherwise), and then add a nil check in
resourcesHandler before calling fileServer.ServeHTTP to avoid dereferencing a
nil pointer when resources are disabled.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
.env.examplefrontend/src/components/layout/layout.tsxfrontend/src/pages/continue-page.tsxfrontend/src/schemas/app-context-schema.tsinternal/bootstrap/app_bootstrap.gointernal/bootstrap/router_bootstrap.gointernal/config/config.gointernal/controller/context_controller.gointernal/controller/context_controller_test.gointernal/controller/resources_controller.gointernal/controller/resources_controller_test.go
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #682 +/- ##
==========================================
- Coverage 15.39% 15.31% -0.09%
==========================================
Files 50 50
Lines 3643 3663 +20
==========================================
Hits 561 561
- Misses 3025 3045 +20
Partials 57 57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Chores
Bug Fixes