Skip to content
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

ref(event_manager): Fix typing issues for event_manager #52974

Merged
merged 8 commits into from
Jul 17, 2023

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jul 17, 2023

We want to make a lot of changes to event_manager and we need to have backend typing in place for the upcoming work.

Fixes #52877

armenzg and others added 5 commits July 17, 2023 08:51
@armenzg armenzg self-assigned this Jul 17, 2023
@armenzg armenzg marked this pull request as ready for review July 17, 2023 12:52
@armenzg armenzg requested review from a team as code owners July 17, 2023 12:52
@armenzg armenzg requested a review from a team July 17, 2023 12:52
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 17, 2023
@armenzg armenzg requested a review from a team July 17, 2023 12:53
@armenzg armenzg enabled auto-merge (squash) July 17, 2023 12:53
@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Merging #52974 (8d6f431) into master (a05bfaf) will decrease coverage by 1.62%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #52974      +/-   ##
==========================================
- Coverage   79.38%   77.76%   -1.62%     
==========================================
  Files        4935     4934       -1     
  Lines      207336   207428      +92     
  Branches    35424    35443      +19     
==========================================
- Hits       164586   161312    -3274     
- Misses      37714    41071    +3357     
- Partials     5036     5045       +9     
Impacted Files Coverage Δ
src/sentry/attachments/__init__.py 100.00% <100.00%> (ø)
src/sentry/eventtypes/__init__.py 100.00% <100.00%> (ø)
src/sentry/grouping/result.py 90.00% <100.00%> (ø)
src/sentry/tsdb/__init__.py 100.00% <100.00%> (ø)

... and 298 files with indirect coverage changes

@@ -2155,7 +2139,7 @@ def save_attachment(
type=attachment.type,
headers={"Content-Type": attachment.content_type},
)
file.putfile(BytesIO(data), blob_size=settings.SENTRY_ATTACHMENT_BLOB_SIZE)
file.putfile(BytesIO(data), blob_size=settings.SENTRY_ATTACHMENT_BLOB_SIZE) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

(I think this got lost from the other review but want to make sure it gets addressed)

the problem here is the type alias above -- it shouldn't be Type[Cached...] ( don't remember the name and it's offscreen) -- the type alias should probably be removed entirely at that point since it'll just be A = B and just meaningless indirection

@@ -2266,7 +2250,8 @@ def _calculate_event_grouping(
event.data["grouping_config"] = get_grouping_config_dict_for_project(project)
hashes = event.get_hashes()

hashes.write_to_event(event.data)
# Using cast to satisfy mypy
hashes.write_to_event(cast(Dict[str, Any], event.data))
Copy link
Member

Choose a reason for hiding this comment

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

the types should get updated here rather than cast -- cast and type: ignore should generally only be used for mypy bugs

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

@armenzg armenzg merged commit e21c9ad into master Jul 17, 2023
@armenzg armenzg deleted the event-manager-typing/armenzg branch July 17, 2023 20:46
@armenzg armenzg added this to the save_event improvements work milestone Jul 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2023
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.

Add typing for event_manager
2 participants