Skip to content

feat(adk): scoped memory recall and domain type modernization (#704) - #705

Open
cofin wants to merge 1 commit into
mainfrom
feat/adk-updates
Open

feat(adk): scoped memory recall and domain type modernization (#704)#705
cofin wants to merge 1 commit into
mainfrom
feat/adk-updates

Conversation

@cofin

@cofin cofin commented Aug 15, 2026

Copy link
Copy Markdown
Member

Description

This PR implements scoped memory recall levels for the Google ADK memory store extension (resolving #704) along with domain type modernization, singular table names across all 14 database dialect adapters, and canonical migration consolidation.

Key Changes

  • Scoped Memory Recall (Issue ADK memory store: scoped recall levels (app-level shared memory alongside user memory) #704):
    • Added scope VARCHAR(16) NOT NULL DEFAULT 'user' to adk_memory table DDL across all 14 database adapters.
    • Added composite indexes on (app_name, scope, user_id, timestamp DESC) and (app_name, scope).
    • Default recall retrieves both user-scoped memory (scope = 'user' AND user_id = :user_id) and app-scoped memory (scope = 'app' AND app_name = :app_name).
    • Added support for explicit scope_filter: Literal['all', 'user', 'app'] = 'all'.
    • Added scope: str = 'user' parameter to memory ingestion methods (add_memories, add_events_to_memory, add_session_to_memory).
    • Added scoped retention filtering support to delete_entries_older_than(days, app_name=None, scope=None).
  • Domain Type Modernization:
    • Replaced legacy record types with clean domain names: StoredMemory, StoredSession, StoredEvent, StoredArtifact.
    • Removed all backward-compatibility aliases (MemoryRecord, SessionRecord, etc.).
  • Singular Table Names:
    • Standardized all ADK tables across all adapters to singular names: adk_session, adk_event, adk_memory, adk_app_state, adk_user_state, adk_artifact, adk_internal_metadata.
  • Canonical Migration Consolidation:
    • Consolidated 0001_create_adk_tables.py to generate the singular schema with scope directly.

Verification

  • make lint: 100% passed (Ruff, Prek, slotscheck, codespell, sphinx-lint, zizmor)
  • make type-check: 100% passed (Mypy + Pyright, 0 errors)
  • uv run pytest tests/unit/: 9,222 passed, 0 failed, 26 skipped
  • Integration tests: Scoped recall, user isolation, explicit filters, and scoped retention verified across SQLite, AioSQLite, and DuckDB.

@codecov-commenter

codecov-commenter commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 43.95492% with 547 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.01%. Comparing base (8310f31) to head (075b5ea).

Files with missing lines Patch % Lines
...xtensions/adk/migrations/0001_create_adk_tables.py 0.00% 67 Missing ⚠️
sqlspec/adapters/cockroach_psycopg/adk/store.py 27.69% 47 Missing ⚠️
sqlspec/adapters/psycopg/adk/store.py 33.33% 46 Missing ⚠️
sqlspec/adapters/mysqlconnector/adk/store.py 26.22% 45 Missing ⚠️
sqlspec/adapters/oracledb/adk/store.py 42.64% 39 Missing ⚠️
sqlspec/adapters/cockroach_asyncpg/adk/store.py 17.77% 37 Missing ⚠️
sqlspec/adapters/spanner/adk/store.py 36.20% 37 Missing ⚠️
sqlspec/extensions/adk/memory/store.py 55.40% 31 Missing and 2 partials ⚠️
sqlspec/adapters/asyncpg/adk/store.py 20.51% 31 Missing ⚠️
sqlspec/adapters/psqlpy/adk/store.py 28.20% 28 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #705      +/-   ##
==========================================
- Coverage   77.47%   77.01%   -0.46%     
==========================================
  Files         487      487              
  Lines       68387    68890     +503     
  Branches     9418     9525     +107     
==========================================
+ Hits        52983    53057      +74     
- Misses      11998    12422     +424     
- Partials     3406     3411       +5     
Flag Coverage Δ
integration 60.55% <37.90%> (-0.34%) ⬇️
py3.10 75.38% <43.95%> (-0.44%) ⬇️
py3.11 75.38% <43.95%> (-0.46%) ⬇️
py3.12 75.39% <43.95%> (-0.45%) ⬇️
py3.13 75.39% <43.95%> (-0.44%) ⬇️
py3.14 76.21% <43.83%> (-0.49%) ⬇️
unit 64.69% <30.94%> (-0.45%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/adapters/aiosqlite/adk/store.py 75.77% <100.00%> (+1.02%) ⬆️
sqlspec/adapters/bigquery/adk/store.py 63.44% <100.00%> (ø)
sqlspec/adapters/sqlite/adk/store.py 77.02% <100.00%> (+0.69%) ⬆️
sqlspec/extensions/adk/__init__.py 100.00% <100.00%> (ø)
sqlspec/extensions/adk/_types.py 100.00% <100.00%> (ø)
sqlspec/extensions/adk/artifact/__init__.py 100.00% <100.00%> (ø)
sqlspec/extensions/adk/artifact/_types.py 100.00% <100.00%> (ø)
sqlspec/extensions/adk/artifact/store.py 84.84% <ø> (ø)
sqlspec/extensions/adk/converters.py 100.00% <100.00%> (ø)
sqlspec/extensions/adk/memory/__init__.py 100.00% <100.00%> (ø)
... and 24 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants