Skip to content

feat(typing): add possibly-undefined-check to issues team / error ingestion critical code #68283

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

Closed
wants to merge 10 commits into from
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,3 +644,16 @@ module = [
disallow_any_generics = true
disallow_untyped_defs = true
# end: stronger typing

# begin: possibly-undefined checks for issue team critical code
[[tool.mypy.overrides]]
module = [
"sentry.issues.*",
"sentry.tasks.post_process",
"sentry.event_manager",
"sentry.grouping.*",
"sentry.tasks.store",
"sentry.ingest.consumer.processors"
]
enable_error_code = ["possibly-undefined"]
# end: possibly-undefined
Comment on lines +647 to +659
Copy link
Member

Choose a reason for hiding this comment

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

if we're going to do this (I still don't think this is the right way to land this change and doesn't prevent this issue from happening in general) let's just add this to the stronger list above

Copy link
Member Author

Choose a reason for hiding this comment

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

#65589 (comment) -- on the previous PR, you asked me to make changes, i made the changes, and you still did not approve it, and when i made follow up comments, you did not address them or respond to them.

Here, can you please inform me that if i make these changes, you will approve the PR?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, let's do that.

It may also be easier to reduce the number of modules you want to adjust.

Copy link
Member Author

Choose a reason for hiding this comment

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

We will be unable to cover all of our code here without a lot of effort -- 267 errors would need to be fixed.

Unless we get dedicated time to try and address all of this, we will have to add a much smaller subset of these files, if any of them at the moment.

Why are we so against preventing incidents with mypy checks?

Copy link
Member

Choose a reason for hiding this comment

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

Was possibly undefined a case missed which caused an incident?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually think it would be less work to enable this check for the whole codebase, than to try and add all of the issues / error ingestion code to the strict typing check set.

1 change: 1 addition & 0 deletions src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ def _get_replay_id(event):
kafka_payload = transform_event_for_linking_payload(replay_id, group_event)
except ValueError:
metrics.incr("post_process.process_replay_link.id_invalid")
return

publisher.publish(
"ingest-replay-events",
Comment on lines +1071 to 1074
Copy link
Member

Choose a reason for hiding this comment

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

slightly more correct / less error prone would be to use try: else:

Expand Down