fix(scm): treat unknown GitHub PR actions as unsupported events, not errors#119475
Closed
billyvg wants to merge 2 commits into
Closed
fix(scm): treat unknown GitHub PR actions as unsupported events, not errors#119475billyvg wants to merge 2 commits into
billyvg wants to merge 2 commits into
Conversation
…PayloadDetector When `http.response_content_length` is a string like '[NaN]' (from scrubbed or filtered span data), `int()` raises ValueError causing detection to fail loudly. Wrap the conversion in try/except to skip such spans gracefully. Fixes SENTRY-5R9R
…errors GitHub occasionally adds new pull_request action types (e.g. 'stacked'). When the sentry-scm PullRequestAction Literal doesn't include the new value, msgspec raises a ValidationError that bubbles up as a generic exception and gets reported to Sentry. Catch msgspec.ValidationError in deserialize_github_pull_request_event and re-raise as SCMProviderEventNotSupported so unknown actions are silently counted as "event-not-supported" instead of creating Sentry error noise. Fixes SENTRY-5R97
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.
Summary
Fixes SENTRY-5R97 —
ValidationError: Invalid enum value 'stacked' - at $.actionin the GitHub webhook handler.Root cause: GitHub introduced a new pull_request action type
"stacked"that isn't in thePullRequestActionLiteral[...]type in the currently pinnedsentry-scm==0.32.0. Whenmsgspec.json.Decoder(GitHubPullRequestEvent)decodes a webhook withaction: "stacked", it raisesmsgspec.ValidationError. This exception is a genericException, so it bypasses theSCMProviderEventNotSupportedcatch inproduce_event_to_scm_streamand is instead passed toreport_error— creating a Sentry error for every affected webhook.Evidence from Sentry issue:
github_event_action: stackedtag visible on eventssentry/scm/private/webhooks/github.py, line 201sentry-scm==0.32.1(already released in the scm-platform repo) adds"stacked"toPullRequestAction, but the wheel is not yet available in the internal PyPI.Fix: Catch
msgspec.ValidationErrorindeserialize_github_pull_request_eventand re-raise asSCMProviderEventNotSupported. This causes unknown PR actions to be silently counted asevent-not-supported(the correct behavior for unrecognized GitHub event variants) rather than being reported as Sentry errors.A test
test_produce_to_scm_stream_unknown_pr_action_is_not_reportedis added to verify unknown actions are silently dropped without callingreport_error.Follow-up: Once
sentry-scm==0.32.1is available in the internal PyPI, bump the pin inpyproject.tomlto get"stacked"into the type system properly.Claude session: https://claude.ai/code/session_015pwRdeFeVj3ZSak5yEbtaY
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Generated by Claude Code