From 6526f85d6a68bba6050d4c88aae314fbefefe174 Mon Sep 17 00:00:00 2001 From: Raj Joshi Date: Thu, 10 Apr 2025 14:39:44 -0700 Subject: [PATCH 1/3] :wrench: chore: add workflow_id to sentrya pp action --- src/sentry/sentry_apps/tasks/sentry_apps.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sentry/sentry_apps/tasks/sentry_apps.py b/src/sentry/sentry_apps/tasks/sentry_apps.py index 694a8fd86a1955..c605e06df4642d 100644 --- a/src/sentry/sentry_apps/tasks/sentry_apps.py +++ b/src/sentry/sentry_apps/tasks/sentry_apps.py @@ -20,6 +20,7 @@ from sentry.models.organization import Organization from sentry.models.organizationmapping import OrganizationMapping from sentry.models.project import Project +from sentry.notifications.notifications.rules import get_key_from_rule_data from sentry.sentry_apps.api.serializers.app_platform_event import AppPlatformEvent from sentry.sentry_apps.metrics import ( SentryAppEventType, @@ -529,7 +530,10 @@ def notify_sentry_app(event: GroupEvent, futures: Sequence[RuleFuture]): id = f.rule.id # if we are using the new workflow engine, we need to use the legacy rule id if features.has("organizations:workflow-engine-trigger-actions", event.group.organization): - id = f.rule.data.get("actions", [{}])[0].get("legacy_rule_id") + id = get_key_from_rule_data(f.rule.data, "legacy_rule_id") + assert id is not None + elif features.has("organizations:workflow-engine-ui-links", event.group.organization): + id = get_key_from_rule_data(f.rule.data, "workflow_id") assert id is not None settings = f.kwargs.get("schema_defined_settings") From 92c72dbcb56d2a4cf57d55bda7989e4929f129b6 Mon Sep 17 00:00:00 2001 From: Raj Joshi Date: Thu, 10 Apr 2025 14:42:06 -0700 Subject: [PATCH 2/3] :wrench: chore: remove is none check --- src/sentry/sentry_apps/tasks/sentry_apps.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sentry/sentry_apps/tasks/sentry_apps.py b/src/sentry/sentry_apps/tasks/sentry_apps.py index c605e06df4642d..92e4221d15ce12 100644 --- a/src/sentry/sentry_apps/tasks/sentry_apps.py +++ b/src/sentry/sentry_apps/tasks/sentry_apps.py @@ -531,10 +531,8 @@ def notify_sentry_app(event: GroupEvent, futures: Sequence[RuleFuture]): # if we are using the new workflow engine, we need to use the legacy rule id if features.has("organizations:workflow-engine-trigger-actions", event.group.organization): id = get_key_from_rule_data(f.rule.data, "legacy_rule_id") - assert id is not None elif features.has("organizations:workflow-engine-ui-links", event.group.organization): id = get_key_from_rule_data(f.rule.data, "workflow_id") - assert id is not None settings = f.kwargs.get("schema_defined_settings") if settings: From 6c0d0855ecaaf06748f336027afee946f2bafd34 Mon Sep 17 00:00:00 2001 From: Raj Joshi Date: Mon, 14 Apr 2025 09:21:32 -0700 Subject: [PATCH 3/3] :wrench: chore: fix typo --- src/sentry/sentry_apps/tasks/sentry_apps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sentry/sentry_apps/tasks/sentry_apps.py b/src/sentry/sentry_apps/tasks/sentry_apps.py index 92e4221d15ce12..7021fe6211b657 100644 --- a/src/sentry/sentry_apps/tasks/sentry_apps.py +++ b/src/sentry/sentry_apps/tasks/sentry_apps.py @@ -530,9 +530,9 @@ def notify_sentry_app(event: GroupEvent, futures: Sequence[RuleFuture]): id = f.rule.id # if we are using the new workflow engine, we need to use the legacy rule id if features.has("organizations:workflow-engine-trigger-actions", event.group.organization): - id = get_key_from_rule_data(f.rule.data, "legacy_rule_id") + id = get_key_from_rule_data(f.rule, "legacy_rule_id") elif features.has("organizations:workflow-engine-ui-links", event.group.organization): - id = get_key_from_rule_data(f.rule.data, "workflow_id") + id = get_key_from_rule_data(f.rule, "workflow_id") settings = f.kwargs.get("schema_defined_settings") if settings: