[WIP][RFC] feat(types): harden product version with validated ProductVersion type#433
Draft
okurz wants to merge 1 commit intoopenSUSE:masterfrom
Draft
[WIP][RFC] feat(types): harden product version with validated ProductVersion type#433okurz wants to merge 1 commit intoopenSUSE:masterfrom
okurz wants to merge 1 commit intoopenSUSE:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #433 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 97 97
Lines 9690 9709 +19
Branches 514 515 +1
=========================================
+ Hits 9690 9709 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
660e056 to
1b62f94
Compare
17e9e66 to
a660001
Compare
f9e5833 to
c64514b
Compare
0d8c127 to
8b83552
Compare
c577cba to
01e475f
Compare
01e475f to
96b1a0d
Compare
Motivation: Product version extraction used plain strings and empty strings for missing values, causing ambiguity and potential errors. PR openSUSE#429 feedback requested stricter definitions and better type safety. Design Choices: - Introduced ProductVersion string subclass in types.py with regex-based validation in __new__. - Refactored gitea.py to return ProductVersion | None instead of "". - Moved VERSION_EXTRACT_REGEX to types.py to centralize logic. - Updated extraction logic to use fullmatch for stricter validation. - Updated dependent code to use explicit is not None checks. User Benefits: - Improved type safety and runtime validation of product versions. - Clearer API contracts with Optional types. - Centralized version parsing logic improves maintainability.
96b1a0d to
34ab418
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
Product version extraction used plain strings and empty strings for missing
values, causing ambiguity and potential errors. PR #429 feedback requested
stricter definitions and better type safety in
#429 (review)
Design Choices:
validation in new.
User Benefits: