Skip to content

Conversation

@srest2021
Copy link
Member

@srest2021 srest2021 commented Jan 23, 2026

fixes REPLAY-803

When detecting regressions via compare_version we are comparing the build codes. However, we are not ordering by build code or number in any other instances of semver ordering, which leads to inconsistent behavior.

For example, when determining the "next" release to resolve an issue by, we get the greatest semver version with an arbitrary build code--say the greatest semver in our project is 2.0.0 (10) and we pick 2.0.0 (8) arbitrarily. Say we later see that issue appearing in 2.0.0 (9). We would mark it as a regression because 2.0.0 (9) > 2.0.0 (8) according to compare_version, even though the greatest semver in our project was 2.0.0 (10) and it should not be marked as a regression.

In this PR we add build number and code to the semver ordering. We mimic the behavior of compare_version by ordering on build code and build number (aka numeric build code). This will make our semver ordering consistent when viewing sorted releases lists, resolving issues, and detecting regressions.

Build code ordering in compare_version, DESC (largest to smallest):

  1. alphanumeric builds (compared lexicographically)
  2. numeric builds (compared numerically)
  3. no build

Before

Sorting by semver sorts the version but not the build number, which stays in the order in which it was created.

Screen.Recording.2026-01-23.at.10.12.21.AM.mov

Resolving in the next release, where the greatest semver release is 4.0.0 (13) instead arbitrarily picks 4.0.0 (10). You can also see that "The current semver release" in the dropdown has arbitrarily picked 4.0.0 (12).

Screen.Recording.2026-01-23.at.10.21.46.AM.mov

After

Sorting by semver now sorts the build numbers as well -- alphanumeric builds on top, then numeric builds, then no build.

Screen.Recording.2026-01-23.at.10.09.14.AM.mov

Resolving in the next release, where the greatest semver release is 4.0.0 (13), now correctly picks 4.0.0 (13). "The current semver release" in the dropdown also correctly references 4.0.0 (13).

Screen.Recording.2026-01-23.at.10.26.02.AM.mov

@linear
Copy link

linear bot commented Jan 23, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 23, 2026
class ReleaseOrderBySemverTestCase(TestCase):
def test_compare_version_sorts_by_build_number(self):
"""
Test that compare_version correctly sorts releases by build number with various formats.
Copy link
Member Author

@srest2021 srest2021 Jan 23, 2026

Choose a reason for hiding this comment

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

We don't need to actually merge this but just thought I'd include it for a better picture of how compare_version actually works when detecting regressions. Here we can see that numeric builds are compared numerically and adding any letters makes the comparison lexicographic. We also see that alphanumeric builds are greater than numeric builds, and any build is greater than no build.

@srest2021 srest2021 changed the title Srest2021/replay 803 v2 fix(releases): Sort by build number & code in semver when resolving in next release Jan 23, 2026
@srest2021 srest2021 marked this pull request as ready for review January 23, 2026 18:26
@srest2021 srest2021 requested review from a team as code owners January 23, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants