Repository navigation
fix(alerts): handle dictionary payload for crashlytics digestDate - #310
hardikkaurani wants to merge 6 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the timestamp_conversion utility function to support dictionary-based timestamp inputs (containing seconds and nanoseconds) in addition to ISO 8601 strings, and adds corresponding unit tests. The review feedback highlights potential TypeError issues if dictionary keys are explicitly set to None, as well as potential floating-point precision issues when calculating fractional seconds. A robust alternative using datetime.timedelta and explicit None checks is suggested to address these concerns.
…ly handle None values
|
@IzaakGough @inlined Just checking in! The fix for Crashlytics digestDate dictionary parsing (#260) is fully implemented and tested. It properly falls back to dictionary deserialization when Eventarc payloads send objects instead of strings, preventing the SDK from crashing. All CI checks and CLA are green. Could you please take a look when you get a chance? Thanks! |
There was a problem hiding this comment.
@hardikkaurani Thanks for picking this up, this looks good overall with just one point I think we need to address.
In real alerts, digestDate comes through as {"year": 2026, "month": 5, "day": 15} (see the payloads dumped in meditohq/medito-app#884). This branch finds no seconds and returns 1970-01-01 00:00:00+00:00, so handlers stop crashing but get the wrong date with no error. Could we parse that shape in stability_digest_payload_from_ce_payload, and raise an error on any dict we don't recognize instead of defaulting to 0?
|
Just doing it. |
…stamp dict format
- Parse Crashlytics Stability Digest calendar-date dict shape {year, month, day} in _alerts_fn._parse_digest_date into timezone-aware UTC datetime at midnight
- Prevent timestamp_conversion in util.py from defaulting missing seconds to 0 / Unix epoch; raise explicit ValueError on unrecognized or incomplete timestamp dicts
- Add comprehensive regression tests in tests/test_alerts_fn.py and tests/test_util.py
|
Hi @IzaakGough, Thanks for the review and pointing out the real alert payload shape from meditohq/medito-app#884! I've updated the PR with commit 59d2271 to address your feedback:
All linters ( |
|
@IzaakGough Review this one if you had a chance ! |
Summary
This PR fixes Crashlytics alert payload deserialization when
digestDateis formatted as a dictionary. It ensures stability digests can be parsed without throwing type errors.Problem
Eventarc stability digest payloads for Crashlytics occasionally format
digestDateas a dictionary instead of a string, causing the Python SDK's deserialization to fail.Root Cause
The
alertsmodule assumesdigestDatewill always be a primitive string, lacking defensive parsing for the dictionary representation.Changes
digestDatein the Crashlytics alert payload handling.Tests
Regression coverage is included for the affected behavior.
Why This Is Not a Duplicate
This PR addresses a different issue from #299.
alertsparsing, while feat: add support for VPC direct connect #299 patches global options and VPC Direct Connect.Therefore, the two PRs address independent problems and this change does not supersede or duplicate #299.
Scope
This change is limited to the Crashlytics alert payload parsing logic and does not alter other Eventarc handlers.
Original Template Items
Fixes #260