This document breaks down the implementation of version qualifier support as specified in docs/qualifier-spec.md into detailed, actionable tasks.
Related Issues:
- #5 – Add support for qualifiers and their validation
- #38 – Spike: Integrate new version qualifier validation spec into repo documentation and workflow
Specification Reference: docs/qualifier-spec.md
Priority: High
Estimated Effort: 2-3 hours
Spec Reference: Section 2.2, 3
Description:
Enhance the Version class in version_tag_check/version.py to parse and store qualifier information.
Requirements:
- Update
VERSION_REGEXto capture optional qualifier:^v(\d+)\.(\d+)\.(\d+)(?:-([A-Z0-9]+))?$- Note: The qualifier pattern
[A-Z0-9]+is intentionally permissive to allow parsing of any potential qualifier. Strict validation of allowed qualifier formats will be implemented in Task 1.2.
- Note: The qualifier pattern
- Add private
__qualifierattribute to store parsed qualifier - Add public
qualifierproperty to access the qualifier - Update
__parse()method to extract and validate qualifier format - Ensure backward compatibility with existing version strings without qualifiers
Acceptance Criteria:
Version("v1.0.0")parses successfully withqualifier = NoneVersion("v1.0.0-SNAPSHOT")parses successfully withqualifier = "SNAPSHOT"Version("v1.0.0-RC1")parses successfully withqualifier = "RC1"Version("v1.0.0-HF10")parses successfully withqualifier = "HF10"Version("v1.0.0-invalid")parses but validation handled in Task 1.2__str__()method includes qualifier when present:"v1.0.0-SNAPSHOT"
Testing:
- Add tests in
tests/test_version.pyfor parsing versions with qualifiers - Test edge cases: empty qualifier after hyphen, multiple hyphens, etc.
Priority: High
Estimated Effort: 2-3 hours
Spec Reference: Section 3, 5.1, 5.2
Description: Create a validator to check if a qualifier matches the allowed patterns.
Requirements:
- Create
QualifierValidatorclass or add validation methods toVersionclass - Implement regex patterns for each allowed qualifier:
SNAPSHOT: exactlySNAPSHOTALPHA: exactlyALPHABETA: exactlyBETARC([1-9][0-9]?):RCfollowed by 1-2 digits (RC1 to RC99)RELEASE: exactlyRELEASEHF([1-9][0-9]?):HFfollowed by 1-2 digits (HF1 to HF99)
- Add method to validate qualifier against allowed patterns
- Generate clear error messages for invalid qualifiers
Acceptance Criteria:
SNAPSHOT,ALPHA,BETA,RELEASEvalidate successfullyRC1,RC2,RC99validate successfullyHF1,HF2,HF99validate successfullysnapshot,alpha,rc1,hf1(lowercase) are rejectedRC,RC0,RC001,HF,HF0,HF001are rejectedRC1-SNAPSHOT,BETA1,UNKNOWNare rejected- Error messages clearly indicate what's wrong with the qualifier
Testing:
- Add comprehensive tests in
tests/test_version.py - Test all valid qualifier patterns
- Test all invalid qualifier patterns
- Test case sensitivity
- Test boundary conditions (RC99, HF99, RC100, HF100)
Priority: High
Estimated Effort: 3-4 hours
Spec Reference: Section 4.2, 4.3
Description: Implement the precedence rules for comparing versions with the same numeric base but different qualifiers.
Requirements:
- Create qualifier precedence mapping or enum:
SNAPSHOT(lowest)ALPHABETARC1<RC2< ... <RC99RELEASE- No qualifier (highest for that numeric base)
- Implement special handling for
HFqualifiers:v1.0.0<v1.0.0-HF1<v1.0.0-HF2< ... <v1.0.0-HF99- HF qualifiers come after the bare version
- Add helper method to extract numeric suffix from RC and HF qualifiers
Acceptance Criteria:
- For same numeric version:
v1.0.0-SNAPSHOT<v1.0.0-ALPHA<v1.0.0-BETAv1.0.0-BETA<v1.0.0-RC1<v1.0.0-RC2v1.0.0-RC99<v1.0.0-RELEASE<v1.0.0v1.0.0<v1.0.0-HF1<v1.0.0-HF2v1.0.0-RC1<v1.0.0-RC10(numeric comparison, not string)v1.0.0-HF1<v1.0.0-HF10(numeric comparison, not string)
Testing:
- Add extensive comparison tests in
tests/test_version.py - Test all qualifier precedence rules from spec section 4.2
- Test hotfix precedence rules from spec section 4.3
- Test that numeric version still takes precedence (Task 2.2)
Priority: High
Estimated Effort: 2-3 hours
Spec Reference: Section 4.1, 4.2, 4.3
Description:
Update __eq__, __lt__, __gt__ methods in Version class to incorporate qualifier comparison.
Requirements:
- Maintain numeric precedence first (Major, Minor, Patch)
- Only compare qualifiers when numeric components are equal
- Use qualifier precedence logic from Task 2.1
- Ensure comparison methods handle:
- Both versions with qualifiers
- One version with qualifier, one without
- Both versions without qualifiers (existing behavior)
Acceptance Criteria:
- Numeric version comparison still works:
v2.0.0-SNAPSHOT>v1.9.9-RELEASE - Qualifier comparison for same numeric:
v1.0.0-ALPHA<v1.0.0-BETA - Mixed comparison:
v1.0.0>v1.0.0-RELEASE>v1.0.0-RC1 - Hotfix comparison:
v1.0.0<v1.0.0-HF1<v1.0.0-HF2 - All existing tests continue to pass
- Invalid versions still return
Falsefor comparisons
Testing:
- Update existing tests in
tests/test_version.pyif needed - Add new comparison tests covering all combinations from spec
- Test edge cases: comparing invalid versions with valid ones
Priority: High
Estimated Effort: 3-4 hours
Spec Reference: Section 5, 6
Description:
Enhance NewVersionValidator class in version_tag_check/version_validator.py to handle versions with qualifiers.
Requirements:
- Update
is_valid_increment()to consider qualifier precedence - Allow transitions within same numeric version using qualifier progression
- Example:
v1.0.0-ALPHA→v1.0.0-BETA→v1.0.0-RC1→v1.0.0
- Example:
- Allow patch increment with qualifier reset
- Example:
v1.0.0→v1.0.1-SNAPSHOT→v1.0.1
- Example:
- Support hotfix progression after release
- Example:
v1.0.0→v1.0.0-HF1→v1.0.0-HF2
- Example:
- Prevent backwards transitions
- Reject:
v1.0.0-RC2→v1.0.0-RC1 - Reject:
v1.0.0→v1.0.0-RELEASE
- Reject:
Acceptance Criteria:
- Valid sequences from spec section 6.1 all pass validation
- Invalid sequences from spec section 6.2 all fail validation with clear errors
- Pre-release progression validates correctly
- Cross-version transitions validate correctly
- Hotfix sequences validate correctly
- Error messages clearly indicate why a sequence is invalid
Testing:
- Add comprehensive tests in
tests/test_version_validator.py - Test valid sequences from spec examples
- Test invalid sequences from spec examples
- Test edge cases and boundary conditions
Priority: High
Estimated Effort: 2 hours
Spec Reference: Section 5, 9
Description:
Update VersionTagCheckAction in version_tag_check/version_tag_check_action.py to integrate qualifier validation.
Requirements:
- Ensure tag format check includes qualifier validation
- Update error messages to distinguish between:
- Invalid format (structure issues)
- Invalid qualifier (disallowed or malformed qualifier)
- Update logging to include qualifier information
- Maintain backward compatibility with existing behavior
Acceptance Criteria:
- Action correctly validates version format with qualifiers
- Action rejects tags with invalid qualifiers with clear messages
- Action distinguishes between format errors and qualifier errors
- Logging includes qualifier information when present
- All existing integration tests pass
Testing:
- Update tests in
tests/test_version_tag_check_action.py - Add tests for qualifier validation integration
- Test error message clarity for different failure modes
Priority: High
Estimated Effort: 3-4 hours
Spec Reference: All sections
Description: Create comprehensive unit tests covering all spec requirements.
Requirements:
- Test all valid qualifier formats from spec section 3
- Test all invalid qualifier formats from spec section 5.2
- Test all precedence rules from spec section 4
- Test all sequence validation rules from spec section 6
- Maintain overall project coverage at ≥80%
- Ensure tests check exact error messages where specified
Test Categories:
-
Parsing tests (Section 2, 3)
- Valid formats with each qualifier type
- Invalid formats
- Edge cases (boundary numbers, case sensitivity)
-
Validation tests (Section 5)
- Each allowed qualifier pattern
- Each disallowed pattern
- Malformed qualifiers
-
Comparison tests (Section 4)
- Numeric precedence
- Qualifier precedence for same numeric
- Hotfix precedence
- Mixed comparisons
-
Sequence tests (Section 6)
- Valid pre-release progressions
- Valid cross-version transitions
- Valid hotfix sequences
- Invalid backwards transitions
- Invalid qualifier in sequence
Acceptance Criteria:
- All tests pass
- Code coverage ≥80% for new/modified code
- Tests follow existing patterns in
tests/test_version.py - Tests are readable and well-documented
- Edge cases and boundary conditions covered
Priority: Medium
Estimated Effort: 2-3 hours
Spec Reference: Section 9
Description: Create integration tests to verify end-to-end behavior of the action with qualifiers.
Requirements:
- Test complete workflow from tag input to validation output
- Mock GitHub repository responses with qualified tags
- Test realistic version tag sequences
- Verify error messages are user-friendly
Test Scenarios:
- Create tag with valid qualifier → should pass
- Create tag with invalid qualifier → should fail with clear message
- Create tag that's valid progression → should pass
- Create tag that's invalid progression → should fail with clear message
- Mix of qualified and non-qualified tags in history
Acceptance Criteria:
- Integration tests cover main user workflows
- Tests use realistic version sequences
- Error messages are clear and actionable
- Tests pass consistently
Priority: High
Estimated Effort: 1-2 hours
Spec Reference: Development practices
Description: Ensure all new code meets project quality standards.
Requirements:
- Run Black formatter on all modified files
- Run Pylint and maintain score ≥9.5
- Run mypy and fix any type errors
- Add type hints to all new public functions and classes
- Add docstrings to all new public functions and classes
Acceptance Criteria:
- Black formatting applied:
black $(git ls-files '*.py') - Pylint score ≥9.5:
pylint --ignore=tests $(git ls-files '*.py') - Mypy passes:
mypy . - All public APIs have type hints
- All public APIs have docstrings following project conventions
- No new linting warnings introduced
Priority: High
Estimated Effort: 1-2 hours
Spec Reference: Section 9
Description: Update README.md to document the new qualifier support feature.
Requirements:
- Update "Supported Version Tags Formats" section
- Move planned formats to actual supported formats
- Document all six qualifier types
- Update "Support Version Weight Comparison" section
- Document qualifier precedence rules
- Show example comparisons with qualifiers
- Add examples section showing common version progressions
- Update usage examples if needed
Changes:
### Supported Version Tags Formats
- `v1.0.0` - Standard semantic version
- `v1.0.0-SNAPSHOT` - Snapshot pre-release
- `v1.0.0-ALPHA` - Alpha pre-release
- `v1.0.0-BETA` - Beta pre-release
- `v1.0.0-RC1` to `v1.0.0-RC99` - Release candidates
- `v1.0.0-RELEASE` - Release qualifier
- `v1.0.0-HF1` to `v1.0.0-HF99` - Hotfixes
### Version Weight Comparison With Qualifiers
For the same numeric version (e.g., `v1.0.0`):
- `v1.0.0-SNAPSHOT` < `v1.0.0-ALPHA` < `v1.0.0-BETA`
- `v1.0.0-BETA` < `v1.0.0-RC1` < `v1.0.0-RC2` < ... < `v1.0.0-RC99`
- `v1.0.0-RC99` < `v1.0.0-RELEASE` < `v1.0.0`
- `v1.0.0` < `v1.0.0-HF1` < `v1.0.0-HF2` < ... < `v1.0.0-HF99`
Numeric versions always take precedence:
- `v2.0.0-SNAPSHOT` > `v1.9.9-RELEASE`Acceptance Criteria:
- README clearly documents all supported qualifier formats
- README shows qualifier precedence rules
- Examples are clear and helpful
- Links to
docs/qualifier-spec.mdare present (already exists in the Documentation section) - Documentation is consistent with the specification
Priority: Medium
Estimated Effort: 1 hour
Spec Reference: Section 6.1
Description: Add examples document or section showing common version tag progressions.
Requirements:
- Create examples showing typical version progressions
- Include pre-release cycles
- Include hotfix scenarios
- Include cross-version transitions
Example Progressions:
-
Standard release cycle:
v1.0.0-SNAPSHOT→v1.0.0-ALPHA→v1.0.0-BETA→v1.0.0-RC1→v1.0.0-RC2→v1.0.0-RELEASE→v1.0.0
-
Patch with hotfixes:
v1.0.0→v1.0.1-RC1→v1.0.1→v1.0.1-HF1→v1.0.1-HF2
-
Minor version bump:
v1.0.0→v1.1.0-SNAPSHOT→v1.1.0-RC1→v1.1.0
Acceptance Criteria:
- Examples cover common scenarios from spec section 6.1
- Examples are practical and realistic
- Examples demonstrate both valid and invalid progressions
- Documentation is clear and easy to follow
Priority: Low
Estimated Effort: 30 minutes
Spec Reference: Development practices
Description: Update DEVELOPER.md if any development practices changed due to qualifier support.
Requirements:
- Review if any new testing approaches are needed
- Update if any new development patterns were introduced
- Ensure developer guide reflects current practices
Acceptance Criteria:
- DEVELOPER.md is up-to-date
- New contributors can understand how to work with qualifier code
- Testing guidance covers qualifier validation
Priority: Medium
Estimated Effort: 30 minutes
Spec Reference: Section 9
Description:
Review and update action.yml if any changes are needed for qualifier support.
Requirements:
- Review action inputs - no changes expected
- Review action description - may need update to mention qualifier support
- Ensure composite action definition is accurate
Acceptance Criteria:
action.ymlaccurately describes action capabilities- Input/output definitions are correct
- Action description mentions qualifier support if appropriate
Priority: Low
Estimated Effort: 1 hour
Spec Reference: Section 9
Description:
Review and update GitHub workflow files in .github/workflows/ if needed.
Requirements:
- Check if any workflows use version tags
- Update examples in workflows if needed
- Ensure CI/CD workflows test qualifier functionality
Acceptance Criteria:
- Workflows accurately demonstrate action usage
- CI/CD tests cover qualifier scenarios
- No breaking changes to existing workflows
Recommended sequence:
-
Phase 1: Core Version Model (Tasks 1.1, 1.2)
- Foundation for all other work
- Can be tested independently
-
Phase 2: Comparison Logic (Tasks 2.1, 2.2)
- Builds on Phase 1
- Required for validation logic
-
Phase 3: Validation Logic (Tasks 3.1, 3.2)
- Integrates Phases 1 and 2
- Core business logic
-
Phase 4: Testing (Tasks 4.1, 4.2, 4.3)
- Continuous throughout development
- Final comprehensive pass after Phase 3
-
Phase 5: Documentation (Tasks 5.1, 5.2, 5.3)
- After implementation is complete
- Reflects actual implementation
-
Phase 6: Integration (Tasks 6.1, 6.2)
- Final cleanup and polish
- After documentation is done
These are explicitly out of scope and should NOT be implemented:
- ❌ Combined qualifiers (e.g.,
v1.0.0-RC1-SNAPSHOT) - ❌ Arbitrary/custom qualifiers beyond the six defined types
- ❌ Pre-release or build metadata (e.g.,
v1.0.0-RC1+build.123) - ❌ Multi-part numeric qualifiers (e.g.,
RC1.1,HF1.2) - ❌ Changes to core semantic versioning behavior for non-qualified versions
These are potential future enhancements, not part of initial implementation:
- Configurable allowed qualifiers (enable/disable specific ones)
- Case-sensitivity settings
- Strict vs lenient sequence rules
- Hotfix semantics configuration
- Custom precedence override
These could be tracked as separate issues for future releases.
The implementation is complete when:
- ✅ All tasks in Phases 1-6 are completed
- ✅ All tests pass with ≥80% code coverage
- ✅ Code quality checks pass (Black, Pylint ≥9.5, mypy)
- ✅ Documentation is updated and accurate
- ✅ Specification requirements are fully implemented
- ✅ Action successfully validates tags with qualifiers
- ✅ Error messages are clear and helpful
- ✅ No regressions in existing functionality
- ✅ Code review completed and feedback addressed
- Keep this document updated as tasks are completed
- Link related PRs to specific tasks
- Update task estimates based on actual time taken
- Note any blockers or dependencies discovered during implementation
- Track any deviations from the spec and document reasons