-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
🐛 fix(vsts): catch org integration not found errors in outbound status sync #92139
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
base: master
Are you sure you want to change the base?
Conversation
@@ -379,13 +380,18 @@ class IssueSyncIntegration(IssueBasicIntegration, ABC): | |||
|
|||
def should_sync(self, attribute: str, sync_source: AssignmentSource | None = None) -> bool: | |||
key = getattr(self, f"{attribute}_key", None) | |||
if key is None or self.org_integration is None: | |||
try: | |||
org_integration = self.org_integration |
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.
It's ok for this method to return false because it means we don't sync. But why is it even being called if there is no installation? I think the fix should be not call any of these methods actually if the org_integration throws exception.
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.
But why is it even being called if there is no installation
this is happening because the org links an issue, then deletes the integration which leaves us in this state. i was considering deleting the link itself, but that would mean the user doesn't see the link in the UI which might raise more questions
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.
the task is triggered on a status update here: https://github.com/getsentry/sentry/blob/cb9f7e87657583b0f766c460c840c5e3fac816d3/src/sentry/integrations/tasks/kick_off_status_syncs.py#L25-L37
this should_sync
method is the main gate which checks whether:
- the integration id to make sure we don't have cyclic syncs
- makes sure that the status sync feature is enabled
imo, this method is a good place checking if the org integration exists. i didn't want to do it 1 level higher since that would mean we would need to deal with integration/orgintegration level concerns when kicking off the async task.
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 being said, i can move this around if we think its better
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
self.org_integration
is a property that raisesOrganizationIntegrationNotFound
it doesn't exist.we didn't catch this exception and recorded this as a failure, even though this should mean we don't sync outbound.
this patch will not attempt to sync the status if the org integration can't be found. it will improve SLOs and save resources