This document outlines the versioning strategy for the Uzima-Contracts project, following Semantic Versioning (SemVer) to ensure clear, predictable version increments that communicate the nature of changes.
We adopt the Semantic Versioning 2.0.0 standard with the format MAJOR.MINOR.PATCH.
MAJOR.MINOR.PATCH[-PRERELEASE[+BUILD]]
- MAJOR: Incompatible API changes that break existing functionality
- MINOR: New functionality added in a backward-compatible manner
- PATCH: Backward-compatible bug fixes
- PRERELEASE: Pre-release versions (alpha, beta, rc) (optional)
- BUILD: Build metadata (optional)
1.0.0- First stable release1.1.0- New features added1.1.1- Bug fix release2.0.0- Breaking changes introduced1.2.0-alpha.1- Pre-release version1.2.0-beta.2+20230401- Pre-release with build metadata
MAJOR version increments indicate breaking changes that require user intervention:
- Function signature modifications
- Parameter type changes
- Return value modifications
- Function removal or renaming
- Data layout modifications in contract storage
- Key structure changes
- Migration requirements for existing data
- Network compatibility breaking changes
- Stellar protocol version requirements
- Soroban framework compatibility changes
// BEFORE (v1.x.x)
pub fn add_patient(&self, patient_id: &str, data: &Bytes) -> Result<(), Error>
// AFTER (v2.0.0) - Breaking: parameter order changed
pub fn add_patient(&self, data: &Bytes, patient_id: &str) -> Result<(), Error>MINOR version increments add new functionality without breaking changes:
- New contract functions added
- Additional optional parameters to existing functions
- New events emitted
- Enhanced error types with backward compatibility
// v1.1.0 - New function added (backward compatible)
pub fn get_patient_history(&self, patient_id: &str, from_date: Option<u64>) -> Result<Vec<Record>, Error>
// v1.2.0 - New optional parameter (backward compatible)
pub fn update_record(&self, record_id: &str, data: &Bytes, metadata: Option<Bytes>) -> Result<(), Error>PATCH version increments fix bugs without changing functionality:
- Logic errors corrected
- Edge case handling improved
- Performance optimizations
- Security vulnerability fixes
- Documentation corrections
// v1.1.1 - Bug fix: proper validation
pub fn add_record(&self, patient_id: &str, data: &Bytes) -> Result<(), Error> {
// Fixed: Added proper validation
if patient_id.is_empty() {
return Err(Error::InvalidPatientId);
}
// ... rest of implementation
}alpha- Early development, unstable, API may changebeta- Feature complete, testing phase, API stablerc- Release candidate, final testing before stable release
1.2.0-alpha.1 # First alpha of v1.2.0
1.2.0-alpha.2 # Second alpha of v1.2.0
1.2.0-beta.1 # First beta of v1.2.0
1.2.0-rc.1 # First release candidate
1.2.0 # Stable release
- Pre-release versions have lower precedence than the associated normal version
- Build metadata MUST be ignored when determining version precedence
- Pre-release versions are for testing and development only
Use the provided release automation:
# Patch release (bug fixes)
make release VERSION=1.1.1
# Minor release (new features)
make release VERSION=1.2.0
# Major release (breaking changes)
make release VERSION=2.0.0
# Pre-release
make release VERSION=1.2.0-alpha.1If manual version updates are needed:
- Update
Cargo.tomlworkspace version - Update individual contract versions if needed
- Update documentation references
- Create appropriate git tags
- Update changelog
The release process includes validation:
- Semantic version format validation
- Git tag existence checks
- Changelog entry verification
- Contract version consistency checks
Each contract maintains its version information:
// Contract version storage
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn get_version(&self) -> Result<String, Error> {
Ok(CONTRACT_VERSION.to_string())
}- Contracts expose version via
get_version()function - Migration scripts check version compatibility
- Upgrade contracts validate target versions
main # Stable releases (v1.x.x, v2.x.x)
├── develop # Development branch (next minor/major)
├── release/v1.2.0 # Release preparation branch
├── hotfix/v1.1.1 # Critical fixes for current release
└── feature/* # Feature branches
- Feature Development: Branch from
develop - Integration: Merge to
developvia PR - Release Preparation: Create
release/vX.Y.Zbranch - Testing: Final testing on release branch
- Release: Merge to
mainand tag - Hotfixes: Branch from
mainfor critical fixes
Every version release MUST include:
- Version number and release date
- Breaking changes (if any)
- New features (if any)
- Bug fixes (if any)
- Migration instructions (if needed)
- Security considerations (if applicable)
## [1.2.0] - 2026-04-20
### Added
- New feature X
- Enhanced functionality Y
### Fixed
- Bug Z resolved
- Performance issue fixed
### Changed
- Improved process A
- Updated dependency B
### Breaking Changes
- Function signature changed (migration required)
- Storage layout updated (see migration guide)
### Security
- Fixed vulnerability CVE-XXXX-XXXXThe CI pipeline enforces version consistency:
- Version format validation
- Changelog existence checks
- Tag verification
- Contract version consistency
# Example CI validation
- name: Validate Version
run: |
# Check semantic version format
echo "${{ github.ref_name }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$'
# Verify changelog entry exists
grep -q "## [${{ github.ref_name }}]" CHANGELOG.md
# Check contract versions
make check-versions| From Version | To Version | Migration Required | Automated |
|---|---|---|---|
| 1.0.x | 1.1.x | No | N/A |
| 1.0.x | 2.0.0 | Yes | Yes |
| 1.1.x | 1.2.x | No | N/A |
| 1.1.x | 2.0.0 | Yes | Yes |
- Automated migration scripts for major versions
- Data validation tools
- Rollback procedures
- Migration verification tests
- Plan Breaking Changes Carefully: Major versions should be well-planned
- Maintain Backward Compatibility: Prefer minor versions when possible
- Document Changes Thoroughly: Clear changelogs and migration guides
- Test Extensively: Comprehensive testing for all version changes
- Communicate Early: Announce breaking changes well in advance
- Patch releases: As needed for critical fixes
- Minor releases: Every 2-4 weeks for feature updates
- Major releases: Every 3-6 months for significant changes
- All tests must pass
- Code coverage requirements met
- Security scans completed
- Documentation updated
- Migration guides prepared (for major releases)
make release- Automated release processmake check-versions- Version consistency validationscripts/version_bump.sh- Manual version bumpingscripts/migrate.sh- Migration assistance
- GitHub Actions for automated releases
- Changelog generation from git history
- Contract deployment with version tagging
- Notification systems for release announcements
This versioning strategy ensures predictable, maintainable releases that clearly communicate the impact of changes to all stakeholders.