Skip to content

Commit 5de4abf

Browse files
armenzgAhmed-Labs
authored andcommitted
chore(deletions): Remove option (#102870)
This was added in #102811 and we don't need it anymore.
1 parent cfc866c commit 5de4abf

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

src/sentry/deletions/defaults/group.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from typing import Any
2222

2323
from sentry import models, options
24-
from sentry.db.models.base import Model
2524
from sentry.deletions.tasks.nodestore import delete_events_for_groups_from_nodestore_and_eventstore
2625
from sentry.issues.grouptype import GroupCategory, InvalidGroupTypeError
2726
from sentry.models.group import Group, GroupStatus
@@ -76,6 +75,7 @@
7675
models.GroupEmailThread,
7776
models.GroupSubscription,
7877
models.GroupReaction,
78+
models.Activity,
7979
RuleFireHistory,
8080
)
8181

@@ -96,16 +96,6 @@
9696
_GROUP_RELATED_MODELS = DIRECT_GROUP_RELATED_MODELS + ADDITIONAL_GROUP_RELATED_MODELS
9797

9898

99-
def get_group_related_models() -> Sequence[type[Model]]:
100-
"""
101-
Returns the tuple of models related to groups that should be deleted.
102-
Checks options at runtime to allow dynamic configuration.
103-
"""
104-
if options.get("deletions.activity.delete-in-bulk"):
105-
return _GROUP_RELATED_MODELS + (models.Activity,)
106-
return _GROUP_RELATED_MODELS
107-
108-
10999
class EventsBaseDeletionTask(BaseDeletionTask[Group]):
110100
"""
111101
Base class to delete events associated to groups and its related models.
@@ -217,7 +207,7 @@ def _delete_children(self, instance_list: Sequence[Group]) -> None:
217207
group_ids = [group.id for group in instance_list]
218208
# Remove child relations for all groups first.
219209
child_relations: list[BaseRelation] = []
220-
for model in get_group_related_models():
210+
for model in _GROUP_RELATED_MODELS:
221211
child_relations.append(ModelRelation(model, {"group_id__in": group_ids}))
222212

223213
error_groups, issue_platform_groups = separate_by_group_category(instance_list)

src/sentry/options/defaults.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,6 @@
354354
type=Bool,
355355
flags=FLAG_AUTOMATOR_MODIFIABLE,
356356
)
357-
register(
358-
"deletions.activity.delete-in-bulk",
359-
default=False,
360-
type=Bool,
361-
flags=FLAG_AUTOMATOR_MODIFIABLE,
362-
)
363357

364358
register(
365359
"cleanup.abort_execution",

src/sentry/reprocessing2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,10 @@
114114

115115
# Group-related models are only a few per-group and are migrated at
116116
# once.
117-
GROUP_MODELS_TO_MIGRATE_RAW = DIRECT_GROUP_RELATED_MODELS + (models.Activity,)
118-
119117
# If we were to move groupinbox to the new, empty group, inbox would show the
120118
# empty, unactionable group while it is reprocessing. Let post-process take
121119
# care of assigning GroupInbox like normally.
122-
GROUP_MODELS_TO_MIGRATE = tuple(x for x in GROUP_MODELS_TO_MIGRATE_RAW if x != models.GroupInbox)
120+
GROUP_MODELS_TO_MIGRATE = tuple(x for x in DIRECT_GROUP_RELATED_MODELS if x != models.GroupInbox)
123121

124122
# Event attachments and group reports are per-event. This means that:
125123
#

tests/sentry/deletions/test_group.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from sentry.deletions.tasks.groups import delete_groups_for_project
1313
from sentry.issues.grouptype import GroupCategory
1414
from sentry.issues.issue_occurrence import IssueOccurrence
15+
from sentry.models.activity import Activity
1516
from sentry.models.eventattachment import EventAttachment
1617
from sentry.models.group import Group
1718
from sentry.models.groupassignee import GroupAssignee
@@ -26,6 +27,7 @@
2627
from sentry.snuba.referrer import Referrer
2728
from sentry.testutils.cases import SnubaTestCase, TestCase
2829
from sentry.testutils.helpers.datetime import before_now
30+
from sentry.types.activity import ActivityType
2931
from sentry.utils.snuba import bulk_snuba_queries
3032
from tests.sentry.issues.test_utils import OccurrenceTestMixin
3133

@@ -62,6 +64,9 @@ def _create_event_with_many_group_children(self) -> Event:
6264
GroupHash.objects.create(project=self.project, group=event.group, hash=uuid4().hex)
6365
GroupMeta.objects.create(group=event.group, key="foo", value="bar")
6466
GroupRedirect.objects.create(group_id=event.group.id, previous_group_id=1)
67+
Activity.objects.create(
68+
group=event.group, project=self.project, type=ActivityType.SET_RESOLVED.value
69+
)
6570

6671
return event
6772

@@ -86,6 +91,7 @@ def test_delete_group_with_many_related_children(self) -> None:
8691
assert not UserReport.objects.filter(event_id=event.event_id).exists()
8792
assert not EventAttachment.objects.filter(event_id=event.event_id).exists()
8893

94+
assert not Activity.objects.filter(group_id=event.group.id).exists()
8995
assert not GroupRedirect.objects.filter(group_id=event.group.id).exists()
9096
assert not GroupHash.objects.filter(group_id=event.group.id).exists()
9197
assert not Group.objects.filter(id=event.group.id).exists()

0 commit comments

Comments
 (0)