Skip to content

ref(notifications): Create NotificationRule to be used in place of punned Rule - #126123

Draft
kcons wants to merge 10 commits into
masterfrom
kcons/moveon
Draft

kcons wants to merge 10 commits into
masterfrom
kcons/moveon

Conversation

@kcons

@kcons kcons commented Oct 1, 2026

Copy link
Copy Markdown
Member

Instead of reusing Rule, introduce a new type that can be created from a Rule or not, and provide a easy way to identify where Rules are still being used so we can remove them.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 00da073 in this run:

tests/sentry/digests/test_utilities.py::GetPersonalizedDigestsTestCase::test_team_without_members_with_legacy_rule_id — log
[gw1] linux -- Python 3.13.15 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/digests/test_utilities.py:397: in test_team_without_members_with_legacy_rule_id
    assert_rule_ids(digest, [rule.data["actions"][0]["legacy_rule_id"]])
tests/sentry/digests/test_utilities.py:119: in assert_rule_ids
    assert rule.id in expected_rule_ids
           ^^^^^^^
E   AttributeError: 'NotificationRule' object has no attribute 'id'
tests/sentry/integrations/slack/test_message_builder.py::BuildGroupAttachmentTest::test_build_group_block_with_workflow_only — log
[gw1] linux -- Python 3.13.15 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/integrations/slack/test_message_builder.py:465: in test_build_group_block_with_workflow_only
    blocks = SlackIssuesMessageBuilder(self.group, rules=[rule]).build()["blocks"]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/integrations/slack/message_builder/issues.py:610: in build
    key, value = get_rule_or_workflow_id(self.rules[0])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/notifications/utils/rules.py:93: in get_rule_or_workflow_id
    if rule.legacy_rule_id is not None:
       ^^^^^^^^^^^^^^^^^^^
E   AttributeError: 'Rule' object has no attribute 'legacy_rule_id'
tests/sentry/digests/test_utilities.py::GetPersonalizedDigestsTestCase::test_direct_email_with_legacy_rule_id — log
[gw0] linux -- Python 3.13.15 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/digests/test_utilities.py:328: in test_direct_email_with_legacy_rule_id
    assert_rule_ids(
tests/sentry/digests/test_utilities.py:119: in assert_rule_ids
    assert rule.id in expected_rule_ids
           ^^^^^^^
E   AttributeError: 'NotificationRule' object has no attribute 'id'
tests/sentry/digests/test_utilities.py::GetPersonalizedDigestsTestCase::test_simple_with_legacy_rule_id — log
[gw0] linux -- Python 3.13.15 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/digests/test_utilities.py:287: in test_simple_with_legacy_rule_id
    assert_rule_ids(
tests/sentry/digests/test_utilities.py:119: in assert_rule_ids
    assert rule.id in expected_rule_ids
           ^^^^^^^
E   AttributeError: 'NotificationRule' object has no attribute 'id'

This branch has not been deployed

No deployments
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