Skip to content

ref(seer): Gate Seer access on not being self-hosted - #125161

Open
NicoHinderling wants to merge 4 commits into
masterfrom
ref/seer-availability-helpers
Open

NicoHinderling wants to merge 4 commits into
masterfrom
ref/seer-availability-helpers

Conversation

@NicoHinderling

Copy link
Copy Markdown
Contributor

Adds is_seer_available(), which is false on self-hosted installs, and folds it into has_seer_access and has_seer_access_with_detail next to the existing organizations:gen-ai-features check. On the frontend, the flag-plus-hideAiFeatures expression that useAiConfig and useOrganizationSeerSetup each computed inline moves into one util, areAiFeaturesAllowed, which also checks ConfigStore.isSelfHosted.

This is the first of three PRs replacing gen-ai-features with an explicit "not self-hosted" rule. The flag is on for every SaaS and single-tenant cell and false on self-hosted only because no flagpole config exists there, so on SaaS nothing changes, and a self-hosted install that never set the flag sees no difference either. Single-tenant settings set SENTRY_SELF_HOSTED to False, so those cells keep Seer.

Sentry's test suite runs in self-hosted mode by default, so every test class that reaches the real helper rather than patching it now pins SENTRY_SELF_HOSTED=False, the same way acceptance tests already do. A sweep of every helper caller found sixteen such classes beyond the obvious ones. The seer workflows endpoint tests also neutralize the endpoint rate limiter, which the middleware skips on self-hosted but enforces once the class runs as SaaS. The self-hosted denial now reports "Seer is not available on this installation." instead of a missing flag.

Add is_seer_available(), which is false on self-hosted installs, and fold
it into has_seer_access and has_seer_access_with_detail next to the
existing gen-ai-features flag check. The flag is already false on
self-hosted because no flagpole config exists there, so nothing changes
yet; this puts the rule in one place ahead of removing the flag.
@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@NicoHinderling
NicoHinderling marked this pull request as ready for review September 22, 2026 02:41
@NicoHinderling
NicoHinderling requested review from a team as code owners September 22, 2026 02:41
Both useAiConfig and useOrganizationSeerSetup computed the same
flag-plus-hideAiFeatures expression. Move it into one util that also
checks ConfigStore.isSelfHosted, and point both hooks at it. No behavior
change: the flag is already off on self-hosted.
The sentry test suite runs in self-hosted mode by default, and
has_seer_access now returns False there. The test classes that call the
real helper rather than patching it need SENTRY_SELF_HOSTED=False, the
same way acceptance tests already pin it.
A sweep of every caller of the Seer access helpers found sixteen more
test classes that reach the real helper indirectly, through the agent
client, the autofix operator, Night Shift, PR metrics, and the seer
workflows endpoint. Pin them all to SaaS mode. The workflows endpoint
class also neutralizes the endpoint rate limiter, which the middleware
skips on self-hosted but enforces once the class runs as SaaS.

Also give the self-hosted denial its own message in
has_seer_access_with_detail instead of reporting a missing flag.
@NicoHinderling
NicoHinderling force-pushed the ref/seer-availability-helpers branch from 96145dd to 3832781 Compare September 22, 2026 02:46

This branch has not been deployed

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

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant