diff --git a/src/sentry/workflow_engine/handlers/condition/issue_priority_deescalating_handler.py b/src/sentry/workflow_engine/handlers/condition/issue_priority_deescalating_handler.py index a8b2e28006fd..f3f217c92ae1 100644 --- a/src/sentry/workflow_engine/handlers/condition/issue_priority_deescalating_handler.py +++ b/src/sentry/workflow_engine/handlers/condition/issue_priority_deescalating_handler.py @@ -13,14 +13,7 @@ class IssuePriorityDeescalatingConditionHandler(DataConditionHandler[WorkflowEventData]): group = DataConditionHandler.Group.ACTION_FILTER subgroup = DataConditionHandler.Subgroup.ISSUE_ATTRIBUTES - comparison_json_schema = { - "anyOf": [ - {"type": "integer", "enum": [*PriorityLevel]}, - # Temporary compatibility for the automation builder's broken default. - # Remove after ISWF-3453 is complete and stored comparisons are cleaned up. - {"type": "boolean", "const": True}, - ] - } + comparison_json_schema = {"type": "integer", "enum": [*PriorityLevel]} @staticmethod def evaluate_value(event_data: WorkflowEventData, comparison: Any) -> bool: @@ -39,8 +32,8 @@ def evaluate_value(event_data: WorkflowEventData, comparison: Any) -> bool: # use this to determine if we've breached the comparison priority before highest_seen_priority = open_period.data.get("highest_seen_priority", current_priority) - # Preserve the current behavior for the automation builder's broken default. - # Remove this compatibility path after ISWF-3453 is complete. + # Existing rows may still contain the automation builder's previous boolean default. + # Keep evaluation compatible until those rows are migrated to a priority threshold. if comparison is True: return group.status == GroupStatus.RESOLVED diff --git a/tests/sentry/workflow_engine/endpoints/validators/test_base_data_condition.py b/tests/sentry/workflow_engine/endpoints/validators/test_base_data_condition.py index 212b9964fe9d..0a7502be3346 100644 --- a/tests/sentry/workflow_engine/endpoints/validators/test_base_data_condition.py +++ b/tests/sentry/workflow_engine/endpoints/validators/test_base_data_condition.py @@ -91,7 +91,7 @@ def test_issue_priority_deescalating(self) -> None: self._validator(Condition.ISSUE_PRIORITY_DEESCALATING, PriorityLevel.HIGH).is_valid() is True ) - assert self._validator(Condition.ISSUE_PRIORITY_DEESCALATING, True).is_valid() is True + assert self._validator(Condition.ISSUE_PRIORITY_DEESCALATING, True).is_valid() is False assert self._validator(Condition.ISSUE_PRIORITY_DEESCALATING, False).is_valid() is False assert self._validator(Condition.ISSUE_PRIORITY_DEESCALATING, 100).is_valid() is False diff --git a/tests/sentry/workflow_engine/handlers/condition/test_issue_priority_deescalating_handler.py b/tests/sentry/workflow_engine/handlers/condition/test_issue_priority_deescalating_handler.py index 9211c38b7d9c..8f70db15a659 100644 --- a/tests/sentry/workflow_engine/handlers/condition/test_issue_priority_deescalating_handler.py +++ b/tests/sentry/workflow_engine/handlers/condition/test_issue_priority_deescalating_handler.py @@ -59,12 +59,6 @@ def setUp(self) -> None: condition_result=True, condition_group=dc_critical.condition_group, ) - self.deescalating_dc_boolean = self.create_data_condition( - comparison=True, - type=self.condition, - condition_result=True, - condition_group=dc_critical.condition_group, - ) def update_group_and_open_period(self, priority: PriorityLevel) -> None: self.group.update(priority=priority) @@ -107,12 +101,21 @@ def test_critical(self) -> None: self.assert_passes(self.deescalating_dc_critical, self.event_data) def test_boolean_comparison_preserves_existing_behavior(self) -> None: + boolean_condition = self.create_data_condition( + comparison=DetectorPriorityLevel.HIGH, + type=self.condition, + condition_result=True, + condition_group=self.deescalating_dc_critical.condition_group, + ) + type(boolean_condition).objects.filter(id=boolean_condition.id).update(comparison=True) + boolean_condition.refresh_from_db() + self.update_group_and_open_period(priority=PriorityLevel.HIGH) self.update_group_and_open_period(priority=PriorityLevel.MEDIUM) - self.assert_does_not_pass(self.deescalating_dc_boolean, self.event_data) + self.assert_does_not_pass(boolean_condition, self.event_data) self.group.update(status=GroupStatus.RESOLVED) - self.assert_passes(self.deescalating_dc_boolean, self.event_data) + self.assert_passes(boolean_condition, self.event_data) @override_options( {"workflow_engine.group.type_id.open_periods_type_denylist": [DEFAULT_TYPE_ID]}