Registry Mirror
Skip to content

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

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 default TaskModel and PushNotificationConfigModel, which map to the tasks and push_notification_configs tables. DatabaseTaskStore._to_orm and DatabasePushNotificationConfigStore._to_orm returned that model unchanged, and save / set_info merged it. So when a store uses a custom table_name:

Setup Before After
DatabaseTaskStore(table_name='my_tasks', core_to_model_conversion=core_to_compat_task_model), no tasks table save raises OperationalError: no such table: tasks row written to my_tasks, get returns it
same, tasks table exists row silently written to tasks, get on the store returns None row written to my_tasks, get returns it
DatabasePushNotificationConfigStore(table_name=..., core_to_model_conversion=core_to_compat_push_notification_config_model) config written to push_notification_configs (or fails), get_info returns [] config written to the custom table, get_info returns it
default table names, or no conversion unchanged unchanged

VersionedDatabaseTaskStore saves through DatabaseTaskStore._to_orm too, so it had the same problem and gets the same fix.

Fix

In both stores, a new _as_task_model / _as_config_model is applied to what the conversion returns:

  • If it is already an instance of the store's model class (the default table, or a conversion that builds the store's own model), it is returned as is. test_custom_conversion still passes.
  • Otherwise the column attributes the conversion set are copied into the store's model class. Attributes it did not set are left out, so column defaults such as kind='task' still apply.

No signatures change, and the compat helpers in model_conversions.py are not changed.

Tests

  • test_core_to_0_3_model_conversion_with_custom_table_name in test_database_task_store.py and in test_database_push_notification_config_store.py save 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 (with protocol_version == '0.3') and not in the default one. Both fail on main and pass with the fix:

    $ pytest tests/server/tasks -k custom_table_name   # src change reverted
    FAILED tests/server/tasks/test_database_task_store.py::test_core_to_0_3_model_conversion_with_custom_table_name[sqlite]
    FAILED tests/server/tasks/test_database_push_notification_config_store.py::test_core_to_0_3_model_conversion_with_custom_table_name[sqlite]
    2 failed, 1 passed
    
  • 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 without POSTGRES_TEST_DSN / MYSQL_TEST_DSN; these ran on SQLite only).

  • ruff check and ruff format --check pass on the changed files. ty check prints only the three existing unused type: ignore warnings in client_factory.py and transports/__init__.py.

  • Follow the CONTRIBUTING Guide.

  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.

  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)

  • Appropriate docs were updated (if necessary)

🤖 Generated with Claude Code

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>
@ShivamSharma43
ShivamSharma43 requested a review from a team as a code owner November 28, 2026 17:32
Copilot AI balanced review requested due to automatic review settings November 28, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

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 Iwaniukooo11 self-assigned this Nov 30, 2026
ShivamSharma43 and others added 2 commits December 1, 2026 21:39
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>

@Iwaniukooo11 Iwaniukooo11 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Iwaniukooo11
Iwaniukooo11 merged commit e8de541 into a2aproject:main Dec 2, 2026
21 checks passed
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.

3 participants