fix: preserve crashlytics options#279
Open
IzaakGough wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function _alert_options_to_firebase_alert_options to streamline the conversion of event handler options to Firebase alert options, refactoring several _endpoint methods to use it, and adds comprehensive unit tests to verify option preservation. The reviewer suggested simplifying the helper function's signature by dynamically extracting app_id from the options object using getattr, which would eliminate the need to explicitly pass self.app_id in multiple _endpoint implementations.
cabljac
approved these changes
Jun 8, 2026
cabljac
left a comment
Contributor
There was a problem hiding this comment.
lgtm - i think Gemini comments are mostly cleanup nits, probably worth doing
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.
Fixes #265
Summary
Alert-based function decorators were reconstructing
FirebaseAlertOptionswith onlyalert_typeandapp_id, which dropped shared handler settings likeregion,max_instances,retry, andsecrets. This change preserves the full option set when building alert endpoints and adds coverage across the alert wrappers that delegate toFirebaseAlertOptions.Problem/Root Cause
Issue #265 reports that Crashlytics alert handlers ignored configuration such as region, max instances, and secrets. The same pattern also applied to the other alert-specific option wrappers. In each
_endpoint()implementation, the wrapper created a freshFirebaseAlertOptionswith just the alert identifiers, so the inheritedEventHandlerOptionsfields on the original options object never made it into the generated endpoint manifest.Solution/Changes
Add a shared helper that copies the dataclass fields from the original alert options object into a new
FirebaseAlertOptions, while overriding onlyalert_typeandapp_idwhere needed. Update the App Distribution, Crashlytics, Performance, and Billing option wrappers to use that helper before generating the endpoint. Expandtests/test_options.pywith endpoint assertions that verify shared options are preserved for each alert wrapper and for directalerts_fn.on_alert_published(...)usage.Testing
uv run pytest tests/test_options.py