Repository navigation
fix(api): filter opportunities by enabled_providers server-side for all users (#1409) - #1423
Conversation
) The client-side filter introduced in PR #486 only worked for users who have view:config permission (Administrators only). For all other groups (Standard Users, Read-Only Users, Plan Authors, etc.) GET /api/config returns 403, so cfgResponse was null and the filter silently fell through to the permissive default, showing every provider's recs regardless of the Admin > General Settings toggle. Add a server-side filterRecommendationsByEnabledProviders step in getRecommendations that reads the global config via the same store path used by every other handler. It runs before the account-scoping step and for all authenticated users, so the enabled_providers setting is enforced independently of the caller's view:config permission. Config read errors are propagated (fail-loud); empty EnabledProviders preserves the permissive default. Closes #1409
|
@coderabbitai review |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
|
Merged to main after independent adversarial review (verdict SHIP, fail-before/pass-after verified) + all CI green; closes #1409. Enabled Providers now filters the Opportunities list server-side (fail-loud on config read error). |
Summary
view:configpermission (every group except Administrators), becauseGET /api/configreturned 403 andcfgResponsewas null.filterRecommendationsByEnabledProvidersstep ingetRecommendationsthat readsglobal_config.enabled_providersvia the config store, runs for every authenticated user (independently ofview:configpermission), and propagates DB errors fail-loud instead of silently passing all recs through.loadRecommendations()(PR fix(ux/settings): three Settings-page UX fixes (#463 #466 #478) #486) is left in place as belt-and-suspenders for admin users.Closes #1409
Test plan
TestGetRecommendations_EnabledProvidersFilter/disabled_provider_recs_are_excluded: AWS-onlyenabled_providersreturns only the AWS rec from a mixed aws/azure/gcp setTestGetRecommendations_EnabledProvidersFilter/empty_enabled_providers_passes_all_recs_through: empty list is permissive (all recs pass)TestGetRecommendations_EnabledProvidersFilter/config_read_error_is_surfaced: DB error propagates (no silent bypass)internal/apitests passgo build ./...exit 0,go vet ./...exit 0,gocyclo -over 10empty,golangci-lint --new-from-rev=origin/mainexit 0