fix: Allow to correctly compare parsed versions - #7184
Conversation
Codecov Results 📊✅ 112274 passed | ❌ 3 failed | ⏭️ 6751 skipped | Total: 119028 | Pass Rate: 94.33% | Execution Time: 404m 45s 📊 Comparison with Base Branch
➕ New Tests (3)View new tests
❌ Failed Tests
|
| File | Patch % | Lines |
|---|---|---|
| sentry_sdk/utils.py | 100.00% |
Coverage diff
@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 90.22% 90.22% —%
==========================================
Files 193 193 —
Lines 25361 25366 +5
Branches 9302 9308 +6
==========================================
+ Hits 22880 22884 +4
- Misses 2481 2482 +1
- Partials 1436 1431 -5Generated by Codecov Action
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cf58a84. Configure here.
| if len(release_tuple) == 1: | ||
| release_tuple = (release_tuple[0], 0, 0) | ||
| elif len(release_tuple) == 2: | ||
| release_tuple = (release_tuple[0], release_tuple[1], 0) |
There was a problem hiding this comment.
Padding breaks two-part version equality
Low Severity
Padding parse_version so it always returns a three-tuple makes two-part results no longer equal two-part literals. The Sanic 21.9 workaround uses SanicIntegration.version == (21, 9) and will not run for a two-part 21.9 string, so the exception-path context exit is skipped.
Reviewed by Cursor Bugbot for commit cf58a84. Configure here.


Originally raised by a bot here: the
parse_versionfunction parses version strings as is (e.g. 3.1 becomes(3, 1)). We use these parsed version tuples in integrations to compare the installed version against the minimum (defined inintegrations/__init__.py). The minimum versions are often three-part, e.g.(3, 1, 0).This means that we can mistakenly consider a valid version to be below the minimum, because in pure tuple terms,
(3, 1) < (3, 1, 0)is true.In this PR, we pad out any one- or two-tuples with zeroes until we have a three-tuple.