fix: handle PII-scrubbed span values and unknown GitHub PR actions gracefully#119462
Draft
billyvg wants to merge 1 commit into
Draft
fix: handle PII-scrubbed span values and unknown GitHub PR actions gracefully#119462billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
…github webhooks - large_http_payload_detector: wrap int() conversion in try/except ValueError so PII-scrubbed span data values like '[Filtered]' are skipped cleanly instead of raising ValueError and suppressing the entire span detection run (SENTRY-5R9R) - github webhook deserializer: widen GitHubPullRequestEvent.action to str and validate against the known PullRequestAction values at runtime, returning None for unrecognised actions (e.g. GitHub's new "stacked" action). This stops ValidationError noise without losing coverage of legitimate actions (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.
Fixes two escalating Sentry alerts surfaced by automated monitoring.
SENTRY-5R9R —
ValueErrorinLargeHTTPPayloadDetector(HIGH actionability, 1256 occurrences)Root cause:
large_http_payload_detector.py:59callsint(encoded_body_size)whereencoded_body_sizeis a string. When Sentry's PII data scrubber replaces the value with'[Filtered]', theint()conversion throwsValueError, which is caught upstream as "Failed to detect performance problems" — silently skipping performance issue detection for that span.Fix: Wrap the
int()call intry/except ValueErrorand return early, so scrubbed spans are skipped cleanly.Evidence: Stacktrace shows
encoded_body_size = "'[Filtered]'"as a local variable at the crash point. Issue link: https://sentry.sentry.io/issues/SENTRY-5R9RSENTRY-5R97 —
ValidationError: Invalid enum value 'stacked'in GitHub webhook (MEDIUM actionability, 177 occurrences, 93 users)Root cause: GitHub introduced a new pull request action type
"stacked"(stacked PRs feature). OurGitHubPullRequestEventmsgspec struct usedPullRequestAction(a strictLiteral[...]type) for theactionfield, so msgspec's decoder throwsValidationErroron any action not in the enum. This generates a Sentry error for everystackedPR event from any customer's GitHub integration.Fix:
GitHubPullRequestEvent.actionfromPullRequestActiontostrso msgspec accepts any string without failing validation._KNOWN_PR_ACTIONSat import time fromtyping.get_argson thePullRequestActiontype alias (so it stays in sync whensentry-scmis bumped).deserialize_github_pull_request_event, returnNonefor unrecognised action types with aninfo-level log instead of crashing. The caller (deserialize_github_event) already returnsEventType | None, soNoneevents are silently dropped.Note:
sentry-scm==0.32.1(released 2026-07-10) already adds"stacked"toPullRequestAction, but it hasn't been published to the internal PyPI yet. This sentry-side fix provides immediate relief and future-proofs us against any other new GitHub action types.Evidence: Error tags show
github_event_action: stacked. Issue link: https://sentry.sentry.io/issues/SENTRY-5R97Changes
src/sentry/issue_detection/detectors/large_http_payload_detector.py: try/except ValueError aroundint(encoded_body_size)src/sentry/scm/private/webhooks/github.py: widen action field tostr, validate against_KNOWN_PR_ACTIONS, returnNonefor unknown actionsClaude session: https://claude.ai/code/session_015Gd856MCZWtWz8VmqLdaA3
Generated by Claude Code