Skip to content

fix(api): filter opportunities by enabled_providers server-side for all users (#1409) - #1423

Merged
cristim merged 1 commit into
mainfrom
fix/1409-enabled-providers-filter-opportunities
Jul 16, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/1409-enabled-providers-filter-opportunities

Conversation

@cristim

@cristim cristim commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • The Enabled Providers toggle in Admin > General Settings did not filter the Opportunities list for non-admin users. The client-side filter added in PR fix(ux/settings): three Settings-page UX fixes (#463 #466 #478) #486 silently fell through to a permissive default for any user lacking view:config permission (every group except Administrators), because GET /api/config returned 403 and cfgResponse was null.
  • Adds a server-side filterRecommendationsByEnabledProviders step in getRecommendations that reads global_config.enabled_providers via the config store, runs for every authenticated user (independently of view:config permission), and propagates DB errors fail-loud instead of silently passing all recs through.
  • The existing client-side filter in 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-only enabled_providers returns only the AWS rec from a mixed aws/azure/gcp set
  • TestGetRecommendations_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)
  • All 1665 existing internal/api tests pass
  • go build ./... exit 0, go vet ./... exit 0, gocyclo -over 10 empty, golangci-lint --new-from-rev=origin/main exit 0

)

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
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/bug Defect labels Jul 16, 2026
@cristim

cristim commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6ddafddb-44aa-44ec-a613-1f040c7ef17a

📥 Commits

Reviewing files that changed from the base of the PR and between f017cae and 5f72be3.

📒 Files selected for processing (2)
  • internal/api/handler_recommendations.go
  • internal/api/handler_recommendations_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1409-enabled-providers-filter-opportunities

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 536f3b2 into main Jul 16, 2026
19 checks passed
@cristim
cristim deleted the fix/1409-enabled-providers-filter-opportunities branch July 16, 2026 21:31
@cristim

cristim commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(admin/settings): Enabled Providers setting does not filter Opportunities list (regression after #463/PR #486)

1 participant