Repository navigation
fix(server): create the cluster tables lazily in VersionedDatabaseTaskStore get and delete - #1357
Open
cchinchilla-dev wants to merge 1 commit into
Open
cchinchilla-dev wants to merge 1 commit into
cchinchilla-dev wants to merge 1 commit into
Conversation
…kStore get and delete
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/cluster/database_task_store.py | 96.43% | 99.30% | 🟢 +2.87% |
| src/a2a/server/tasks/database_task_store.py | 92.47% | 95.16% | 🟢 +2.69% |
| Total | 93.14% | 93.23% | 🟢 +0.09% |
Generated by coverage-comment.yml
1 task done
This branch has not been deployed
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
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #1356 🦕
Problem
VersionedDatabaseTaskStorecreates its tables lazily, likeDatabaseTaskStore, but onlysave()creates the cluster tables.get()anddelete()initialize the underlyingDatabaseTaskStoreonly, so when the store is used without callinginitialize()and the first operation is aget()or adelete(), the query ontask_versionsfails:Fix
get()anddelete()(src/a2a/server/cluster/database_task_store.py) now callself._ensure_cluster_tables()after initializing the underlying store, the same waysave()does.delete()also initializes the underlying store before creating the cluster tables, so the tables are created in the same order as insave()._ensure_cluster_tables()returns right away once the tables are ready, so stores that callinitialize()are not affected.Test
Tests were added to the existing suite at
tests/server/cluster/test_database_versioned_task_store.py, using a newuninitialized_storefixture that builds the store on an empty database withcreate_table=Trueand without callinginitialize():test_get_without_initialize_creates_tables:get()of a missing task returnsNone.test_delete_without_initialize_creates_tables:delete()of a missing task does not fail, and a laterget()returnsNone.Both tests fail on
mainwithno such table: task_versionsand pass with the fix. No existing test was modified or removed. Happy to adapt the test approach based on maintainer feedback.