clnrm_core/cache/
mod.rs

1//! Cache module for change-aware test execution
2//!
3//! Provides file hashing and cache management to skip unchanged test scenarios,
4//! enabling 10x faster iteration by only rerunning tests when their configs change.
5//!
6//! ## Architecture
7//! Pipeline: Render → Hash → Load cache → Compare → Run (if changed) → Update cache
8//!
9//! ## Cache Structure
10//! File: `~/.clnrm/cache/hashes.json`
11//! ```json
12//! {
13//!   "version": "1.0.0",
14//!   "hashes": {
15//!     "tests/api.clnrm.toml": "abc123...",
16//!     "tests/db.clnrm.toml": "def456..."
17//!   },
18//!   "last_updated": "2025-10-17T12:34:56Z"
19//! }
20//! ```
21//!
22//! ## London School TDD Design
23//!
24//! The cache subsystem follows London School TDD principles:
25//! - **Trait-based abstraction**: `Cache` trait defines collaboration contract
26//! - **Mockable interface**: Supports test doubles for behavior verification
27//! - **Multiple backends**: FileCache (persistent), MemoryCache (testing)
28//! - **Interaction testing**: Focus on how components collaborate
29
30pub mod cache_trait;
31pub mod file_cache;
32pub mod hash;
33pub mod memory_cache;
34
35pub use cache_trait::{BoxedCache, Cache, CacheStats};
36pub use file_cache::FileCache;
37pub use memory_cache::MemoryCache;
38
39// Legacy alias for backward compatibility
40pub use file_cache::FileCache as CacheManager;