Skip to content

Conversation

@jasonyuezhang
Copy link
Owner

Add an outbox to update actions statuses when a sentry app installation is deleted. This will be eventually consistent.


Copied from getsentry#101896
Original PR: getsentry#101896

@propel-test-bot
Copy link

Add Outbox Pattern for Sentry App Installation Deletion Status Updates

This PR implements an outbox mechanism to ensure that actions associated with a SentryAppInstallation are updated to a disabled status when the installation is deleted. The update is performed in an eventually consistent manner using the outbox pattern, aligning with the approach already in use for other Sentry app and integration events. The change includes a new outbox category (SENTRY_APP_INSTALLATION_DELETE), model and receiver logic to enqueue and process these outboxes, and comprehensive testing to ensure correct, eventual propagation of action state changes across regions.

Key Changes

• Introduced OutboxCategory.SENTRY_APP_INSTALLATION_DELETE to the outbox framework in src/sentry/hybridcloud/outbox/category.py.
• Added an outboxes_for_delete() method and custom delete() logic to SentryAppInstallation in src/sentry/sentry_apps/models/sentry_app_installation.py, which enqueues a control outbox for each region at deletion time.
• Added a receiver process_sentry_app_installation_deletes in src/sentry/receivers/outbox/control.py that disables related actions via their UUIDs when an installation deletion outbox is processed.
• Removed direct action status update logic from SentryAppInstallationDeletionTask in src/sentry/deletions/defaults/sentry_app_installation.py, routing updates through the outbox-driven path instead.
• Adjusted corresponding tests in tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installation_details.py and tests/sentry/deletions/test_sentry_app_installations.py to reflect the new outbox-driven disabling behavior.
• Minor fixes in Sentry app deletion in src/sentry/sentry_apps/models/sentry_app.py to ensure proper ordering and context of deletion logic.

Affected Areas

src/sentry/sentry_apps/models/sentry_app_installation.py (core model + deletion logic)
src/sentry/hybridcloud/outbox/category.py (outbox categories)
src/sentry/receivers/outbox/control.py (signal handling for outbox events)
src/sentry/deletions/defaults/sentry_app_installation.py (deletion-task orchestration)
• Related tests in tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installation_details.py and tests/sentry/deletions/test_sentry_app_installations.py

This summary was automatically generated by @propel-code-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants