feat: Zero-downtime support for Database migration#831
feat: Zero-downtime support for Database migration#831sokoliva merged 13 commits intoa2aproject:1.0-devfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces crucial changes to support zero-downtime database migrations by addressing data type incompatibilities between older (v0.3) and newer (v1.0) data models. It provides a mechanism for database stores to seamlessly convert between these versions, ensuring that existing 0.3 entries can be read and new 0.3 compatible entries can be written during a transition phase, thus preventing service disruption. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces new conversion utilities in src/a2a/compat/v0_3/conversions.py to facilitate persistence of v1.0 core protobuf Task and TaskPushNotificationConfig objects into v0.3 JSON-structured SQLAlchemy models, including encryption support for push notification configurations. The DatabaseTaskStore and DatabasePushNotificationConfigStore classes are updated to allow injecting these custom conversion functions, overriding the default serialization logic. New tests validate these conversion flows. Review comments suggest removing an unreliable hasattr(conversion, '__func__') check in both database stores and addressing minor stylistic issues by removing trailing commas in import statements.
src/a2a/server/tasks/database_push_notification_config_store.py
Outdated
Show resolved
Hide resolved
src/a2a/server/tasks/database_push_notification_config_store.py
Outdated
Show resolved
Hide resolved
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/tasks/database_push_notification_config_store.py | 94.74% | 95.14% | 🟢 +0.40% |
| src/a2a/server/tasks/database_task_store.py | 90.91% | 91.52% | 🟢 +0.61% |
| Total | 89.89% | 89.94% | 🟢 +0.05% |
Generated by coverage-comment.yml
Description
The old 0.3 version is not able to read the 1.0 entries from database because of the inconsistencies between 1.0 and 3.0 data types. This applies to both DatabaseTaskStore and DatabasePushNotificationConfigStore. This PR fixes this issue by allowing users to write 0.3 compatible entires during migration period.
Changes
compat/0_3/conversions.pyDatabaseTaskStoreandDatabasePushNotificationConfigStoreto accept new conversion methodsDatabaseTaskStoreandDatabasePushNotificationConfigStoreTested
Created a database using
0.3spec containing populated tablestaskandpush_notification_configs. Ranuv run a2a-dbusing1.0spec against the database and added new entries using the new Zero-downtime feature,DatabaseTaskStore.core_to_model_conversion = core_to_compat_task_modelandDatabasePushNotificationConfigStore.core_to_model_conversion = core_to_compat_push_notification_config_model. Succesfully read new entries using0.3spec.Fixes #811 🦕