Skip to content

feat(notifications): Store the integration on NotificationThread - #128764

Open
alexsohn1126 wants to merge 1 commit into
masterfrom
alexsohn/notification-thread-object-writes
Open

alexsohn1126 wants to merge 1 commit into
masterfrom
alexsohn/notification-thread-object-writes

Conversation

@alexsohn1126

@alexsohn1126 alexsohn1126 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Threads the notification platform saves now remember which integration sent them, in a new nullable integration_id column. Nothing reads it yet, so nothing changes for people in Slack.

A thread row only has the channel, so anything that wants to post back into a thread later couldn't tell which Slack workspace to use. The platform now takes the integration from the target when it creates a thread. Existing threads keep it empty. There's also a small helper to list the threads for an object, using the object columns #127289 started filling in.

The column is added during deploy, before the new code runs. #128771 uses both to send Seer investigation conclusions to every metric alert thread. Orgs with metric alert threading turned off don't save threads, so they only get the conclusion in the thread where someone clicked.

refs CW-2217

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 26, 2026
@alexsohn1126
alexsohn1126 force-pushed the alexsohn/notification-thread-object-writes branch from 035fc4b to cc3dc0b Compare October 26, 2026 18:30
@alexsohn1126 alexsohn1126 changed the title feat(notifications): Record the group and integration on metric alert threads feat(notifications): Store the integration on NotificationThread Oct 26, 2026
@alexsohn1126
alexsohn1126 force-pushed the alexsohn/notification-thread-object-writes branch 2 times, most recently from 3b4483e to 77813d4 Compare October 26, 2026 19:13
@getsentry getsentry deleted a comment from github-actions Bot Oct 26, 2026
@alexsohn1126
alexsohn1126 marked this pull request as ready for review October 26, 2026 19:21
@alexsohn1126
alexsohn1126 requested review from a team as code owners October 26, 2026 19:21
@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown

CW-2217

)
object_id = BoundedBigIntegerField(null=True)

integration_id = BoundedBigIntegerField(null=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there's precedent elsewhere to use a HybridCloudForeignKey which will handle the delete case for you:

integration_id = HybridCloudForeignKey("sentry.Integration", null=True, on_delete="SET_NULL")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 54bad49

Add a nullable integration_id column to NotificationThread, set from the target when the platform creates a thread. Add a ThreadingService helper to list the threads for an object.
@alexsohn1126
alexsohn1126 force-pushed the alexsohn/notification-thread-object-writes branch from 77813d4 to 54bad49 Compare October 29, 2026 18:02
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/notifications/migrations/0017_add_notificationthread_integration_id.py

for 0017_add_notificationthread_integration_id in notifications

--
-- Add field integration_id to notificationthread
--
ALTER TABLE "notifications_notificationthread" ADD COLUMN "integration_id" bigint NULL;
CREATE INDEX CONCURRENTLY "notifications_notificationthread_integration_id_a4a80f02" ON "notifications_notificationthread" ("integration_id");

@alexsohn1126
alexsohn1126 removed this pull request from stack #128772 October 29, 2026 19:20

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.

2 participants