Skip to content

Conversation

@everettbu
Copy link
Contributor

@everettbu everettbu commented Jul 26, 2025

Test 7

Copilot AI review requested due to automatic review settings July 26, 2025 19:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements cross-system issue synchronization by introducing an assignment source tracking mechanism to prevent sync cycles between integrations. When an assignment originates from an integration, the system can now identify the source and avoid syncing back to the same integration that initiated the change.

Key changes:

  • Added AssignmentSource service to track assignment origins with integration metadata
  • Modified assignment methods to accept and propagate assignment source information
  • Updated sync logic to prevent cycles by checking if the sync target matches the assignment source

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/sentry/integrations/services/assignment_source.py New service class for tracking assignment sources with integration metadata
src/sentry/models/groupassignee.py Updated assign/deassign methods to accept assignment source parameter
src/sentry/integrations/utils/sync.py Modified sync functions to pass assignment source and prevent sync cycles
src/sentry/integrations/tasks/sync_assignee_outbound.py Updated task to handle assignment source data
src/sentry/integrations/mixins/issues.py Enhanced should_sync method to check assignment source for cycle prevention
tests/sentry/models/test_groupassignee.py Added test coverage for assignment source functionality
tests/sentry/integrations/services/test_assignment_source.py Unit tests for the new AssignmentSource service

result = AssignmentSource.from_dict(data)
assert result is None

def test_from_dict_inalid_data(self):
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

Method name contains a typo: 'inalid' should be 'invalid'.

Suggested change
def test_from_dict_inalid_data(self):
def test_from_dict_invalid_data(self):

Copilot uses AI. Check for mistakes.
Comment on lines +413 to +418
external_issue,
is_resolved,
project_id,
assignment_source: AssignmentSource | None = None,
**kwargs,
):
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

The sync_status_outbound method signature is updated to include assignment_source parameter, but this appears to be an abstract method. All implementing classes will need to be updated to match this new signature, which could be a breaking change.

Suggested change
external_issue,
is_resolved,
project_id,
assignment_source: AssignmentSource | None = None,
**kwargs,
):
external_issue: ExternalIssue,
is_resolved: bool,
project_id: int,
assignment_source: AssignmentSource | None = None,
**kwargs: Any,
) -> None:

Copilot uses AI. Check for mistakes.
class AssignmentSource:
source_name: str
integration_id: int
queued: datetime = timezone.now()
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

Using timezone.now() as a default field value will set the same timestamp for all instances created at import time, not at instantiation time. This should be a factory function or set in post_init.

Suggested change
queued: datetime = timezone.now()
queued: datetime = field(default_factory=timezone.now)

Copilot uses AI. Check for mistakes.
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