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

typing(models): Type event store models #77407

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Sep 12, 2024

No description provided.

@armenzg armenzg self-assigned this Sep 12, 2024
@armenzg armenzg requested a review from a team September 12, 2024 16:43
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 12, 2024
self.project_id = project_id
self.event_id = event_id
self._snuba_data = snuba_data or {}

def __getstate__(self) -> Mapping[str, Any]:
def __getstate__(self) -> dict[str, Any]:
Copy link
Member Author

Choose a reason for hiding this comment

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

This will allow for some .pop() that is done later on.

@@ -99,7 +99,7 @@ def platform(self) -> str | None:
column = self._get_column_name(Columns.PLATFORM)
if column in self._snuba_data:
return cast(str, self._snuba_data[column])
return cast(str, self.data.get("platform", None))
return self.data.get("platform")
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed.

template = self.project.get_option("mail:subject_template")
if template:
template = EventSubjectTemplate(template)
elif self.group.issue_category == GroupCategory.PERFORMANCE:
Copy link
Member Author

Choose a reason for hiding this comment

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

self.group is not available in BaseEvent. Moving this function to EventGroup.

# for a long time culprit was not persisted. In those cases put
# the culprit in from the group.
if data.get("culprit") is None and self.group_id and self.group:
data["culprit"] = self.group.culprit
Copy link
Member Author

Choose a reason for hiding this comment

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

self.group is not available in BaseEvent. Moving this function to EventGroup.

@@ -591,10 +547,10 @@ def __init__(
):
super().__init__(project_id, event_id, snuba_data=snuba_data)
self.group_id = group_id
self.groups = groups
self.groups = groups or []
self.data = data
Copy link
Member Author

Choose a reason for hiding this comment

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

@asottile-sentry @wedamija I need help here. I can't figure out how to fix this error.

mypy src/sentry/eventstore/models.py
src/sentry/eventstore/models.py:549: error: Incompatible types in assignment (expression has type "Mapping[str, Any] | None", variable has type "NodeData")  [assignment]
Found 1 error in 1 file (checked 1 source file)

Copy link
Member

Choose a reason for hiding this comment

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

mypy doesn't understand disparate setters unfortunately -- you can work around this by making the property setter call some private method and have this call that same private method

Copy link

codecov bot commented Sep 12, 2024

❌ 1454 Tests Failed:

Tests completed Failed Passed Skipped
12285 1454 10831 116
View the top 3 failed tests by shortest run time
tests.sentry.integrations.vsts.test_issues.VstsIssueFormTest test_default_project
Stack Traces | 0.012s run time
No failure message available
tests.sentry.integrations.vsts.test_issues.VstsIssueFormTest test_default_project_no_projects
Stack Traces | 0.013s run time
No failure message available
tests.sentry.grouping.test_variants test_event_hash_variant[legacy:2019_03_12-javascript_message]
Stack Traces | 0.046s run time
#x1B[1m#x1B[.../sentry/grouping/test_variants.py#x1B[0m:57: in test_event_hash_variant
    evt.project = None
#x1B[1m#x1B[.../sentry/eventstore/models.py#x1B[0m:298: in project
    self.project_id = project.id
#x1B[1m#x1B[31mE   AttributeError: 'NoneType' object has no attribute 'id'#x1B[0m

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@getsantry
Copy link
Contributor

getsantry bot commented Oct 4, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Oct 4, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Oct 27, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Oct 27, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Nov 18, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Nov 18, 2024
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