Module cache

Module cache 

Source
Expand description

Cache module for change-aware test execution

Provides file hashing and cache management to skip unchanged test scenarios, enabling 10x faster iteration by only rerunning tests when their configs change.

§Architecture

Pipeline: Render → Hash → Load cache → Compare → Run (if changed) → Update cache

§Cache Structure

File: ~/.clnrm/cache/hashes.json

{
  "version": "1.0.0",
  "hashes": {
    "tests/api.clnrm.toml": "abc123...",
    "tests/db.clnrm.toml": "def456..."
  },
  "last_updated": "2025-10-17T12:34:56Z"
}

§London School TDD Design

The cache subsystem follows London School TDD principles:

  • Trait-based abstraction: Cache trait defines collaboration contract
  • Mockable interface: Supports test doubles for behavior verification
  • Multiple backends: FileCache (persistent), MemoryCache (testing)
  • Interaction testing: Focus on how components collaborate

Re-exports§

pub use cache_trait::BoxedCache;
pub use cache_trait::Cache;
pub use cache_trait::CacheStats;
pub use file_cache::FileCache;
pub use memory_cache::MemoryCache;
pub use file_cache::FileCache as CacheManager;

Modules§

cache_trait
Cache trait abstraction for pluggable backends
file_cache
File-based cache implementation with persistent storage
hash
SHA-256 file hashing for cache invalidation
memory_cache
In-memory cache implementation for testing