Feature: Registry Cache Coverage As a developer I want to ensure all code paths in RegistryCache, CacheFactory, and PackageContentResolver caching integration are covered So that the project maintains the 97% coverage threshold Background: Given a clean test environment for cache coverage # ── RegistryCache.resolve_package() ────────────────────────────────── Scenario: Resolve package returns content from mock client When I create a RegistryCache wrapping a mock client When I call resolve_package with type=actor ns=bench name=pkg version=v1.0.0 Then the resolve result should contain package_id And the resolve result should contain the test content Scenario: Resolve package cache hit When I create a RegistryCache wrapping a mock client When I call resolve_package twice with type=actor ns=bench name=pkg version=v1.0.0 Then the resolve result should contain package_id And the cache stats misses should be 1 Scenario: Resolve package with validation enabled When I create a RegistryCache with validation enabled and mock client When I call resolve_package twice with type=actor ns=bench name=pkg version=v1.0.0 Then the resolve result should contain package_id And the cache stats misses should be 1 # ── RegistryCache.put() ────────────────────────────────────────────── Scenario: Manual put inserts entry into cache When I create a RegistryCache wrapping a mock client When I put a package entry into the cache Then the package should be present in the cache Scenario: Put triggers eviction when at capacity When I put 3 entries into the cache at max_size 2 Then the cache stats evictions should be 1 # ── CacheFactory ───────────────────────────────────────────────────── Scenario: CacheFactory with default settings When I create a CacheFactory with default settings Then the factory should be created with max_size=256 And the factory should be created with ttl=300.0 Scenario: CacheFactory with custom settings When I create a CacheFactory with max_size=128 ttl=60.0 Then the factory should be created with max_size=128 And the factory should be created with ttl=60.0 Scenario: CacheFactory create produces a RegistryCache When I create a CacheFactory with default settings When I call factory.create with a mock client Then the cache should wrap the mock client Scenario: CacheFactory with invalid max_size raises ValueError When I try to create a CacheFactory with max_size=0 Then a ValueError should be raised by the cache factory Scenario: CacheFactory with invalid ttl raises ValueError When I try to create a CacheFactory with ttl=-1.0 Then a ValueError should be raised by the cache factory Scenario: CacheFactory with boolean max_size raises ValueError When I try to create a CacheFactory with max_size boolean True Then a ValueError should be raised by the cache factory # ── PackageContentResolver with CacheFactory ───────────────────────── Scenario: Resolver with CacheFactory resolves local reference When I create a PackageContentResolver with a CacheFactory When I resolve a local reference via the resolver Then the resolve result should not be None Scenario: Resolver with CacheFactory resolves registry reference When I create a PackageContentResolver with a CacheFactory When I inject a mock registry client into the resolver When I resolve a registry reference via the resolver Then the resolve result should contain package_id And the resolve result should contain the test content Scenario: Resolver total_stats is accessible When I create a PackageContentResolver with a CacheFactory When I inject a mock registry client into the resolver When I resolve the same registry reference twice When I read the resolver total_stats Then the total_stats should have been accessible without error And the resolver total stats hits should be 0 And the resolver total stats misses should be 1 Scenario: Resolver clear_cache clears resolution cache When I create a PackageContentResolver with a CacheFactory When I resolve a local reference via the resolver When I clear the resolver cache Then the resolver cache should be empty Scenario: Resolver close_all closes clients and content caches When I create a PackageContentResolver with a CacheFactory When I resolve a local reference via the resolver When I close all resolver resources Then the resolver clients and content caches should be empty # ── Edge cases for coverage ────────────────────────────────────────── Scenario: CacheStats tracks operations after cache use When I create a RegistryCache wrapping a mock client When I put a package entry into the cache When I call resolve_package with type=actor ns=bench name=pkg version=v1.0.0 Then the cache stats misses should be 1 Scenario: Resolve package triggers eviction When I create a RegistryCache with max_size 2 and mock client When I call resolve_package with type=actor ns=bench name=pkg1 version=v1.0.0 When I call resolve_package with type=actor ns=bench name=pkg2 version=v1.0.0 When I call resolve_package with type=actor ns=bench name=pkg3 version=v1.0.0 Then the resolve result should contain package_id Then the cache stats evictions should be 1 Scenario: Resolve package TTL expiry triggers re-fetch When I create a RegistryCache with ttl 0.01 and mock client When I call resolve_package with type=actor ns=bench name=pkg version=v1.0.0 When I wait for TTL to expire When I call resolve_package with type=actor ns=bench name=pkg version=v1.0.0 Then the cache stats misses should be 2 Scenario: Cache content validation returns False when canonicalizer raises TypeError When I create a RegistryCache with validation enabled and mock client When I trigger SHA-1 validation with a TypeError-raising canonicalizer Then the validation should return False