Releases: contriboss/pubgrub-go
Releases · contriboss/pubgrub-go
v0.3.4
v0.3.3
v0.3.2
v0.3.1
Changes
- add structured logging hooks across solver and state to emit slog traces when configured
- expose partial solution snapshots and pending package helpers for diagnostics
- document WithLogger usage in README and align attribution version
- add regression test covering previousDecisionLevel logic
v0.3.0
v0.2.0 - Custom Condition Support
What's New
Custom Condition Support 🎯
This release adds the VersionSetConverter interface, enabling custom version conditions to work seamlessly with the CDCL solver.
New Interface
type VersionSetConverter interface {
ToVersionSet() VersionSet
}Custom conditions can now implement this optional interface to participate in set operations (union, intersection, complement) required by the solver's conflict analysis.
Example: npm-style Caret Constraint
type CaretCondition struct {
Base *SemanticVersion
}
func (cc CaretCondition) String() string {
return fmt.Sprintf("^%s", cc.Base)
}
func (cc CaretCondition) Satisfies(ver Version) bool {
sv, ok := ver.(*SemanticVersion)
if !ok { return false }
return sv.Major == cc.Base.Major && sv.Sort(cc.Base) >= 0
}
// Enable CDCL solver support
func (cc CaretCondition) ToVersionSet() VersionSet {
rangeStr := fmt.Sprintf(">=%d.%d.%d, <%d.0.0",
cc.Base.Major, cc.Base.Minor, cc.Base.Patch,
cc.Base.Major+1)
set, _ := ParseVersionRange(rangeStr)
return set
}
// Use with solver
base, _ := ParseSemanticVersion("1.2.0")
condition := CaretCondition{Base: base} // ^1.2.0
root.AddPackage("mylib", condition)
solver.Solve(root.Term()) // Works!Benefits
- ✅ Non-breaking - All existing code continues to work
- ✅ Opt-in - Custom conditions choose to implement the interface
- ✅ Efficient - Algebraic conversion, not version testing
- ✅ Well-documented - README, godoc, and working examples
Installation
go get github.com/contriboss/pubgrub-go@v0.2.0Full Changelog
Added:
VersionSetConverterinterface for custom condition support- Comprehensive
CaretConditionexample with tests - Custom condition documentation in README
Changed:
termAllowedSet()andtermForbiddenSet()now check forVersionSetConverter
Compatibility: 100% backward compatible with v0.1.0
v0.1.0 - Initial Release
PubGrub-Go v0.1.0
Initial Release
A comprehensive Go implementation of the PubGrub version solving algorithm.
Features
- CDCL Solver: Full Conflict-Driven Clause Learning implementation with unit propagation
- Semantic Versioning: Complete semver support with prerelease/build metadata
- Version Ranges: Complex constraints (>=, >, <=, <, ==, !=, AND/OR logic)
- Enhanced Error Messages: Human-readable derivation trees explaining resolution failures
- CachedSource: Optional caching wrapper for expensive I/O sources
- Production Ready: Microsecond-level performance for complex dependency graphs
Requirements
- Go 1.25 or later
Installation
go get github.com/contriboss/pubgrub-go@v0.1.0Credits
Derived from tinyrange/pubgrub v0.2.6 with significant enhancements.
Based on the PubGrub algorithm by Natalie Weizenbaum.