Skip to content

chore(seer-slack): Move organization resolution to control#113107

Merged
leeandher merged 9 commits intomasterfrom
leanderrodrigues/iswf-2467-escalate-organization-resolution-from-cell-to-control
Apr 16, 2026
Merged

chore(seer-slack): Move organization resolution to control#113107
leeandher merged 9 commits intomasterfrom
leanderrodrigues/iswf-2467-escalate-organization-resolution-from-cell-to-control

Conversation

@leeandher
Copy link
Copy Markdown
Member

This is set up to allow us to properly route for integrations sharing installations across cells.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 15, 2026

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 15, 2026
Comment thread src/sentry/integrations/slack/requests/event.py Outdated
@leeandher leeandher force-pushed the leanderrodrigues/iswf-2467-escalate-organization-resolution-from-cell-to-control branch from aae2e09 to 7a3efea Compare April 16, 2026 14:36
leeandher and others added 4 commits April 16, 2026 11:31
… flow

Replace the separate cell-resolution code path for Seer Slack events with
organization filtering in the standard routing flow. Instead of directly
resolving to a cell in _maybe_get_response_from_event_request, the new
_filter_organizations_for_seer_event method narrows the organization list
so normal cell routing handles it.

Also reuse the validated slack_request from get_integration_from_request
instead of re-initializing it in multiple places, add RpcOrganization
support to feature handler type hints, and rename is_seer_explorer_request
to is_seer_agent_request.

Refs ISWF-2467
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adjust SlackRequestParserTest to match the refactored routing flow:
call get_integration_from_request() before get_organizations_from_integration
so self.slack_request is populated. Move signing secret mock to setUp
via addCleanup and consolidate SlackRequestParserSeerEventRoutingTest
into the main test class.

Add tests for SlackEventRequest properties: is_seer_agent_request,
is_assistant_thread_event, and the assistant-thread-aware channel_id,
user_id, and thread_ts accessors.

Refs ISWF-2467
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SlackEventRequestSeerResolutionTest covering all exit paths:
identity not linked, no org integrations, org not found, org inactive,
no Seer access, user not a member, and successful resolution.

Uses RequestFactory with SlackDMEndpoint().initialize_request() to
exercise the real DRF request and validation code paths rather than
mocking request internals.

Refs ISWF-2467
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move _validate_data() before _log_request() in validate() so that
invalid request data raises SlackRequestError(400) instead of
crashing in _log_request when it accesses self.request.data.

Also switch logging_data to read from self.data (the validated copy)
rather than self.request.data directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leeandher leeandher marked this pull request as ready for review April 16, 2026 16:35
@leeandher leeandher requested review from a team as code owners April 16, 2026 16:35
Comment thread src/sentry/middleware/integrations/parsers/slack.py
@github-actions

This comment was marked as outdated.

resolve_seer_organization is invoked in both the control-silo parser
(for cell routing) and the region-silo endpoint (for request handling).
Sending the link prompt as a side effect of resolution caused unlinked
users to receive two ephemeral link prompts per request.

Move the send_identity_link_prompt call out of resolve_seer_organization
and into the region-silo webhook endpoint, so it fires exactly once when
the halt reason is IDENTITY_NOT_LINKED.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f8f9f23. Configure here.

Comment thread src/sentry/integrations/slack/webhooks/event.py
Copy link
Copy Markdown
Member

@alexsohn1126 alexsohn1126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@leeandher leeandher merged commit d6a2050 into master Apr 16, 2026
77 checks passed
@leeandher leeandher deleted the leanderrodrigues/iswf-2467-escalate-organization-resolution-from-cell-to-control branch April 16, 2026 19:35
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