feat: vision properly coverd with tests and completed

This commit is contained in:
2026-03-20 12:57:27 +01:00
parent e59be9df1a
commit 0761254d17
12 changed files with 648 additions and 40 deletions

View File

@@ -109,6 +109,21 @@ final class TokenPrefixCacheTests: XCTestCase {
XCTAssertEqual(cache.debugTrieNodeCount(), 1)
}
func testCheckoutHitDoesNotCountAsEviction() {
let cache = TokenPrefixCache(
memoryBudgetBytes: 10_000,
estimateBytesProvider: { _ in 1_024 }
)
cache.store(entryId: UUID(), kvCache: [], cacheKey: [1, 2, 3], modelId: "model")
let lease = cache.lookup(cacheKey: [1, 2, 3, 4], modelId: "model")
let snapshot = cache.snapshot()
XCTAssertTrue(lease.isHit)
XCTAssertEqual(snapshot.totalEvictions, 0)
}
func testSnapshotReportsHitRateAndTokenTotals() {
let cache = TokenPrefixCache(
memoryBudgetBytes: 10_000,