Conversation
The v0.3 conversions in a2a.compat.v0_3.model_conversions build the default TaskModel and PushNotificationConfigModel, which map to the tasks and push_notification_configs tables. DatabaseTaskStore and DatabasePushNotificationConfigStore saved the returned model as is, so with a custom table_name the zero-downtime compatibility mode wrote to the default table (or failed with "no such table") and reads from the store's own table found nothing. When a conversion returns a model for another table, copy the attributes it set into the store's own model before saving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/models.py | 84.72% | 86.25% | 🟢 +1.53% |
| Total | 94.27% | 94.27% | ⚪️ 0.00% |
Generated by coverage-comment.yml
Iwaniukooo11
requested changes
Dec 1, 2026
Move the identical _as_task_model and _as_config_model helpers into a2a.server.models.as_model, used by both database stores, and shorten the docstring to one line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
The zero-downtime migration guide tells users to keep their existing store arguments ("engine, table_name, etc.") and add
core_to_model_conversion=core_to_compat_task_model/core_to_compat_push_notification_config_model. Those two helpers build the defaultTaskModelandPushNotificationConfigModel, which map to thetasksandpush_notification_configstables.DatabaseTaskStore._to_ormandDatabasePushNotificationConfigStore._to_ormreturned that model unchanged, andsave/set_infomerged it. So when a store uses a customtable_name:DatabaseTaskStore(table_name='my_tasks', core_to_model_conversion=core_to_compat_task_model), notaskstablesaveraisesOperationalError: no such table: tasksmy_tasks,getreturns ittaskstable existstasks,geton the store returnsNonemy_tasks,getreturns itDatabasePushNotificationConfigStore(table_name=..., core_to_model_conversion=core_to_compat_push_notification_config_model)push_notification_configs(or fails),get_inforeturns[]get_inforeturns itVersionedDatabaseTaskStoresaves throughDatabaseTaskStore._to_ormtoo, so it had the same problem and gets the same fix.Fix
In both stores, a new
_as_task_model/_as_config_modelis applied to what the conversion returns:test_custom_conversionstill passes.kind='task'still apply.No signatures change, and the compat helpers in
model_conversions.pyare not changed.Tests
test_core_to_0_3_model_conversion_with_custom_table_nameintest_database_task_store.pyand intest_database_push_notification_config_store.pysave through the v0.3 conversion with a custom table name, read it back through the store, and check that the row is in the custom table (withprotocol_version == '0.3') and not in the default one. Both fail on main and pass with the fix:uv run pytest tests/server/tasks tests/server/cluster tests/compat/v0_3 tests/migrations: 739 passed, 205 skipped (the PostgreSQL and MySQL variants skip withoutPOSTGRES_TEST_DSN/MYSQL_TEST_DSN; these ran on SQLite only).ruff checkandruff format --checkpass on the changed files.ty checkprints only the three existing unusedtype: ignorewarnings inclient_factory.pyandtransports/__init__.py.Follow the
CONTRIBUTINGGuide.Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
Ensure the tests and linter pass (Run
bash scripts/format.shfrom the repository root to format)Appropriate docs were updated (if necessary)
🤖 Generated with Claude Code