From 8ce9c970d60b21c6799f766414942035f37c03c9 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 10 Apr 2026 16:26:03 -0700 Subject: [PATCH] chore(flags): Remove `projects:alert-filters` feature flag This migration has been complete for many years. We've also mostly moved away from the `Rule` table, so just removing this flag. I'm not cleaning up the related code since I assume we'll fully remove issue alerts at some point. --- .../endpoints/project_rules_configuration.py | 5 ++-- .../api/serializers/rest_framework/rule.py | 27 ++++++++----------- src/sentry/features/temporary.py | 2 -- src/sentry/models/project.py | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/sentry/api/endpoints/project_rules_configuration.py b/src/sentry/api/endpoints/project_rules_configuration.py index c1c57afc8947f7..cdd1466ddbac50 100644 --- a/src/sentry/api/endpoints/project_rules_configuration.py +++ b/src/sentry/api/endpoints/project_rules_configuration.py @@ -36,7 +36,6 @@ def get(self, request: Request, project: Project) -> Response: available_ticket_actions = set() - project_has_filters = features.has("projects:alert-filters", project) can_create_tickets = features.has( "organizations:integrations-ticket-rules", project.organization ) @@ -48,8 +47,8 @@ def get(self, request: Request, project: Project) -> Response: # TODO: conditions need to be based on actions for rule_type, rule_cls in rules: node = rule_cls(project=project) - # skip over conditions if they are not in the migrated set for a project with alert-filters - if project_has_filters and node.id in MIGRATED_CONDITIONS: + # skip over conditions if they are not in the migrated set + if node.id in MIGRATED_CONDITIONS: continue if not can_create_tickets and node.id in TICKET_ACTIONS: diff --git a/src/sentry/api/serializers/rest_framework/rule.py b/src/sentry/api/serializers/rest_framework/rule.py index 7c4b55ffb6b807..a706f5c5c8951f 100644 --- a/src/sentry/api/serializers/rest_framework/rule.py +++ b/src/sentry/api/serializers/rest_framework/rule.py @@ -7,7 +7,6 @@ from rest_framework import serializers from rest_framework.exceptions import ValidationError -from sentry import features from sentry.api.fields.actor import OwnerActorField from sentry.constants import MIGRATED_CONDITIONS, TICKET_ACTIONS from sentry.models.environment import Environment @@ -107,23 +106,19 @@ def validate(self, attrs): } ) - # ensure that if a user has alert-filters enabled, they do not use old conditions - project = self.context["project"] + # ensure that we do not use old conditions conditions = attrs.get("conditions", tuple()) - project_has_filters = features.has("projects:alert-filters", project) - if project_has_filters: - old_conditions = [ - condition for condition in conditions if condition["id"] in MIGRATED_CONDITIONS - ] - if old_conditions: - raise serializers.ValidationError( - { - "conditions": "Conditions evaluating an event attribute, tag, or level are outdated please use an appropriate filter instead." - } - ) + old_conditions = [ + condition for condition in conditions if condition["id"] in MIGRATED_CONDITIONS + ] + if old_conditions: + raise serializers.ValidationError( + { + "conditions": "Conditions evaluating an event attribute, tag, or level are outdated please use an appropriate filter instead." + } + ) - # ensure that if a user has alert-filters enabled, they do not use a 'none' match on conditions - if project_has_filters and attrs.get("actionMatch") == "none": + if attrs.get("actionMatch") == "none": raise serializers.ValidationError( { "conditions": "The 'none' match on conditions is outdated and no longer supported." diff --git a/src/sentry/features/temporary.py b/src/sentry/features/temporary.py index 8d3dca153d29fa..e7f6cf8e796371 100644 --- a/src/sentry/features/temporary.py +++ b/src/sentry/features/temporary.py @@ -553,8 +553,6 @@ def register_temporary_features(manager: FeatureManager) -> None: ########################### # Enables quick testing of disabling transaction name clustering for a project. manager.add("projects:transaction-name-clustering-disabled", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False, default=False) - # Adds additional filters and a new section to issue alert rules. - manager.add("projects:alert-filters", ProjectFeature, FeatureHandlerStrategy.INTERNAL, default=True) manager.add("projects:discard-transaction", ProjectFeature, FeatureHandlerStrategy.INTERNAL, api_expose=False) # Enable error upsampling manager.add("projects:error-upsampling", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, default=False, api_expose=True) diff --git a/src/sentry/models/project.py b/src/sentry/models/project.py index b6885c87a30dad..4ae854b20d54ca 100644 --- a/src/sentry/models/project.py +++ b/src/sentry/models/project.py @@ -279,7 +279,7 @@ class flags(TypedClassBitField): # This Project has sent transactions has_transactions: bool - # This Project has filters + # has_alert_filters is DEPRECATED has_alert_filters: bool # This Project has sessions