Skip to content

Commit

Permalink
The fix
Browse files Browse the repository at this point in the history
  • Loading branch information
armenzg committed Nov 14, 2024
1 parent 199a271 commit b1eaf7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
22 changes: 14 additions & 8 deletions src/sentry/api/helpers/group_index/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,18 @@ def update_groups(
release_version=release.version,
)

current_release_version = get_current_release_version_of_group(
group=group, follows_semver=follows_semver
)
if current_release_version:
if features.has(
"organizations:releases-resolve-next-release-semver-fix",
project.organization,
):
resolving_release_version = get_latest_release(projects[0]).version
else:
resolving_release_version = get_current_release_version_of_group(
group=group, follows_semver=follows_semver
)
if resolving_release_version:
resolution_params.update(
{"current_release_version": current_release_version}
{"current_release_version": resolving_release_version}
)

# Sets `current_release_version` for activity, since there is no point
Expand All @@ -431,7 +437,7 @@ def update_groups(
# >current_release_version" in the UI
if follows_semver:
activity_data.update(
{"current_release_version": current_release_version}
{"current_release_version": resolving_release_version}
)

# In semver projects, and thereby semver releases, we determine
Expand All @@ -452,9 +458,9 @@ def update_groups(
# be of type in_next_release but rather in_release would suffice

try:
# Get current release object from current_release_version
# Get current release object from resolving_release_version
current_release_obj = Release.objects.get(
version=current_release_version,
version=resolving_release_version,
organization_id=projects[0].organization_id,
)

Expand Down
10 changes: 8 additions & 2 deletions tests/sentry/issues/endpoints/test_group_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def test_resolved_in_next_release_semver_no_flag_and_first_release(self):
assert group_resolution.type == GroupResolution.Type.in_release
assert group_resolution.status == GroupResolution.Status.resolved
assert group_resolution.release.version == wrong_release.version
assert response.data["statusDetails"]["inRelease"] == wrong_release.version

@with_feature("organizations:releases-resolve-next-release-semver-fix")
def test_resolved_in_next_release_semver_with_flag_no_first_release(self):
Expand Down Expand Up @@ -422,9 +423,12 @@ def test_resolved_in_next_release_semver_with_flag_no_first_release(self):
group_resolution = GroupResolution.objects.filter(group=group).first()
assert group_resolution is not None
assert group_resolution.group == group
assert group_resolution.type == GroupResolution.Type.in_next_release
assert group_resolution.status == GroupResolution.Status.pending
# For semver projects, we consider resolution based on an expression rather than a specific release,
# thus, it is considered resolved in the release that has the highest semver
assert group_resolution.type == GroupResolution.Type.in_release
assert group_resolution.status == GroupResolution.Status.resolved
assert group_resolution.release.version == greatest_version.version
assert response.data["statusDetails"]["inRelease"] == greatest_version.version

@with_feature("organizations:releases-resolve-next-release-semver-fix")
def test_resolved_in_next_release_semver_with_flag_and_first_release(self):
Expand Down Expand Up @@ -462,6 +466,7 @@ def test_resolved_in_next_release_semver_with_flag_and_first_release(self):
assert group_resolution.type == GroupResolution.Type.in_release
assert group_resolution.status == GroupResolution.Status.resolved
assert group_resolution.release.version == greatest_version.version
assert response.data["statusDetails"]["inRelease"] == greatest_version.version

def test_resolved_in_next_release_no_release(self):
self.login_as(user=self.user)
Expand All @@ -482,6 +487,7 @@ def test_resolved_in_next_release_no_release(self):

# no GroupResolution because there is no release
assert not GroupResolution.objects.filter(group=group).exists()
assert response.data["statusDetails"] == {}

def test_snooze_duration(self):
group = self.create_group(status=GroupStatus.RESOLVED)
Expand Down

0 comments on commit b1eaf7d

Please sign in to comment.