fix(api): surface subscription deletion errors to users#30333
fix(api): surface subscription deletion errors to users#30333crazywoola merged 11 commits intomainfrom
Conversation
Previously, when rebuilding a trigger subscription, errors from the unsubscribe operation were silently caught and logged without propagating to the user. This left users unaware of failures during subscription management. Changes: - Check UnsubscribeResult.success and raise ValueError with the error message when unsubscribe fails - Simplify the rebuild logic by removing unnecessary try/except wrapper - Refactor update API to use cleaner conditional logic - Remove redundant test cases that tested silent error handling
Summary of ChangesHello @Mairuis, 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 addresses a critical bug where errors occurring during the deletion or unsubscription of triggers were silently ignored, leading to a poor user experience. The changes ensure that such errors are now properly surfaced to users, providing clear feedback when a subscription rebuild fails. Additionally, the PR includes refactoring to simplify the update and rebuild logic within the API, making the codebase more robust and maintainable. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 refactors the trigger subscription update and rebuild logic. The trigger_providers.py controller was simplified to handle different update scenarios (name-only, unauthorized subscriptions, and general rebuilds), moving credential merging logic out. The rebuild_trigger_subscription service method was significantly refactored to remove distributed locking and direct session management, instead performing an explicit unsubscribe followed by a new subscription, and delegating the final database update. This change also made unsubscribe failures explicit errors rather than gracefully handled exceptions. Consequently, two related tests were removed: one for gracefully handling unsubscribe errors and another for the 'provider not found' scenario. The review comment specifically requests re-adding the 'provider not found' test, emphasizing its importance for regression testing given that the provider existence check logic still exists in the rebuild_trigger_subscription method.
I am having trouble creating individual review comments. Click here to see my feedback.
api/tests/test_containers_integration_tests/services/test_trigger_provider_service.py (561-587)
The test test_rebuild_trigger_subscription_provider_not_found has been removed. This test is valuable as it ensures that the system correctly handles cases where a provider is not found during a subscription rebuild. The logic to check for a provider's existence is still present in rebuild_trigger_subscription, so this test remains relevant for regression testing. Please consider re-adding it.
… TriggerSubscriptionUpdateRequest - Introduced a model validator in TriggerSubscriptionUpdateRequest to enforce that at least one of the fields (name, credentials, parameters, properties) must be provided. - Refactored the TriggerSubscriptionUpdateApi to use the validated request object and simplified the logic for updating subscriptions based on the credential type. - Updated the credential type check in TriggerProviderService to use a set for better performance and clarity.
…i and TriggerProviderService
…ptionUpdateApi and TriggerProviderService
…oviderService - Deleted the test for rebuilding trigger subscriptions with unsupported credential types, as it was deemed unnecessary. - This change helps streamline the test suite by focusing on relevant scenarios.
Summary
This PR fixes a bug where trigger subscription deletion/unsubscribe errors were silently ignored during the rebuild process.
UnsubscribeResult.successand propagate error messages to users when unsubscribe failsany()Fixes #30332
Test Plan