moyu12-ae 1efe3f63c2 test(cache): add 26 integration tests + fix NaN edge case in computeCacheMetrics
TDD cycle results:
- 26 new integration tests covering:
  • Cross-window percentage threshold consistency (200K/500K/1M)
  • Decision chain verification (pre-fold → normal → aggressive → force)
  • alreadyFoldedThisTurn double-fold prevention
  • Hysteresis oscillation prevention
  • Cache metrics invariant (ratio ∈ [0,1])
  • CJK + emoji + mixed-language truncation edge cases
- Bug fix: computeCacheMetrics returned NaN when cacheHit+cacheMiss==0
  (all tokens were writes). Now returns 0 for valid range.
- 58 cache optimization tests + 15 existing = 73 total. Zero failures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 15:14:37 +08:00
..