feat(ai-sdk)!: decouple cache-backed run stores from @rudderjs/cache (#36)#42
Merged
Conversation
…36) First child of the @rudderjs decoupling epic (#35). - New exported neutral CacheAdapter contract (get/set/forget) in src/cache-adapter.ts — one source of truth for the cache seam. - CachedAgentRunStore / CachedSubAgentRunStore no longer lazy-import @rudderjs/cache or read a global CacheRegistry. They take a REQUIRED caller-supplied { cache } (typed CacheAdapter); construction without it throws a clear error. All in-repo + documented usage already passed it. - Default key prefixes rudderjs:ai:* -> gemstack:ai:* (5-min-TTL ephemeral run snapshots; self-heal on upgrade; keyPrefix override available). - GoogleCacheRegistry (already BYO-store) made fully neutral: aliases the shared CacheAdapter, gemstack:ai:google-cache: prefix, no @rudderjs/cache references in code or docs. Fixed the in-memory-fallback warning text. - Cleaned the @rudderjs/cache doc mention in types.ts. The only remaining @rudderjs/cache ref in src is the /server provider (tracked under epic child #39). Added cache-required guard tests. Typecheck clean, 979 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36. First child of the
@rudderjsdecoupling epic #35.What
CacheAdaptercontract (exported) - a 3-method interface (get/set/forget) insrc/cache-adapter.ts, the single neutral cache seam for the engine.CachedAgentRunStore/CachedSubAgentRunStoreno longer lazy-import@rudderjs/cacheor read a globalCacheRegistry. They now require{ cache }(typedCacheAdapter); constructing without it throws a clear error. Bring any cache (redis, Memcached, aMap, a framework cache).store): now uses the sharedCacheAdapterand agemstack:ai:google-cache:prefix, zero@rudderjs/cachereferences.@rudderjs/cachedoc mention intypes.ts.Breaking (0.x -> minor)
new Cached*RunStore()with no cache now throws; pass{ cache }. All in-repo and documented usage already does.rudderjs:ai:*->gemstack:ai:*. These guard 5-minute-TTL ephemeral run snapshots, so on upgrade in-flight parked runs fall back to "not found" once (self-heal). OverridekeyPrefixto keep the old value.Scope
The only remaining
@rudderjs/cachereference insrcis the/serverprovider, which is handled by epic child #39.Verification
Added cache-required guard tests. Typecheck clean, 979 tests pass. Minor changeset included.