fix: make get_info_for_dispatch abstract to prevent silent notification drops - #1180
Open
ez-lbz wants to merge 2 commits into
Open
fix: make get_info_for_dispatch abstract to prevent silent notification drops#1180ez-lbz wants to merge 2 commits into
ez-lbz wants to merge 2 commits into
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/events/event_queue_v2.py | 91.79% | 91.28% | 🔴 -0.51% |
| src/a2a/server/tasks/push_notification_config_store.py | 60.00% | 100.00% | 🟢 +40.00% |
| src/a2a/utils/telemetry.py | 91.47% | 90.70% | 🔴 -0.78% |
| Total | 93.00% | 92.99% | ⚪️ -0.00% |
Generated by coverage-comment.yml
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.
What changed
1. Make
get_info_for_dispatchabstract onPushNotificationConfigStoreProblem:
PushNotificationConfigStore.get_info_for_dispatch()(src/a2a/server/tasks/push_notification_config_store.py) was not@abstractmethod. Its default implementation fell back toget_info(task_id, ServerCallContext())with a synthetic empty context, which resolves to the empty-string owner partition and returns no configs — silently dropping every push notification in any deployment with multiple owners. A subclass that forgot to override the method only logged a warning per call, so the failure was easy to miss in production.Fix (src/a2a/server/tasks/push_notification_config_store.py):
get_info_for_dispatch()is now@abstractmethod; the silent owner-scoped fallback is removed. Any store implementation that does not provide the cross-owner dispatch read path now fails loudly at instantiation time instead of dropping notifications at runtime.logger.InMemoryPushNotificationConfigStore(inmemory_push_notification_config_store.py) andDatabasePushNotificationConfigStore(database_push_notification_config_store.py).Testing
./.venv/Scripts/python -m pytest tests/server/tasks/test_inmemory_push_notifications.py -q→ 20 passed (includes 2 new tests: an incomplete subclass withoutget_info_for_dispatchcannot be instantiated; both built-in stores expose a callable dispatch read path)../.venv/Scripts/python -m pytest tests/server/tasks/test_database_push_notification_config_store.py -q→ 23 passed, 44 skipped (skips are DB-DSN-dependent tests, pre-existing)../.venv/Scripts/python -m ruff checkon modified files: clean.PushNotificationConfigStorethat do not implementget_info_for_dispatchwill now raiseTypeErrorat instantiation instead of silently dropping notifications. This is the intended loud-failure hardening.