Summary
CachedStoreCountForTesting / CachedStoreContainsForTesting in pkg/recipe/metadata_store.go:342, 367 and CachedRegistryCountForTesting / CachedRegistryContainsForTesting in pkg/recipe/components.go:274, 295 are added by #1072 to the exported surface of pkg/recipe (marked Public (evolving) in docs/integrator/public-api.md:21).
The _ForTesting suffix is convention-only. Nothing prevents production callers from using them, and once they're in the exported surface they're subject to the same evolve-with-care contract as any other public symbol.
Motivation
The PR uses these helpers only from the facade tests (aicr_internal_test.go, aicr_test.go). They have no production use. Keeping them in pkg/recipe's public API:
- pollutes the package surface for external consumers
- locks in the helpers' signature as part of the contract
- makes it harder to refactor the underlying cache (e.g., a future bounded-LRU replacement would need to maintain compatible counters)
Acceptance
Pick one approach; either is acceptable:
Related
Summary
CachedStoreCountForTesting/CachedStoreContainsForTestinginpkg/recipe/metadata_store.go:342, 367andCachedRegistryCountForTesting/CachedRegistryContainsForTestinginpkg/recipe/components.go:274, 295are added by #1072 to the exported surface ofpkg/recipe(marked Public (evolving) indocs/integrator/public-api.md:21).The
_ForTestingsuffix is convention-only. Nothing prevents production callers from using them, and once they're in the exported surface they're subject to the same evolve-with-care contract as any other public symbol.Motivation
The PR uses these helpers only from the facade tests (
aicr_internal_test.go,aicr_test.go). They have no production use. Keeping them inpkg/recipe's public API:Acceptance
Pick one approach; either is acceptable:
pkg/recipe/internal/cachetestsubpackage. Internal packages cannot be imported outsidepkg/recipe/..., so the facade tests would need to live under that path or use an export shim.pkg/recipe/cache_export_test.gowith//go:build test(orpackage recipe_test+ a shared test fixture) so they're only visible duringgo test. Facade tests pass through a fixture file inpkg/recipe.Contains*helpers; that's what the existing test inaicr_test.go(TestClient_NoCacheGrowthAcrossManyCloseCycles) already prefers.Related