feat(adk): ADK 2.0 Migration#457
Open
cofin wants to merge 29 commits into
Open
Conversation
d6da42e to
41c556b
Compare
f04986d to
1fc1e54
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #457 +/- ##
==========================================
+ Coverage 70.78% 70.91% +0.13%
==========================================
Files 438 443 +5
Lines 52541 54891 +2350
Branches 7370 7484 +114
==========================================
+ Hits 37189 38925 +1736
- Misses 12682 13217 +535
- Partials 2670 2749 +79
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Extends BaseAsyncADKStore.append_event_and_update_state with app_name, user_id, app_state, user_state keyword arguments so events INSERT, sessions UPDATE, app_state UPSERT, and user_state UPSERT execute inside one adapter-local transaction. SQLSpecSessionService stops issuing separate upsert_app_state / upsert_user_state calls and routes everything through the unified atomic method, closing the silent correctness drift where a crash between calls left session state advanced but scoped state stale (Chapter 14 v8io acceptance). Shared contract helper assert_session_atomic_scoped_write_contract is exercised by every retained adapter test file that already used the scoped-state contract.
…over - New tests/unit/extensions/test_adk/test_clean_break_guards.py fails CI if event_json reappears in any ADK source or per-adapter adk/ module, and if any backwards_compat / legacy_ / # DEPRECATED markers leak into the extension surface (PRD Global Constraint #1). - docs/extensions/adk/migrations.rst now documents the programmatic recreate_tables() / drop_tables() cutover path (Revision 6 Q8).
Revives the BigQuery ADK store per Chapter 9 (sqlspec-9k0). The store wraps BigQuery's sync client with async_(), uses native JSON columns, DATE partitioning + clustering for sessions and events, and MERGE for scoped-state upserts. ADKConfig.bigquery.session_lookup_window_days bounds list-sessions partition scans, and ADKRetentionConfig.event_ttl_seconds is converted to partition_expiration_days on the events table. The store is positioned as the analytics-replica path: BigQuery DML is seconds-latency and not transactional across statements, so production deployments should pair it with an OLTP-grade ADK adapter for live state. Unit tests in tests/unit/adapters/test_bigquery_adk.py cover instantiation, DDL shape, partitioning, clustering, and idempotent metadata seeding. The support matrix in docs/extensions/adk/backends.rst documents the new analytics-replica status and the BigQuery-specific configuration knobs.
- sqlspec/extensions/adk/memory/presets.py registers eight embedding presets (Google Vertex AI gemini-embedding-002/001, embeddinggemma-300m, text-embedding-005/004, OpenAI 3-large/3-small/ada-002). Explicit embedding_dimension wins over embedding_preset; an unresolvable config raises ImproperConfigurationError that lists every available preset. Exposed via sqlspec.extensions.adk.memory public API and documented. - docs/extensions/adk/optimizations.rst documents the Chapter 16 variation catalog (V1 NULL-encoded empty state through V8 AlloyDB columnar autopromote) and the memory embedding preset table. Linked from docs/extensions/adk/index.rst. - tools/scripts/bench_adk.py provides the harness contract (chat_loop, list_replay, struct_scan scenarios) so Chapter 16 implementers have a stable invocation surface. Scenarios remain stubs pending sqlspec-badb. - tests/unit/extensions/test_adk/test_embedding_presets.py covers preset registry, explicit-dimension overrides, runtime registration, and the ImproperConfigurationError paths.
…nfig and bench_adk
Add four contract helpers (assert_session_temp_state_not_persisted, assert_session_empty_state_roundtrip, assert_session_sibling_app_isolation, assert_session_sibling_user_isolation) and wire them across the retained ADK adapters. New per-adapter contract test files for oracledb, psycopg, psqlpy, cockroach_asyncpg, cockroach_psycopg, pymysql, and BigQuery (analytics replica path) consume the shared helpers. Spanner and BigQuery follow the existing emulator skip gates. Bugs surfaced by the matrix and tracked as xfail with bd refs: - sqlspec-xqnf: psycopg/cockroach_psycopg ADK read paths return tuples - sqlspec-8cyp: psqlpy ADK store doesn't catch UndefinedTable on reads - sqlspec-7rbl: cockroach_asyncpg hits CockroachDB multiple_active_portals Closes sqlspec-epy6, sqlspec-9yex, sqlspec-vf94.
Scope each new *_adk_store fixture session-wide so create_tables runs once per test session, dropping tables on session teardown. BigQuery routes through native_bigquery_service so the goccy/bigquery-emulator skips the suite (production DDL with PARTITION BY + multi-key CLUSTER BY + OPTIONS hangs CREATE TABLE on the emulator) and uses an autouse DELETE FROM cleanup between tests instead of DROP TABLE (per bd memory session-scope-fixtures). Closes sqlspec-0s50.
Leaves session-scoped *_adk_store fixtures in a usable state after the helper exercises drop_tables. Without this, every test that runs after assert_session_table_lifecycle_contract in the same worker fails with "table does not exist" -- pymysql, oracledb, and cockroach_asyncpg surfaced 14 such failures in CI. Closes sqlspec-nfde.
9edaaee to
276317e
Compare
- Removed unnecessary xfail markers in CockroachDB and Psycopg tests. - Updated table names in SQLite and Spanner tests to reflect new schema. - Changed metadata table name in BigQuery tests for consistency. - Enhanced test assertions for session store configurations and migrations. - Consolidated nested configuration tests into flat structure for ADK. - Removed deprecated lifecycle and capability tests. - Added new migration tests for ADK cutover scenarios. - Improved session service tests to validate state persistence and event handling.
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
This PR implements the ADK 2.0 clean-break foundation and the retained-adapter schema-parity work for upstream ADK scoped state.
Expected ADK Changes Covered Here
event_datapayload column across adapter stores.adk_session,adk_event,adk_app_state,adk_user_state, andadk_internal_metadata.ADKConfigwhile keeping driver-specific config types out of thesqlspec.extensions.adkpublic export surface.BaseAsyncADKStoreand implement them across retained shipped ADK stores.schema_version = 1.app:*anduser:*state through dedicated store hooks inSQLSpecSessionService, striptemp:*at the service boundary, and merge app/user/session state onget_session().docs/extensions/adk/and ADK examples.PLW0717inpyproject.tomlfor the new lint rule.Remaining ADK Work Tracked Outside This Commit
sqlspec-3x32/sqlspec-9k0becausesqlspec/adapters/bigquery/adk/is not present yet.sqlspec-v8io; current routing is service-level after the store event/session transaction.sqlspec-epy6/sqlspec-9yex; this PR adds fixture-backed coverage but does not close the full matrix.