Contributing
Development Setup
# Clone the repository
git clone https://github.com/paiml/trueno-zram
cd trueno-zram
# Build
cargo build --all-features
# Run tests
cargo test --workspace --all-features
# Run with CUDA
cargo test --workspace --features cuda
Code Style
- Format with
cargo fmt - Lint with
cargo clippy --all-features -- -D warnings - No panics in library code
- All public items must be documented
Testing
Unit Tests
cargo test --workspace --all-features
Coverage
cargo llvm-cov --workspace --all-features
Target: 95% line coverage.
Mutation Testing
cargo mutants --package trueno-zram-core
Target: 80% mutation score.
Quality Gates
Before submitting a PR:
- Formatting:
cargo fmt --check - Linting:
cargo clippy --all-features -- -D warnings - Tests:
cargo test --workspace --all-features - Documentation:
cargo doc --no-deps - Coverage: >= 95%
Commit Messages
Follow conventional commits:
feat: Add new compression algorithm
fix: Handle edge case in decompression
perf: Optimize hash table lookup
docs: Update API documentation
test: Add property-based tests
refactor: Simplify SIMD dispatch
Always reference the work item:
feat: Add GPU batch compression (Refs ZRAM-001)
Pull Request Process
- Fork the repository
- Create a feature branch
- Make changes with tests
- Run quality gates
- Submit PR with description
- Address review feedback
Architecture
See Design Overview for architecture decisions.
Adding a New Algorithm
- Create module in
src/algorithms/ - Implement
PageCompressortrait - Add SIMD implementations
- Add to
Algorithmenum - Write tests and benchmarks
- Update documentation
Adding SIMD Backend
- Add detection in
src/simd/detect.rs - Create implementation file (e.g.,
avx512.rs) - Add dispatch in
src/simd/dispatch.rs - Write correctness tests
- Run benchmarks
Reporting Issues
Use GitHub Issues with:
- Clear description
- Reproduction steps
- Expected vs actual behavior
- System info (CPU, OS, Rust version)
License
Contributions are licensed under MIT OR Apache-2.0.