feat: scope-aware caching with session_id callback#25
Merged
nogueira-raphael merged 1 commit intomainfrom Feb 16, 2026
Merged
Conversation
Replace session_context_keys with a session_id callback on the Ariadne adapter. PUBLIC responses use a shared cache key while PRIVATE responses are cached per-user via the session_id. PRIVATE responses without a session_id are not cached. Strawberry reverts to public-only caching until scope calculation is added.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 88.10% 89.74% +1.63%
==========================================
Files 33 33
Lines 925 926 +1
Branches 140 142 +2
==========================================
+ Hits 815 831 +16
+ Misses 87 71 -16
- Partials 23 24 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
session_context_keys(CacheConfig field) with asession_idcallback on the Ariadne adapter, following Apollo Server's scope-aware caching modelsession_idare skipped (not cached), with a warning loggedcontext=None) until scope calculation is addedTest plan
TestGetSessionId— callback returns value, returns None, no callbackTestDualLookup— private hit, public hit after private miss, both miss, no sid skips privateTestScopeAwareStore— PUBLIC stores withcontext=None, PRIVATE+sid stores with session context, PRIVATE without sid skips, not cacheable skipsTestScopeAwareCaching(integration) — private per-user isolation, public shared across userscontext=Noneuniformly