Skip to content

feat(sentry apps): add urls to issue.created webhook #93780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 23, 2025

Conversation

Christinarlong
Copy link
Contributor

per - #93404 & getsentry/sentry-docs#8992

We were missing urls in the issue.created webhooks despite docs saying we had them. This PR adds url, web_url & project_url according to the docs

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 18, 2025
@Christinarlong Christinarlong marked this pull request as ready for review June 18, 2025 15:54
@Christinarlong Christinarlong requested review from a team as code owners June 18, 2025 15:54
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/organizations/absolute_url.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #93780      +/-   ##
==========================================
+ Coverage   81.66%   88.05%   +6.39%     
==========================================
  Files       10330    10335       +5     
  Lines      596288   598088    +1800     
  Branches    23163    23163              
==========================================
+ Hits       486957   526670   +39713     
+ Misses     108875    70962   -37913     
  Partials      456      456              

Comment on lines 696 to 700
query = None
path = f"/issues/{self.id}/"
if params:
query = urlencode(params)
return self.organization.absolute_api_url(path=path, query=query)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to include query params? The published endpoint doesn't look like it takes any? https://docs.sentry.io/api/events/retrieve-an-issue/ :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm are we sure we don't have any referrer middlewares that would care about this? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wym referrer middleware? Like if we check the referrer q param in the endpoint? Looking at the endpoint in the published docs, it looks like there's also an expand and collapse query parameter that's present but not documented. So ig we should keep the params part above

@@ -326,12 +346,13 @@ def _process_resource_change(
)
if event in installation.sentry_app.events
]
data = {}
data: dict[str, Any] = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need to be addressed here, but is the _webhook_event_data function typed and could we narrow this from Any somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_webhook_event_data isn't typed, I looked into this and the main issue is trying to type the BaseEvent serialization is despairge. Like at this bottom part it'll serialize an unknown list of additional 'items' which makes it hard to turn into an accurate TypedDict. I couldn't find another part of our codebase that tackles this so wasn't sure on how to proceed :/

@Christinarlong Christinarlong merged commit 5c8eb66 into master Jun 23, 2025
63 checks passed
@Christinarlong Christinarlong deleted the crl/issue_urls_in_webhook branch June 23, 2025 20:47
Copy link

sentry-io bot commented Jun 27, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants