High-performance cache policies and supporting data structures.
Human-readable specifications for eviction policies used as the source of truth for test-side oracles.
docs/testing/specs/
├── README.md, matrix.md, template.md, tla-guide.md # hub docs
├── _includes/ # shared fragments (Op mapping, maturity levels)
├── policies/ # human operational specs by tier
│ ├── exact/ # FIFO, LRU, LFU, …
│ ├── mirror/ # Clock, 2Q, …
│ ├── bounded/ # ARC, S3-FIFO, …
│ └── composed/ # TTL
└── formal/ # TLA+ modules + TLC runbooks
├── fifo/
└── lru/
Canonical index: matrix.md (maturity, harness mode, model paths per policy).
policies/<tier>/<policy>.md
→ reference/ PolicyModel (optional — independent formulation)
→ exact/ PolicyModel (deque / DS-shaped oracle)
→ policy_semantics dual-run vs implementation
| Tier | Harness mode | Oracle |
|---|---|---|
| Exact / mirror | DualRun | exact/ PolicyModel vs impl |
Exact (policies with reference/ rows) |
CrossModel | reference/ vs exact/ |
| Bounded | InvariantOnly | structural invariants on impl |
| Composed (TTL) | DualRun + deadlines | LruOccupancyModel + TTL layer |
Cross-model tests prove reference/ agrees with exact/ on the same traces. Impl dual-run proves exact/ agrees with real caches.
Use template.md as the skeleton:
stub, reference, and/or tlaCOp transitions — match the harness Op<K> alphabetresident, peek_victim, recency_rank (if applicable), hit classificationOp maps to cache traits (peek must not promote on LRU, etc.)Shared harness Op table: _includes/harness-op-mapping.md. Trait semantics: trait hierarchy.
When a spec changes, update in order:
policies/<tier>/tests/abstract_models/reference/<policy>.rs (if reference model exists)tests/abstract_models/exact/<policy>.rs if the exact model was wrongformal/<policy>/ TLA+ module and tlc.md alignment notes (if applicable)FIFO and LRU include TLA+ pilots under formal/. Read first: tla-guide.md. TLC is not run in CI.
./scripts/run-tlc.sh fifo # or ./scripts/run-fifo-tlc.sh
./scripts/run-tlc.sh lru # or ./scripts/run-lru-tlc.sh
Success: no SemanticOK violation on the bundled config. Runbooks: formal/fifo/tlc.md, formal/lru/tlc.md.
TLC vs Rust: TLC proves SemanticOK on reachable states for a finite instance; proptest runs long sequential traces on u8 keys. They are complementary.