Skip to content

feat(notifications): improve deploy email subjects#110348

Merged
dcramer merged 7 commits intomasterfrom
fix/deploy-email-subjects
Mar 11, 2026
Merged

feat(notifications): improve deploy email subjects#110348
dcramer merged 7 commits intomasterfrom
fix/deploy-email-subjects

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Mar 10, 2026

Improve deploy email subjects so they no longer use a reply-style Re: prefix and instead include the projects visible to the recipient.

These deploy emails were not actually threading against anything useful, and the old subject omitted the project context people use to scan notifications. This change builds the subject from the same recipient-filtered project list shown in the email body, sorts that list alphabetically, and caps longer lists with +N more to keep the subject readable.

The change is intentionally limited to the deploy email path. It also adds regression coverage for recipient-scoped deploy subjects and for group-less activity emails so future subject/threading changes do not reintroduce this behavior.

@dcramer dcramer requested a review from a team as a code owner March 10, 2026 19:51
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 10, 2026
Copy link
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only thought is maybe we feature flag to our orgs for a day and make sure all looks good?

@dcramer
Copy link
Member Author

dcramer commented Mar 10, 2026

@JoshFerge low risk imo feature flag complexity is too high given how we use them. worst case we just revert it if for some reason it ends up being an awful idea (tho i doubt it)

Copy link
Contributor

@Christinarlong Christinarlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes lgtm!

dcramer and others added 2 commits March 10, 2026 16:43
Co-authored-by: Christinarlong <60594860+Christinarlong@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

Backend Test Failures

Failures on 8a53591 in this run:

tests/sentry/mail/activity/test_release.py::ReleaseTestCase::test_subject_caps_projects_at_twolog
tests/sentry/mail/activity/test_release.py:263: in test_subject_caps_projects_at_two
    assert subjects_by_recipient[self.user1.email] == self.get_prefixed_subject(
E   AssertionError: assert '[Sentry] Dep...to production' == '[Sentry] Dep...to production'
E     
E     Skipping 43 identical leading characters in diff, use -v to show
E     - h +1 more aaaaaaaaaaaa to production
E     + h +1 more to version aaaaaaaaaaaa to production
E     ?          +++++++++++
tests/sentry/mail/activity/test_release.py::ReleaseTestCase::test_simplelog
tests/sentry/mail/activity/test_release.py:175: in test_simple
    assert {msg.subject for msg in mail.outbox} == {expected_subject}
E   AssertionError: assert {'[Sentry] De...o production'} == {'[Sentry] De...o production'}
E     
E     Extra items in the left set:
E     '[Sentry] Deployed smiling-goose to version aaaaaaaaaaaa to production'
E     Extra items in the right set:
E     '[Sentry] Deployed smiling-goose aaaaaaaaaaaa to production'
E     
E     Full diff:
E       {
E     -     '[Sentry] Deployed smiling-goose aaaaaaaaaaaa to production',
E     +     '[Sentry] Deployed smiling-goose to version aaaaaaaaaaaa to production',
E     ?                                      +++++++++++
E       }
tests/sentry/mail/activity/test_release.py::ReleaseTestCase::test_subject_uses_recipient_visible_projectslog
tests/sentry/mail/activity/test_release.py:223: in test_subject_uses_recipient_visible_projects
    assert subjects_by_recipient[self.user1.email] == self.get_prefixed_subject(
E   AssertionError: assert '[Sentry] Dep...to production' == '[Sentry] Dep...to production'
E     
E     Skipping 37 identical leading characters in diff, use -v to show
E     - per-boxer aaaaaaaaaaaa to production
E     + per-boxer to version aaaaaaaaaaaa to production
E     ?          +++++++++++

dcramer and others added 2 commits March 10, 2026 16:56
Use the intended deploy email subject format for release notifications when project slugs are included.

Update the release mail tests to assert the new subject text so the change is covered.

Co-Authored-By: Codex <noreply@openai.com>
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Keep the no-project subject fallback aligned with the per-recipient deploy\nsubject format. This preserves the title used when no recipient context\nis available and addresses the remaining review-bot regression note.\n\nCo-Authored-By: Claude <noreply@anthropic.com>
@dcramer dcramer merged commit 79d83f6 into master Mar 11, 2026
61 checks passed
@dcramer dcramer deleted the fix/deploy-email-subjects branch March 11, 2026 17:52
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.

3 participants