-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore(ACI): Remove support for legacy sentry app data in Actions #107174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ceorourke
wants to merge
6
commits into
master
Choose a base branch
from
ceorourke/remove-support-legacy-action-sentry-app-data
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36
−229
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
26bdc94
chore(ACI): Remove support for legacy sentry app data in Actions
ceorourke 849cbf6
clean up that function too
ceorourke c52b237
remove from issue alert handler
ceorourke c7eb1a3
remove from receiver
ceorourke 3667e1f
update test
ceorourke 823bc8b
update a couple tests
ceorourke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,9 +27,9 @@ def setUp(self) -> None: | |
| self.valid_data = { | ||
| "type": Action.Type.SENTRY_APP, | ||
| "config": { | ||
| "sentryAppIdentifier": SentryAppIdentifier.SENTRY_APP_INSTALLATION_UUID, | ||
| "sentryAppIdentifier": SentryAppIdentifier.SENTRY_APP_ID, | ||
| "targetType": ActionType.SENTRY_APP, | ||
| "targetIdentifier": self.sentry_app_installation.uuid, | ||
| "targetIdentifier": str(self.sentry_app.id), | ||
| }, | ||
| "data": {"settings": self.sentry_app_settings}, | ||
| } | ||
|
|
@@ -62,34 +62,6 @@ def test_validate(self, mock_trigger_sentry_app_action_creators: mock.MagicMock) | |
| assert result is True | ||
| validator.save() | ||
|
|
||
| @mock.patch( | ||
| "sentry.rules.actions.sentry_apps.utils.app_service.trigger_sentry_app_action_creators" | ||
| ) | ||
| def test_validate_sentry_app_id( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The basic |
||
| self, mock_trigger_sentry_app_action_creators: mock.MagicMock | ||
| ) -> None: | ||
| mock_trigger_sentry_app_action_creators.return_value = RpcAlertRuleActionResult( | ||
| success=True, message="success" | ||
| ) | ||
| valid_data = { | ||
| "type": Action.Type.SENTRY_APP, | ||
| "config": { | ||
| "sentryAppIdentifier": SentryAppIdentifier.SENTRY_APP_ID, | ||
| "targetType": ActionType.SENTRY_APP, | ||
| "targetIdentifier": str(self.sentry_app.id), | ||
| }, | ||
| "data": {"settings": self.sentry_app_settings}, | ||
| } | ||
|
|
||
| validator = BaseActionValidator( | ||
| data=valid_data, | ||
| context={"organization": self.organization}, | ||
| ) | ||
|
|
||
| result = validator.is_valid() | ||
| assert result is True | ||
| validator.save() | ||
|
|
||
| @mock.patch( | ||
| "sentry.rules.actions.sentry_apps.utils.app_service.trigger_sentry_app_action_creators" | ||
| ) | ||
|
|
@@ -124,20 +96,18 @@ def test_validate__rpc_failure( | |
| def test_validate_settings_action_trigger( | ||
| self, mock_trigger_sentry_app_action_creators: mock.MagicMock | ||
| ) -> None: | ||
| self.create_sentry_app( | ||
| sentry_app = self.create_sentry_app( | ||
| organization=self.organization, | ||
| name="Test Application", | ||
| is_alertable=True, | ||
| ) | ||
| install = self.create_sentry_app_installation( | ||
| slug="test-application", organization=self.organization | ||
| ) | ||
| self.create_sentry_app_installation(slug=sentry_app.slug, organization=self.organization) | ||
| self.valid_data = { | ||
| "type": Action.Type.SENTRY_APP, | ||
| "config": { | ||
| "sentry_app_identifier": SentryAppIdentifier.SENTRY_APP_INSTALLATION_UUID, | ||
| "sentry_app_identifier": SentryAppIdentifier.SENTRY_APP_ID, | ||
| "targetType": ActionType.SENTRY_APP, | ||
| "target_identifier": install.uuid, | ||
| "target_identifier": str(sentry_app.id), | ||
| }, | ||
| "data": { | ||
| "settings": [ | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unhandled ValueError when legacy identifier format used
Medium Severity
The
clean_datamethod callsint(target_identifier)without error handling. The config schema insentry_app_handler.pystill includesSENTRY_APP_INSTALLATION_UUIDin thesentry_app_identifierenum, allowing requests with UUID-formattedtarget_identifiervalues to pass schema validation. When such a request reaches this code,int()raises an unhandledValueError, resulting in a 500 error instead of a proper validation error response.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is why we don't merge this until the migration has run