Skip to content
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

ref(releases): Function to process a single group resolution #81119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Nov 21, 2024

No description provided.

@armenzg armenzg self-assigned this Nov 21, 2024
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 21, 2024
@@ -597,6 +456,169 @@ def handle_resolve_in_release(
return result, res_type


def process_group_resolution(
Copy link
Member Author

Choose a reason for hiding this comment

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

The only changes in this function compared to the original code are these (it removes our need to pass projects and projects_look_up:

diff --git a/src/sentry/api/helpers/group_index/update.py b/src/sentry/api/helpers/group_index/update.py
index e0f0a9db6c0..32bba6ece5e 100644
--- a/src/sentry/api/helpers/group_index/update.py
+++ b/src/sentry/api/helpers/group_index/update.py
@@ -488,8 +488,8 @@ def process_group_resolution(
         if res_type == GroupResolution.Type.in_next_release:
             # Check if semver versioning scheme is followed
             follows_semver = follows_semver_versioning_scheme(
-                org_id=group.project.organization_id,
-                project_id=group.project_id,
+                org_id=group.organization.id,
+                project_id=group.project.id,
                 release_version=release.version,
             )
 
@@ -527,7 +527,7 @@ def process_group_resolution(
                         # Get current release object from current_release_version
                         current_release_obj = Release.objects.get(
                             version=current_release_version,
-                            organization_id=group.project.organization_id,
+                            organization_id=projects[0].organization_id,
                         )
 
                         date_order_q = Q(date_added__gt=current_release_obj.date_added) | Q(
@@ -540,8 +540,8 @@ def process_group_resolution(
                         resolved_in_release = (
                             Release.objects.filter(
                                 date_order_q,
-                                projects=group.project,
-                                organization_id=group.project.organization_id,
+                                projects=projects[0],
+                                organization_id=projects[0].organization_id,
                             )
                             .extra(select={"sort": "COALESCE(date_released, date_added)"})
                             .order_by("sort", "id")[:1]
@@ -604,7 +604,7 @@ def process_group_resolution(
 
     if created:
         activity = Activity.objects.create(
-            project=group.project,
+            project=project_lookup[group.project_id],
             group=group,
             type=activity_type,
             user_id=acting_user.id,

@armenzg armenzg marked this pull request as ready for review November 21, 2024 14:31
@armenzg armenzg requested a review from a team as a code owner November 21, 2024 14:31
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 91.11111% with 4 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/api/helpers/group_index/update.py 91.11% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #81119      +/-   ##
==========================================
- Coverage   78.47%   78.47%   -0.01%     
==========================================
  Files        7215     7215              
  Lines      319847   319849       +2     
  Branches    44057    44057              
==========================================
- Hits       251012   251006       -6     
- Misses      62440    62446       +6     
- Partials     6395     6397       +2     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Releases Product Area: Releases Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant