Skip to content

ref(api): Remove api-client-kind-check flag checks - #126847

Merged
DominikB2014 merged 1 commit into
masterfrom
junior/remove-api-client-kind-check-flag
Oct 8, 2026
Merged

DominikB2014 merged 1 commit into
masterfrom
junior/remove-api-client-kind-check-flag

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

organizations:api-client-kind-check is fully rolled out: its GA segment in sentry-options-automator (options/default/flagpole.yaml) is set to rollout: 100 with no conditions, and no region-specific overrides exist. This is stage 1 of removing the flag. It drops every read of the flag; the registration stays for now.

Changes

  • api/base.py: Endpoint.dispatch now calls set_client_kind_attributes for any endpoint that resolves an Organization/RpcOrganization, without a features.has check. With the flag at 100% that's the same behavior as today, and it skips one flagpole evaluation per request. Also drops the now-unused features import.
  • api/client_kind.py: removes the FEATURE_FLAG constant and the opt-in notes in the docstrings.
  • middleware/access_log.py: comment update.
  • Tests: removes the self.feature(...) wrappers and deletes the two flag-off tests, test_records_nothing_when_the_organization_has_not_opted_in and test_a_declared_kind_does_not_bypass_the_opt_in, plus test_absent_for_an_org_that_has_not_opted_in in the access-log tests.

Follow-ups, in order

  1. After this deploys, remove feature.organizations:api-client-kind-check from sentry-options-automator.
  2. After that automator run is green, remove the manager.add(...) registration in features/temporary.py.

Only syntax-checked locally (py_compile); relying on CI for the test suite.

via Dominik Buszowiecki.

--

View Junior Session [Sentry]

Co-Authored-By: Dominik Buszowiecki <dominik.buszowiecki@sentry.io>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 8, 2026
@DominikB2014
DominikB2014 marked this pull request as ready for review October 8, 2026 13:48
@DominikB2014
DominikB2014 requested review from a team as code owners October 8, 2026 13:48
@DominikB2014
DominikB2014 requested a review from a team October 8, 2026 13:48
@DominikB2014
DominikB2014 merged commit 2d7630b into master Oct 8, 2026
89 checks passed
@DominikB2014
DominikB2014 deleted the junior/remove-api-client-kind-check-flag branch October 8, 2026 14:36
DominikB2014 added a commit that referenced this pull request Oct 8, 2026
Follow-up to #126847, which removed every read of
`organizations:api-client-kind-check`. Nothing references the flag
anymore, so this drops its `manager.add(...)` registration in
`features/temporary.py`.

Safe to merge independently of the automator change: nothing calls
`features.has` for this flag, so a leftover flagpole value is ignored.
The value itself is removed in getsentry/sentry-options-automator#10093,
which should land only after #126847 is deployed.

<!-- junior-request-attribution:start -->
via **Dominik Buszowiecki**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0BAH48EJL8%3A1791470226.057899 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0BAH48EJL8%3A1791470226.057899)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0BAH48EJL8%3A1791470226.057899/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Dominik Buszowiecki <dominik.buszowiecki@sentry.io>
DominikB2014 added a commit that referenced this pull request Oct 9, 2026
…6849)

Lets callers of `search-agent/start` declare who they are via an
allowlisted `referrer`, the same way the events endpoints validate
`referrer` against the `Referrer` enum. Sentry forwards the result to
Seer, which uses it to pick the RPC referrer. The main goal is to split
MCP traffic out of the search bar referrers.

**Changes**
- New `SearchAgentReferrer` allowlist: `search_bar` and `mcp`.
- `SearchAgentStartSerializer` accepts an optional top-level `referrer`.
- `resolve_referrer(request, raw)`:
1. If `get_client_kind(request)` is `mcp` (the `sentry-mcp/` user
agent), the result is `mcp`. The server-derived signal wins over
whatever the client declares.
  2. Otherwise a declared value on the allowlist is used.
3. A missing value gives `None`. An unknown value is logged
(`search_agent.unknown_referrer`) and dropped, not rejected, so outdated
clients keep working.
- `send_search_agent_start_request` forwards the result as
`options["source"]`, and the endpoint tags `search_agent.referrer`.
- Tests cover forwarding, an allowlisted value, an unknown value being
dropped, a missing value, and the MCP user agent overriding a declared
`search_bar`.

**Related PRs**
- getsentry/seer#8741 reads `options.source`. `mcp` maps to
`assisted_query.mcp.<strategy>`; `search_bar`, missing and unknown
values keep the existing `assisted_query.<strategy>` referrers.
- The frontend PR (linked in a comment) sends `referrer: 'search_bar'`
from `useAskSeerPolling`. Land this backend PR first.
- Either this PR or the Seer PR can deploy first.

**Note:** `get_client_kind`'s docstring still says to check
`organizations:api-client-kind-check`. That flag is at 100% GA, and
#126847 removes the check.

Lint and format checked with ruff. Relying on CI for tests.

<!-- junior-request-attribution:start -->
via **Dominik Buszowiecki**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0BAH48EJL8%3A1791464935.912199 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0BAH48EJL8%3A1791464935.912199)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0BAH48EJL8%3A1791464935.912199/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Dominik Buszowiecki <dominik.buszowiecki@sentry.io>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants