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

Conversation

JoshFerge
Copy link
Member

@JoshFerge JoshFerge commented Apr 4, 2024

We continually face incidents/issues where this type check configuration would have caught the error.

I attempted to add this for all of sentry in #65589 but this was deemed unsatisfactory because there was a push to try and fix all of the errors in sentry before merging, a large task which i did not have time for.

Here, instead, we add an allowlist, which right now contains critical issues team code, which we want to have a higher safety bar for.

This PR will prevent incidents, and make our ingestion safer.

I fix one instance of this error in post_process.

@JoshFerge JoshFerge requested review from a team as code owners April 4, 2024 18:38
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 4, 2024
Comment on lines +647 to +659

# 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
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.

Comment on lines +1071 to 1074
return

publisher.publish(
"ingest-replay-events",
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:

@armenzg armenzg self-requested a review April 4, 2024 19:16
Copy link
Member

@armenzg armenzg left a comment

Choose a reason for hiding this comment

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

After chatting with Josh I believe this makes sense.

@getsantry
Copy link
Contributor

getsantry bot commented Apr 26, 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 the Stale label Apr 26, 2024
@getsantry getsantry bot closed this May 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2024
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 Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants