Skip to content

fix(scm): treat unknown GitHub PR actions as unsupported events, not errors#119475

Closed
billyvg wants to merge 2 commits into
masterfrom
claude/serene-cannon-r33nmd-sentry-5r97
Closed

fix(scm): treat unknown GitHub PR actions as unsupported events, not errors#119475
billyvg wants to merge 2 commits into
masterfrom
claude/serene-cannon-r33nmd-sentry-5r97

Conversation

@billyvg

@billyvg billyvg commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes SENTRY-5R97ValidationError: Invalid enum value 'stacked' - at $.action in the GitHub webhook handler.

Root cause: GitHub introduced a new pull_request action type "stacked" that isn't in the PullRequestAction Literal[...] type in the currently pinned sentry-scm==0.32.0. When msgspec.json.Decoder(GitHubPullRequestEvent) decodes a webhook with action: "stacked", it raises msgspec.ValidationError. This exception is a generic Exception, so it bypasses the SCMProviderEventNotSupported catch in produce_event_to_scm_stream and is instead passed to report_error — creating a Sentry error for every affected webhook.

Evidence from Sentry issue:

  • 227 occurrences, 106 users affected (first seen 2026-07-07)
  • github_event_action: stacked tag visible on events
  • File: sentry/scm/private/webhooks/github.py, line 201
  • Note: sentry-scm==0.32.1 (already released in the scm-platform repo) adds "stacked" to PullRequestAction, but the wheel is not yet available in the internal PyPI.

Fix: Catch msgspec.ValidationError in deserialize_github_pull_request_event and re-raise as SCMProviderEventNotSupported. This causes unknown PR actions to be silently counted as event-not-supported (the correct behavior for unrecognized GitHub event variants) rather than being reported as Sentry errors.

# Before
def deserialize_github_pull_request_event(event: SubscriptionEvent) -> PullRequestEvent:
    e = pull_request_decoder.decode(event["event"])

# After
def deserialize_github_pull_request_event(event: SubscriptionEvent) -> PullRequestEvent:
    try:
        e = pull_request_decoder.decode(event["event"])
    except msgspec.ValidationError as exc:
        raise SCMProviderEventNotSupported(
            f"Unsupported GitHub pull_request event: {exc}"
        ) from exc

A test test_produce_to_scm_stream_unknown_pr_action_is_not_reported is added to verify unknown actions are silently dropped without calling report_error.

Follow-up: Once sentry-scm==0.32.1 is available in the internal PyPI, bump the pin in pyproject.toml to 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

claude added 2 commits July 12, 2026 15:33
…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
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 12, 2026
@billyvg billyvg closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants