| Crates.io | certeza |
| lib.rs | certeza |
| version | 0.1.0 |
| created_at | 2026-01-04 15:34:32.356064+00 |
| updated_at | 2026-01-04 15:34:32.356064+00 |
| description | A scientific experiment into realistic provability with Rust - asymptotic test effectiveness framework |
| homepage | |
| repository | https://github.com/paiml/certeza |
| max_upload_size | |
| id | 2022061 |
| size | 794,797 |
certeza is a comprehensive framework for approaching asymptotic test effectiveness in Rust software systems through the pragmatic integration of:
While complete verification remains theoretically impossible (Dijkstra: "testing can only prove the presence of bugs, not their absence"), this framework provides a reproducible methodology for achieving practical maximum confidence in critical systems.
The framework implements three-tiered verification that balances rigor with developer productivity:
cargo check, cargo clippy)Command: make tier1
Command: make tier2
Command: make tier3
Critical Principle: Different verification techniques operate at different time scales. Fast feedback enables flow; slow feedback causes context switching waste. Never run mutation testing or formal verification in the inner development loop.
# Clone the repository
git clone https://github.com/paiml/certeza.git
cd certeza
# Run quick checks (Tier 1)
make tier1
# Run full test suite with coverage (Tier 2)
make tier2
# Build the project
cargo build
# Run all tests
cargo test
# Generate documentation
cargo doc --open
Add this to your Cargo.toml:
[dependencies]
certeza = "0.1.0"
The primary demonstration of the certeza framework is TruenoVec<T>, a custom growable vector implementation that showcases the complete three-tiered testing approach.
use certeza::TruenoVec;
fn main() {
// Create a new vector
let mut vec = TruenoVec::new();
// Push elements
vec.push(1);
vec.push(2);
vec.push(3);
// Access elements
assert_eq!(vec.len(), 3);
assert_eq!(vec.get(1), Some(&2));
// Pop elements
assert_eq!(vec.pop(), Some(3));
assert_eq!(vec.len(), 2);
// Pre-allocate capacity for performance
let mut vec2 = TruenoVec::with_capacity(1000);
for i in 0..1000 {
vec2.push(i); // No reallocation
}
}
NonNull<T> for safe manual allocationDrop implementation ensures no memory leaksSend + Sync where T is Send/Synciter, iter_mut, into_iter)insert, remove, clear with optimal performanceTruenoVec implements all standard Rust collection traits for full std::Vec feature parity:
Core Traits:
Default, Drop, CloneSend + Sync (thread safety)Conversion Traits:
From<Vec<T>>, From<&[T]>FromIterator<T>, Extend<T>IntoIterator (owned, &, &mut)Indexing Traits:
Index<usize>, IndexMut<usize>Comparison Traits:
PartialEq, EqPartialOrd, Ord (sorting support)Hashing:
Hash (HashMap/HashSet keys)Ergonomic Traits (Phase 3.1):
Deref<Target=[T]>, DerefMut (automatic slice coercion)AsRef<[T]>, AsMut<[T]> (generic bounds)Display & Formatting (Phase 3.3):
Debug (pretty printing)Display (user-friendly output)Advanced Borrowing (Phase 3.3):
Borrow<[T]>, BorrowMut<[T]> (HashMap/BTreeMap lookup support)This enables TruenoVec to be used in:
&[T] or AsRef<[T]>HashMap and HashSet as keysBTreeMap and BTreeSet as keys.sort() or Vec::sort()Deref coercionTotal Tests: 260 tests across all tiers ✅ 97.7% mutation score
new, with_capacity, push, pop, clearget, get_mut with bounds checkinginsert, remove at various positionsiter, iter_mut, into_iter with bidirectional iteration<, >, <=, >= operatorsstd::VecBenchmarks demonstrate competitive performance with std::Vec:
certeza includes chaos engineering and fuzz testing capabilities adapted from renacer v0.4.1 (Sprint 29).
Test system resilience under adverse conditions:
use certeza::chaos::{ChaosConfig, ChaosResult};
use std::time::Duration;
// Gentle preset for development (512MB, 80% CPU, 120s timeout)
let gentle = ChaosConfig::gentle();
// Aggressive preset for CI/CD (64MB, 25% CPU, 10s timeout, signals)
let aggressive = ChaosConfig::aggressive();
// Custom configuration using renacer builder pattern
let custom = ChaosConfig::new()
.with_memory_limit(128 * 1024 * 1024) // 128MB
.with_cpu_limit(0.5) // 50% CPU
.with_timeout(Duration::from_secs(30))
.with_signal_injection(true)
.build();
Chaos Features (renacer pattern):
chaos-basic: Core chaos configuration and error typeschaos-network: Network failure simulation (planned)chaos-byzantine: Byzantine fault injection (planned)chaos-full: All chaos features combinedCommands:
# Run chaos engineering tests (Tier 2)
make chaos-test
# Enable specific chaos features
cargo test --features chaos-basic
cargo test --features chaos-full
Automated testing with libFuzzer to discover edge cases and crashes:
# Run fuzz tests for 60 seconds
make fuzz
# Extended fuzzing session
cargo +nightly fuzz run fuzz_target_1 -- -max_total_time=300
The fuzz target tests TruenoVec operations:
Integration: Chaos tests run in Tier 2 (ON-COMMIT) for fast feedback.
This project is fully compliant with the Pragmatic AI Labs Multi-Language Agent Toolkit (PMAT) standards, enforcing EXTREME TDD:
# Development workflow
make tier1 # Quick checks (sub-second)
make tier2 # Full test suite (1-5 min)
make tier3 # Mutation testing (hours)
# Testing
make test # Run all tests
make test-quick # Run unit tests only
make test-property # Run property-based tests
make coverage # Generate coverage report
make chaos-test # Chaos engineering tests (renacer)
make fuzz # Fuzz testing (60s)
# Code quality
make clippy # Run clippy linter
make clippy-strict # Run strict clippy
make fmt # Format code
make fmt-check # Check formatting
# Analysis
make complexity # Analyze complexity with PMAT
make tdg # Technical debt grading
make security # Security audit
# Documentation
make docs # Generate documentation
make validate-docs # Validate docs with PMAT
# Setup
make install-tools # Install required tooling
make install-hooks # Install PMAT git hooks
# Tier 1: Quick checks (unit tests)
make tier1
cargo test --lib
# Tier 2: Full test suite (unit + property + integration + doc tests)
make tier2
cargo test --all
# Integration tests
cargo test --test integration_tests
# Benchmarks
cargo test --benches
# Property-based tests with custom case count
PROPTEST_CASES=1000 cargo test property_
Run mutation testing to verify test suite quality:
make mutation
# or
cargo mutants --no-times
Target: >85% mutation score
Generate coverage report:
make coverage
# or
cargo llvm-cov --all-features --workspace
Target: 95%+ line coverage, 90%+ branch coverage
Not all code requires the same verification intensity:
| Risk Level | Components | Verification Approach |
|---|---|---|
| Very High | unsafe blocks, memory allocators, crypto |
Full framework: Property + Coverage + Mutation (90%) + Formal |
| High | Core algorithms, data structures, parsers | Property + Coverage + Mutation (85-90%) |
| Medium | Business logic, API handlers | Property + Coverage + Mutation (80%) |
| Low | Simple accessors, config | Unit tests + Coverage (90%) |
Resource Allocation: Spend 40% of verification time on the 5-10% highest-risk code.
┌─────────────────┐
│ Formal (Kani) │ ~1-5% code (invariant proofs)
├─────────────────┤
│ Integration │ ~10% tests (system properties)
├─────────────────┤
│ Property-Based │ ~30% tests (algorithmic correctness)
├─────────────────┤
│ Unit Tests │ ~60% tests (basic functionality)
└─────────────────┘
GitHub Actions workflow enforces quality gates:
Contributions are welcome! Please ensure:
make tier2make coveragemake clippy-strictcargo fmtMIT License - see LICENSE file for details.
This project implements research findings from the certeza specification, incorporating: