Skip to content

ref(webhooks): remove legacy sentry_webhooks plugin#118077

Draft
Christinarlong wants to merge 3 commits into
masterfrom
Christinarlong/webhook-migration-pr2
Draft

ref(webhooks): remove legacy sentry_webhooks plugin#118077
Christinarlong wants to merge 3 commits into
masterfrom
Christinarlong/webhook-migration-pr2

Conversation

@Christinarlong

Copy link
Copy Markdown
Contributor

Summary

  • Removes the dead sentry_webhooks plugin (src/sentry/plugins/sentry_webhooks/), which has been fully replaced by the legacy_webhook SentryApp service
  • Adds a lightweight _LegacyWebhookStub in get_notification_plugins_for_org() so ACI discovery still finds "webhooks" via ProjectOption instead of the old plugin registration
  • Removes the skip_webhooks feature flag logic from notify_event.py (flag was already removed)
  • Updates all test fixtures to use direct ProjectOption calls instead of WebHooksPlugin

Test plan

  • pytest tests/sentry/rules/actions/test_notify_event.py passes
  • pytest tests/sentry/rules/actions/test_notify_event_service.py passes
  • pytest tests/sentry/workflow_engine/endpoints/test_organization_available_action_index.py passes
  • pytest tests/sentry/workflow_engine/endpoints/validators/actions/test_webhook.py passes
  • prek run -q passes

The old `sentry_webhooks` plugin has been fully replaced by the
`legacy_webhook` SentryApp service. This removes the dead plugin code
and adds a lightweight stub in `get_notification_plugins_for_org()` so
ACI discovery still finds "webhooks" via ProjectOption.

- Delete `src/sentry/plugins/sentry_webhooks/` and its tests
- Remove from INSTALLED_APPS, HIDDEN_PLUGINS, and mypy exclusions
- Remove skip_webhooks feature flag logic from notify_event.py
- Update test fixtures to use direct ProjectOption calls
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 18, 2026
Comment thread src/sentry/workflow_engine/processors/action.py Outdated
Move webhook discovery out of get_notification_plugins_for_org() into a
standalone get_legacy_webhook_service() function that checks ProjectOption
directly. Both ACI call sites now add the webhook service independently
of the plugin loop, making it easier to remove plugin discovery entirely
in the future.
Add project__status=ObjectStatus.ACTIVE to the ProjectOption query so
soft-deleted projects with stale webhooks:enabled options don't cause
the webhook service to appear in ACI discovery.
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 6ad391e in this run:

tests/sentry/api/endpoints/test_organization_plugins.py::OrganizationPluginsTest::test_exposes_plugins_across_all_org_projectslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_organization_plugins.py:12: in setUp
    plugins.get("webhooks").enable(self.projectA)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py::TestWebhookActionHandlerExecute::test_sentry_app_action_routes_to_sentry_app_webhooklog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py:40: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py::TestWebhookActionHandlerExecute::test_webhooks_action_routes_to_legacy_webhooklog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py:40: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/plugins/test_plugins.py::TestPluginsInstalled::test_plugin_slugslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/plugins/test_plugins.py:60: in test_plugin_slugs
    assert all_plugins == plugin_slugs
E   AssertionError: assert ['amazon-sqs'...'device', ...] == ['amazon-sqs'...'device', ...]
E     
E     Right contains one more item: �[0m�[33m'�[39;49;00m�[33mwebhooks�[39;49;00m�[33m'�[39;49;00m�[90m�[39;49;00m
E     
E     Full diff:
E     �[0m�[90m �[39;49;00m [�[90m�[39;49;00m
E     �[90m �[39;49;00m     'amazon-sqs',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'asana',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'bitbucket',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'browsers',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'dartplugin',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'device',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'github',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'gitlab',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'heroku',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'interface_types',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'javaplugin',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'javascriptplugin',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'jira',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'opsgenie',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'os',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'pagerduty',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'pivotal',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'pushover',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'redmine',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'segment',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'sessionstack',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'slack',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'splunk',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'trello',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'twilio',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'urls',�[90m�[39;49;00m
E     �[90m �[39;49;00m     'victorops',�[90m�[39;49;00m
E     �[91m-     'webhooks',�[39;49;00m�[90m�[39;49;00m
E     �[90m �[39;49;00m ]�[90m�[39;49;00m
tests/sentry/api/endpoints/test_organization_plugins_configs.py::OrganizationPluginsTest::test_enabled_not_configuredlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_organization_plugins_configs.py:56: in test_enabled_not_configured
    plugins.get("webhooks").enable(self.projectA)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/notifications/notification_action/action_handler_registry/test_plugin_handler.py::TestPluginActionHandlerExecute::test_sends_webhooklog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_plugin_handler.py:39: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/api/endpoints/test_organization_plugins.py::OrganizationPluginsTest::test_exposes_all_plugins_available_no_enabled_statelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_organization_plugins.py:12: in setUp
    plugins.get("webhooks").enable(self.projectA)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/api/endpoints/test_project_plugin_details.py::UpdateProjectPluginTest::test_simplelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_project_plugin_details.py:62: in test_simple
    self.get_success_response(
src/sentry/testutils/cases.py:636: in get_success_response
    assert_status_code(response, status.HTTP_200_OK)
src/sentry/testutils/asserts.py:46: in assert_status_code
    assert minimum <= response.status_code < maximum, response
E   AssertionError: <Response status_code=404, "application/json">
E   assert 404 < 201
E    +  where 404 = <Response status_code=404, "application/json">.status_code
tests/sentry/api/endpoints/test_project_plugin_details.py::DisableProjectPluginTest::test_simplelog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_project_plugin_details.py:131: in test_simple
    plugins.get("webhooks").enable(self.project)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py::TestWebhookActionHandlerExecute::test_non_group_event_does_nothinglog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py:40: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/api/endpoints/test_organization_plugins.py::OrganizationPluginsTest::test_ignore_plugins_that_dont_existlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_organization_plugins.py:12: in setUp
    plugins.get("webhooks").enable(self.projectA)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/api/endpoints/test_project_plugin_details.py::ProjectPluginDetailsTest::test_simplelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_project_plugin_details.py:27: in test_simple
    response = self.get_success_response(
src/sentry/testutils/cases.py:631: in get_success_response
    assert_status_code(response, status.HTTP_200_OK)
src/sentry/testutils/asserts.py:46: in assert_status_code
    assert minimum <= response.status_code < maximum, response
E   AssertionError: <Response status_code=404, "application/json">
E   assert 404 < 201
E    +  where 404 = <Response status_code=404, "application/json">.status_code
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py::TestWebhookActionHandlerExecute::test_sends_webhooklog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py:40: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/api/endpoints/test_project_plugin_details.py::EnableProjectPluginTest::test_simplelog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_project_plugin_details.py:83: in test_simple
    plugins.get("webhooks").disable(self.project)
    ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py::TestWebhookActionHandlerExecute::test_disabled_webhooks_does_not_sendlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/notifications/notification_action/action_handler_registry/test_webhook_handler.py:40: in setUp
    webhook_plugin = plugins.get("webhooks")
                     ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'
tests/sentry/plugins/test_migrate.py::MigratorTest::test_only_disable_enabled_pluginslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/plugins/test_migrate.py:63: in test_only_disable_enabled_plugins
    plugin_2 = plugins.get("webhooks")
               ^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/plugins/base/manager.py:68: in get
    raise KeyError(slug)
E   KeyError: 'webhooks'

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.

1 participant