2.1 KiB
2.1 KiB
M3.8.4 — M3.8 Composition Gate
| Field | Value |
|---|---|
| Phase | M3.8 — Context optimization |
| Size | M — 1 day |
| Status | ⬜ Not started |
| Depends | M3.8.3 (benchmarks) |
| Blocks | M3.9 |
Goal
Verify M3.8 implementation meets safety and performance constraints across realistic failure scenarios.
Gate Assertions
Safety (6 assertions)
- No data loss — CCR store retrieves 100% of compressed content
- Cache correctness — Drift metric accurate (< 5% error vs. actual)
- Compression lossless — Decompressed == original (where applicable)
- Format stability — JSON/diff/log structures preserved
- Error graceful — Optimizer failure doesn't crash pipeline
- Thread-safe — Concurrent optimizations don't corrupt state
Performance (4 assertions)
- Latency — Per-chunk optimization < 3ms (p99)
- Cache hit rate — Stable prefix unchanged >= 70% across queries
- Throughput — 1000 chunks/sec sustained
- Memory — Cache size stays < 100MB (max 1000 entries @ 100KB each)
Quality (3 assertions)
- Compression met — All 4 content types meet targets
- No false positives — Cache eligible when drift < 0.3
- Coverage — Benchmarks > 95% compression code paths
Test Implementation
File: tests/it_m3_8_gate.rs (200 LOC)
#[test]
fn m3_8_gate_no_data_loss() { ... }
#[test]
fn m3_8_gate_cache_correctness() { ... }
#[test]
fn m3_8_gate_compression_targets() { ... }
#[test]
fn m3_8_gate_latency_p99() { ... }
#[test]
fn m3_8_gate_concurrent_safety() { ... }
#[test]
fn m3_8_gate_cache_hit_rate() { ... }
Tests: 6 (safety) + 4 (performance) + 3 (quality) = 13 total
Acceptance
✅ All 13 gate assertions passing ✅ 117+ optimizer unit tests passing ✅ Benchmarks meeting compression targets ✅ No regressions in other modules (prompt, query, etc.) ✅ Documentation complete (CONTEXT_OPTIMIZER.md, headers in code)
Success Criteria
- M3.8.4 gate 100% pass rate
- Zero blocking issues from integration tests
- Ready for M3.8 → production hand-off