Skip to content

Conversation

@asottile-sentry
Copy link
Contributor

@asottile-sentry asottile-sentry commented Jul 20, 2023

working around python/mypy#5570

this is especially important as more things are being moved to unions of HC | Model

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 20, 2023
@asottile-sentry
Copy link
Contributor Author

mypy diff
--- /dev/fd/63	2023-07-20 17:06:15
+++ /dev/fd/62	2023-07-20 17:06:15
@@ -12,7 +12,7 @@
 .venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/typing.pyi:886: note: "update" of "TypedDict" defined here
 .venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/typing.pyi:886: note: "update" of "TypedDict" defined here
 .venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/typing.pyi:886: note: "update" of "TypedDict" defined here
-Found 6786 errors in 1202 files (checked 4942 source files)
+Found 6714 errors in 1197 files (checked 4942 source files)
 src/sentry/api/authentication.py:101: error: Argument 1 to "authenticate_credentials" of "BasicAuthentication" has incompatible type "Request"; expected "str"  [arg-type]
 src/sentry/api/authentication.py:138: error: "list" is not subscriptable, use "typing.List" instead  [misc]
 src/sentry/api/authentication.py:139: error: Incompatible return value type (got "Union[List[bytes], bool]", expected "bool")  [return-value]
@@ -174,7 +174,7 @@
 src/sentry/api/bases/organizationmember.py:36: note:      Superclass:
 src/sentry/api/bases/organizationmember.py:36: note:      Superclass:
 src/sentry/api/bases/organizationmember.py:65: error: Need type annotation for "args" (hint: "args: List[<type>] = ...")  [var-annotated]
-src/sentry/api/bases/organizationmember.py:69: error: No overload variant of "update" of "MutableMapping" matches argument types "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]", "bool"  [call-overload]
+src/sentry/api/bases/organizationmember.py:69: error: No overload variant of "update" of "MutableMapping" matches argument types "Any", "bool"  [call-overload]
 src/sentry/api/bases/organizationmember.py:69: note:     def update(self, **kwargs: Organization) -> None
 src/sentry/api/bases/organizationmember.py:69: note:     def update(self, Iterable[Tuple[str, Organization]], /, **kwargs: Organization) -> None
 src/sentry/api/bases/organizationmember.py:69: note:     def update(self, SupportsKeysAndGetItem[str, Organization], /, **kwargs: Organization) -> None
@@ -278,12 +278,9 @@
 src/sentry/api/endpoints/accept_organization_invite.py:153: error: Item "None" of "Optional[RpcOrganizationMember]" has no attribute "organization_id"  [union-attr]
 src/sentry/api/endpoints/accept_organization_invite.py:164: error: Item "None" of "Optional[RpcOrganizationMember]" has no attribute "id"  [union-attr]
 src/sentry/api/endpoints/accept_organization_invite.py:165: error: Item "None" of "Optional[RpcOrganizationMember]" has no attribute "token"  [union-attr]
-src/sentry/api/endpoints/accept_organization_invite.py:179: error: Argument "user_id" to "get_invite_state" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/accept_organization_invite.py:71: error: Incompatible types in assignment (expression has type "List[<nothing>]", base class "Endpoint" defined the type as "Tuple[Type[BasePermission], ...]")  [assignment]
 src/sentry/api/endpoints/accept_organization_invite.py:80: error: Argument "invite_context" to "ApiInviteHelper" has incompatible type "RpcUserOrganizationContext"; expected "RpcUserInviteContext"  [arg-type]
-src/sentry/api/endpoints/accept_organization_invite.py:86: error: Argument "user_id" to "get_invite_state" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/accept_organization_invite.py:99: error: Item "None" of "Optional[RpcOrganizationMember]" has no attribute "invite_approved"  [union-attr]
-src/sentry/api/endpoints/accept_project_transfer.py:63: error: Argument "user_id" to "get_organizations_where_user_is_owner" of "OrganizationManager" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/artifact_lookup.py:133: error: Need type annotation for "individual_files" (hint: "individual_files: List[<type>] = ...")  [var-annotated]
 src/sentry/api/endpoints/artifact_lookup.py:139: error: Argument 3 to "get_legacy_releasefile_by_file_url" has incompatible type "str"; expected "List[str]"  [arg-type]
 src/sentry/api/endpoints/artifact_lookup.py:139: error: Incompatible types in assignment (expression has type "Sequence[ReleaseFile]", variable has type "List[Any]")  [assignment]
@@ -414,7 +411,6 @@
 src/sentry/api/endpoints/group_integrations.py:90: error: Argument 1 to "has_feature" of "IntegrationProvider" has incompatible type "IntegrationFeatures"; expected "IntegrationProvider"  [arg-type]
 src/sentry/api/endpoints/group_integrations.py:90: error: Missing positional argument "feature" in call to "has_feature" of "IntegrationProvider"  [call-arg]
 src/sentry/api/endpoints/group_notes.py:63: error: Argument "user" to "subscribe" of "GroupSubscriptionManager" has incompatible type "Union[User, AnonymousUser]"; expected "RpcUser"  [arg-type]
-src/sentry/api/endpoints/group_notes.py:78: error: Argument "user_id" to "create_group_activity" of "ActivityManager" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/api/endpoints/group_similar_issues.py:28: error: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")  [assignment]
 src/sentry/api/endpoints/group_stats.py:22: error: Module has no attribute "get_range"  [attr-defined]
 src/sentry/api/endpoints/group_tagkey_details.py:25: error: Module has no attribute "prefix_reserved_key"  [attr-defined]
@@ -498,7 +494,6 @@
 src/sentry/api/endpoints/integrations/sentry_apps/stats/index.py:14: error: Incompatible types in assignment (expression has type "Tuple[Type[SuperuserPermission]]", base class "SentryAppsBaseEndpoint" defined the type as "Tuple[Type[SentryAppsPermission]]")  [assignment]
 src/sentry/api/endpoints/internal/mail.py:24: error: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "email"  [union-attr]
 src/sentry/api/endpoints/internal/mail.py:40: error: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "email"  [union-attr]
-src/sentry/api/endpoints/internal/mail.py:40: error: List item 0 has incompatible type "Union[EmailField[Union[str, int, Combinable], str], Any]"; expected "str"  [list-item]
 src/sentry/api/endpoints/internal/stats.py:17: error: Module has no attribute "get_range"  [attr-defined]
 src/sentry/api/endpoints/issue_occurrence.py:41: error: Item "None" of "Optional[RpcUser]" has no attribute "id"  [union-attr]
 src/sentry/api/endpoints/issue_occurrence.py:64: error: Value of type "Optional[TopicDefinition]" is not indexable  [index]
@@ -663,7 +658,6 @@
 src/sentry/api/endpoints/organization_events_trace.py:300: error: Value of "start_timestamp" has incompatible type "Optional[Any]"; expected "str"  [typeddict-item]
 src/sentry/api/endpoints/organization_events_trace.py:309: error: Value of "measurements" has incompatible type "Optional[Any]"; expected "Dict[str, int]"  [typeddict-item]
 src/sentry/api/endpoints/organization_events_trace.py:509: error: Argument 1 to "get_snuba_params" of "OrganizationEventsEndpointBase" has incompatible type "HttpRequest"; expected "Request"  [arg-type]
-src/sentry/api/endpoints/organization_events_trace.py:524: error: Argument 3 to "record_analytics" of "OrganizationEventsTraceEndpointBase" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/organization_events_trace.py:543: error: "OrganizationEventsTraceEndpointBase" has no attribute "serialize"  [attr-defined]
 src/sentry/api/endpoints/organization_events_trace.py:883: error: Argument 1 to "get_snuba_params" of "OrganizationEventsEndpointBase" has incompatible type "HttpRequest"; expected "Request"  [arg-type]
 src/sentry/api/endpoints/organization_events_trends.py:440: error: Incompatible types in assignment (expression has type "str", variable has type "datetime")  [assignment]
@@ -703,7 +697,6 @@
 src/sentry/api/endpoints/organization_index.py:41: error: Right operand of "and" is never evaluated  [unreachable]
 src/sentry/api/endpoints/organization_index.py:78: error: Item "Token" of "Union[Token, Any]" has no attribute "organization_id"  [union-attr]
 src/sentry/api/endpoints/organization_index.py:79: error: Item "Token" of "Union[Token, Any]" has no attribute "organization_id"  [union-attr]
-src/sentry/api/endpoints/organization_index.py:86: error: Argument "user_id" to "get_organizations_where_user_is_owner" of "OrganizationManager" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/organization_integration_repos.py:45: error: Need type annotation for "context"  [var-annotated]
 src/sentry/api/endpoints/organization_integration_repos.py:65: error: Value of type "Repository" is not indexable  [index]
 src/sentry/api/endpoints/organization_integration_repos.py:66: error: Value of type "Repository" is not indexable  [index]
@@ -718,7 +711,6 @@
 src/sentry/api/endpoints/organization_member/details.py:170: error: Argument "email" to "for_organization_member_invite" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/api/endpoints/organization_member/details.py:171: error: Argument "user" to "for_organization_member_invite" has incompatible type "Union[User, AnonymousUser]"; expected "Optional[User]"  [arg-type]
 src/sentry/api/endpoints/organization_member/details.py:172: error: Argument "auth" to "for_organization_member_invite" has incompatible type "Union[Token, Any]"; expected "Optional[ApiToken]"  [arg-type]
-src/sentry/api/endpoints/organization_member/details.py:193: error: Argument 1 to "send_sso_link_email" of "OrganizationMember" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/organization_member/details.py:73: error: Incompatible types in assignment (expression has type "List[Type[RelaxedMemberPermission]]", base class "OrganizationEndpoint" defined the type as "Tuple[Type[OrganizationPermission]]")  [assignment]
 src/sentry/api/endpoints/organization_member/index.py:16: error: Module "sentry.api.serializers.rest_framework" has no attribute "ListField"; maybe "EmptyListField" or "EventListField"?  [attr-defined]
 src/sentry/api/endpoints/organization_member/index.py:195: error: Incompatible types in assignment (expression has type "str", variable has type "List[str]")  [assignment]
@@ -726,7 +718,6 @@
 src/sentry/api/endpoints/organization_member/index.py:205: error: Need type annotation for "expand"  [var-annotated]
 src/sentry/api/endpoints/organization_member/index.py:259: error: Argument "user" to "for_organization_member_invite" has incompatible type "Union[User, AnonymousUser]"; expected "Optional[User]"  [arg-type]
 src/sentry/api/endpoints/organization_member/index.py:260: error: Argument "auth" to "for_organization_member_invite" has incompatible type "Union[Token, Any]"; expected "Optional[ApiToken]"  [arg-type]
-src/sentry/api/endpoints/organization_member/index.py:281: error: Incompatible type for "inviter_id" of "OrganizationMember" (got "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]", expected "Union[float, int, str, Combinable]")  [misc]
 src/sentry/api/endpoints/organization_member/requests/invite/details.py:126: error: Incompatible types in assignment (expression has type "ApproveInviteRequestSerializer", variable has type "OrganizationMemberSerializer")  [assignment]
 src/sentry/api/endpoints/organization_member/requests/invite/details.py:57: error: Argument 1 to "get_member_invite_query" of "OrganizationMemberManager" has incompatible type "Union[int, str]"; expected "int"  [arg-type]
 src/sentry/api/endpoints/organization_member/requests/invite/index.py:103: error: Argument 1 to "async_send_notification" has incompatible type "Type[InviteRequestNotification]"; expected "BaseNotification"  [arg-type]
@@ -743,12 +734,10 @@
 src/sentry/api/endpoints/organization_onboarding_continuation_email.py:45: error: Incompatible types in assignment (expression has type "Tuple[]", base class "OrganizationEndpoint" defined the type as "Tuple[Type[OrganizationPermission]]")  [assignment]
 src/sentry/api/endpoints/organization_onboarding_continuation_email.py:54: error: Argument 1 to "get_request_builder_args" has incompatible type "Union[User, AnonymousUser]"; expected "User"  [arg-type]
 src/sentry/api/endpoints/organization_onboarding_continuation_email.py:57: error: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "email"  [union-attr]
-src/sentry/api/endpoints/organization_onboarding_continuation_email.py:57: error: List item 0 has incompatible type "Union[EmailField[Union[str, int, Combinable], str], Any]"; expected "str"  [list-item]
 src/sentry/api/endpoints/organization_projects.py:51: error: Need type annotation for "collapse"  [var-annotated]
 src/sentry/api/endpoints/organization_projects.py:65: error: Item "Token" of "Union[Token, Any]" has no attribute "organization_id"  [union-attr]
 src/sentry/api/endpoints/organization_projects.py:66: error: Item "Token" of "Union[Token, Any]" has no attribute "organization_id"  [union-attr]
 src/sentry/api/endpoints/organization_projects.py:96: error: Incompatible types in assignment (expression has type "str", variable has type "List[str]")  [assignment]
-src/sentry/api/endpoints/organization_projects_experiment.py:96: error: Argument 1 to "fetch_slugifed_email_username" has incompatible type "Union[EmailField[Union[str, int, Combinable], str], Any]"; expected "str"  [arg-type]
 src/sentry/api/endpoints/organization_projects_experiment.py:96: error: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "email"  [union-attr]
 src/sentry/api/endpoints/organization_release_details.py:16: error: Module "sentry.api.serializers.rest_framework" has no attribute "ListField"; maybe "EmptyListField" or "EventListField"?  [attr-defined]
 src/sentry/api/endpoints/organization_release_details.py:323: error: Module has no attribute "get_release_sessions_time_bounds"  [attr-defined]
@@ -843,7 +832,6 @@
 src/sentry/api/endpoints/project_details.py:375: error: Incompatible types in assignment (expression has type "List[Type[RelaxedProjectPermission]]", base class "ProjectEndpoint" defined the type as "Tuple[Type[ProjectPermission]]")  [assignment]
 src/sentry/api/endpoints/project_details.py:410: error: Need type annotation for "expand"  [var-annotated]
 src/sentry/api/endpoints/project_details.py:475: error: Incompatible types in assignment (expression has type "Type[ProjectMemberSerializer]", variable has type "Type[ProjectAdminSerializer]")  [assignment]
-src/sentry/api/endpoints/project_details.py:665: error: Argument "user_id" to "update_settings" of "NotificationsManager" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/api/endpoints/project_dynamic_sampling.py:341: error: Need type annotation for "parent_project_breakdown" (hint: "parent_project_breakdown: List[<type>] = ...")  [var-annotated]
 src/sentry/api/endpoints/project_event_details.py:71: error: Incompatible types in assignment (expression has type "Optional[int]", variable has type "Optional[str]")  [assignment]
 src/sentry/api/endpoints/project_event_details.py:85: error: Argument 3 to "wrap_event_response" has incompatible type "Set[str]"; expected "List[str]"  [arg-type]
@@ -972,7 +960,6 @@
 src/sentry/api/endpoints/team_time_to_resolution.py:55: error: Unsupported operand types for + ("object" and "int")  [operator]
 src/sentry/api/endpoints/team_time_to_resolution.py:62: error: Unsupported left operand type for / ("object")  [operator]
 src/sentry/api/endpoints/user_authenticator_enroll.py:169: error: Module has no attribute "is_limited"  [attr-defined]
-src/sentry/api/endpoints/user_authenticator_enroll.py:182: error: Incompatible type for lookup 'id': (got "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]", expected "Union[str, int]")  [misc]
 src/sentry/api/endpoints/user_details.py:167: error: Incompatible types in assignment (expression has type "Type[SuperuserUserSerializer]", variable has type "Type[PrivilegedUserSerializer]")  [assignment]
 src/sentry/api/endpoints/user_details.py:169: error: Incompatible types in assignment (expression has type "Type[UserSerializer]", variable has type "Type[PrivilegedUserSerializer]")  [assignment]
 src/sentry/api/endpoints/user_details.py:20: error: Module "sentry.api.serializers.rest_framework" has no attribute "ListField"; maybe "EmptyListField" or "EventListField"?  [attr-defined]
@@ -1135,8 +1122,6 @@
 src/sentry/api/serializers/models/auth_provider.py:19: note:          def serialize(self, obj: Union[AuthProvider, RpcAuthProvider], attrs: Any, user: Any, organization: Union[Organization, RpcOrganization, None] = ...) -> Any
 src/sentry/api/serializers/models/auth_provider.py:19: note:      Subclass:
 src/sentry/api/serializers/models/auth_provider.py:19: note:      Superclass:
-src/sentry/api/serializers/models/auth_provider.py:37: error: Argument 1 to "get_url" of "Organization" has incompatible type "Union[SlugField[str, str], str]"; expected "str"  [arg-type]
-src/sentry/api/serializers/models/auth_provider.py:41: error: Argument "slug" to "organization_absolute_url" of "OrganizationAbsoluteUrlMixin" has incompatible type "Union[SlugField[str, str], str]"; expected "str"  [arg-type]
 src/sentry/api/serializers/models/authenticator.py:2: error: Module "sentry.auth.authenticators" does not explicitly export attribute "AuthenticatorInterface"  [attr-defined]
 src/sentry/api/serializers/models/authenticator.py:2: error: Module "sentry.auth.authenticators" does not explicitly export attribute "RecoveryCodeInterface"  [attr-defined]
 src/sentry/api/serializers/models/authenticator.py:2: error: Module "sentry.auth.authenticators" does not explicitly export attribute "SmsInterface"  [attr-defined]
@@ -1773,11 +1758,11 @@
 src/sentry/db/models/fields/node.py:111: error: Need type annotation for "rv" (hint: "rv: Dict[<type>, <type>] = ...")  [var-annotated]
 src/sentry/db/models/fields/node.py:156: error: Module has no attribute "set_subkeys"  [attr-defined]
 src/sentry/db/models/fields/node.py:182: error: Module has no attribute "delete"  [attr-defined]
-src/sentry/db/models/manager/base.py:167: error: Item "None" of "Optional[Field[Any, Any]]" has no attribute "name"  [union-attr]
+src/sentry/db/models/manager/base.py:167: error: Item "None" of "Optional[Any]" has no attribute "name"  [union-attr]
 src/sentry/db/models/manager/base.py:179: error: Argument "version" to "set" of "BaseCache" has incompatible type "str"; expected "Optional[int]"  [arg-type]
 src/sentry/db/models/manager/base.py:191: error: Argument "version" to "set" of "BaseCache" has incompatible type "str"; expected "Optional[int]"  [arg-type]
 src/sentry/db/models/manager/base.py:206: error: Argument "version" to "delete" of "BaseCache" has incompatible type "str"; expected "Optional[int]"  [arg-type]
-src/sentry/db/models/manager/base.py:217: error: Item "None" of "Optional[Field[Any, Any]]" has no attribute "name"  [union-attr]
+src/sentry/db/models/manager/base.py:217: error: Item "None" of "Optional[Any]" has no attribute "name"  [union-attr]
 src/sentry/db/models/manager/base.py:224: error: Argument "version" to "delete" of "BaseCache" has incompatible type "str"; expected "Optional[int]"  [arg-type]
 src/sentry/db/models/manager/base.py:228: error: Argument "version" to "delete" of "BaseCache" has incompatible type "str"; expected "Optional[int]"  [arg-type]
 src/sentry/db/models/manager/base.py:247: error: Item "ForeignObjectRel" of "Union[Field[Any, Any], ForeignObjectRel, GenericForeignKey]" has no attribute "attname"  [union-attr]
@@ -2198,7 +2183,7 @@
 src/sentry/integrations/base.py:356: note: "get_client" of "IntegrationInstallation" defined here
 src/sentry/integrations/base.py:356: note: "get_client" of "IntegrationInstallation" defined here
 src/sentry/integrations/base.py:356: note: "get_client" of "IntegrationInstallation" defined here
-src/sentry/integrations/base.py:427: error: Incompatible return value type (got "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]", expected "IntegrationMetadata")  [return-value]
+src/sentry/integrations/base.py:427: error: Incompatible return value type (got "Union[Dict[str, Any], Any]", expected "IntegrationMetadata")  [return-value]
 src/sentry/integrations/bitbucket/client.py:133: error: Item "Mapping[str, Any]" of "Union[BaseApiResponse, Mapping[str, Any], Response]" has no attribute "text"  [union-attr]
 src/sentry/integrations/bitbucket/client.py:145: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
 src/sentry/integrations/bitbucket/client.py:151: error: Need type annotation for "commits" (hint: "commits: List[<type>] = ...")  [var-annotated]
@@ -2225,7 +2210,6 @@
 src/sentry/integrations/bitbucket/integration.py:221: note:      Superclass:
 src/sentry/integrations/bitbucket/integration.py:78: error: Definition of "org_integration" in base class "IntegrationInstallation" is incompatible with definition in base class "IssueBasicMixin"  [misc]
 src/sentry/integrations/bitbucket/integration.py:84: error: Argument "integration" to "BitbucketApiClient" has incompatible type "Union[RpcIntegration, Integration]"; expected "RpcIntegration"  [arg-type]
-src/sentry/integrations/bitbucket/integration.py:96: error: Item "JSONField[Union[str, Combinable], str]" of "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" has no attribute "get"  [union-attr]
 src/sentry/integrations/bitbucket/issues.py:110: error: "BitbucketIssueBasicMixin" has no attribute "get_client"  [attr-defined]
 src/sentry/integrations/bitbucket/issues.py:120: error: "BitbucketIssueBasicMixin" has no attribute "raise_error"  [attr-defined]
 src/sentry/integrations/bitbucket/issues.py:130: error: "BitbucketIssueBasicMixin" has no attribute "get_client"  [attr-defined]
@@ -2287,7 +2271,6 @@
 src/sentry/integrations/bitbucket_server/integration.py:244: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
 src/sentry/integrations/bitbucket_server/repository.py:14: error: Incompatible types in assignment (expression has type "str", base class "IntegrationRepositoryProvider" defined the type as "None")  [assignment]
 src/sentry/integrations/bitbucket_server/repository.py:15: error: Incompatible types in assignment (expression has type "str", base class "IntegrationRepositoryProvider" defined the type as "None")  [assignment]
-src/sentry/integrations/bitbucket_server/repository.py:61: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/bitbucket_server/webhook.py:112: error: Argument 1 of "dispatch" is incompatible with supertype "View"; supertype defines the argument type as "HttpRequest"  [override]
 src/sentry/integrations/bitbucket_server/webhook.py:112: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
 src/sentry/integrations/bitbucket_server/webhook.py:112: note: This violates the Liskov substitution principle
@@ -2362,15 +2345,12 @@
 src/sentry/integrations/github/client.py:82: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
 src/sentry/integrations/github/integration.py:116: error: Argument "integration" to "GitHubAppsClient" has incompatible type "Union[RpcIntegration, Integration]"; expected "Integration"  [arg-type]
 src/sentry/integrations/github/integration.py:119: error: "Exception" has no attribute "json"  [attr-defined]
-src/sentry/integrations/github/integration.py:127: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/github/integration.py:136: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "organization_id"  [union-attr]
 src/sentry/integrations/github/integration.py:147: error: Signature of "get_repositories" incompatible with supertype "RepositoryMixin"  [override]
 src/sentry/integrations/github/integration.py:147: note:          def get_repositories(self, query: Optional[str] = ...) -> Sequence[Repository]
 src/sentry/integrations/github/integration.py:147: note:          def get_repositories(self, query: Optional[str] = ..., fetch_max_pages: bool = ...) -> Sequence[Mapping[str, Any]]
 src/sentry/integrations/github/integration.py:147: note:      Subclass:
 src/sentry/integrations/github/integration.py:147: note:      Superclass:
-src/sentry/integrations/github/integration.py:166: error: Argument 1 to "build_repository_query" has incompatible type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]"; expected "Mapping[str, Any]"  [arg-type]
-src/sentry/integrations/github/integration.py:166: error: Argument 2 to "build_repository_query" has incompatible type "Union[str, CharField[Union[str, int, Combinable], str]]"; expected "str"  [arg-type]
 src/sentry/integrations/github/integration.py:295: error: Argument "integration" to "GitHubAppsClient" has incompatible type "Type[GitHubIntegration]"; expected "Integration"  [arg-type]
 src/sentry/integrations/github/integration.py:331: error: Incompatible types in assignment (expression has type "Union[BaseApiResponse, Mapping[str, Any], Response]", variable has type "Mapping[str, Any]")  [assignment]
 src/sentry/integrations/github/integration.py:377: error: Signature of "dispatch" incompatible with supertype "BaseView"  [override]
@@ -2415,14 +2395,6 @@
 src/sentry/integrations/github_enterprise/client.py:10: error: Cannot determine type of "base_url"  [has-type]
 src/sentry/integrations/github_enterprise/client.py:6: error: Incompatible types in assignment (expression has type "None", base class "GitHubClientMixin" defined the type as "str")  [assignment]
 src/sentry/integrations/github_enterprise/integration.py:112: error: Definition of "org_integration" in base class "IntegrationInstallation" is incompatible with definition in base class "IssueBasicMixin"  [misc]
-src/sentry/integrations/github_enterprise/integration.py:116: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/github_enterprise/integration.py:120: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/github_enterprise/integration.py:121: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/github_enterprise/integration.py:122: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/github_enterprise/integration.py:136: error: Argument 1 to "build_repository_query" has incompatible type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]"; expected "Mapping[str, Any]"  [arg-type]
-src/sentry/integrations/github_enterprise/integration.py:136: error: Argument 2 to "build_repository_query" has incompatible type "Union[str, CharField[Union[str, int, Combinable], str]]"; expected "str"  [arg-type]
-src/sentry/integrations/github_enterprise/integration.py:151: error: Item "CharField[Union[str, int, Combinable], str]" of "Union[str, CharField[Union[str, int, Combinable], str]]" has no attribute "split"  [union-attr]
-src/sentry/integrations/github_enterprise/integration.py:153: error: Unsupported target for indexed assignment ("Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]")  [index]
 src/sentry/integrations/github_enterprise/integration.py:154: error: Item "RpcIntegration" of "Union[RpcIntegration, Integration]" has no attribute "update"  [union-attr]
 src/sentry/integrations/github_enterprise/integration.py:159: error: Argument 1 to "get" of "dict" has incompatible type "Optional[int]"; expected "int"  [arg-type]
 src/sentry/integrations/github_enterprise/integration.py:236: error: Signature of "dispatch" incompatible with supertype "BaseView"  [override]
@@ -2460,16 +2432,12 @@
 src/sentry/integrations/github_enterprise/webhook.py:187: note: This violates the Liskov substitution principle
 src/sentry/integrations/github_enterprise/webhook.py:92: error: "GitHubEnterpriseWebhookBase" has no attribute "_handlers"; maybe "get_handler" or "handle"?  [attr-defined]
 src/sentry/integrations/gitlab/client.py:128: error: Item "None" of "Optional[str]" has no attribute "rstrip"  [union-attr]
-src/sentry/integrations/gitlab/client.py:247: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/gitlab/client.py:250: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/gitlab/client.py:254: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
 src/sentry/integrations/gitlab/client.py:278: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
 src/sentry/integrations/gitlab/client.py:318: error: Incompatible return value type (got "Union[BaseApiResponse, Mapping[str, Any], Response]", expected "Optional[str]")  [return-value]
 src/sentry/integrations/gitlab/client.py:339: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
 src/sentry/integrations/gitlab/client.py:352: error: Incompatible return value type (got "Union[BaseApiResponse, Mapping[str, Any], Response, List[<nothing>]]", expected "Sequence[Mapping[str, Any]]")  [return-value]
 src/sentry/integrations/gitlab/client.py:94: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
-src/sentry/integrations/gitlab/integration.py:104: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/gitlab/integration.py:122: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/gitlab/integration.py:267: error: Signature of "dispatch" incompatible with supertype "BaseView"  [override]
 src/sentry/integrations/gitlab/integration.py:267: error: Signature of "dispatch" incompatible with supertype "View"  [override]
 src/sentry/integrations/gitlab/integration.py:267: note:          def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase
@@ -2506,7 +2474,6 @@
 src/sentry/integrations/gitlab/issues.py:67: error: "GitlabIssueBasic" has no attribute "get_client"  [attr-defined]
 src/sentry/integrations/gitlab/issues.py:81: error: "GitlabIssueBasic" has no attribute "message_from_error"  [attr-defined]
 src/sentry/integrations/gitlab/issues.py:99: error: "GitlabIssueBasic" has no attribute "get_client"  [attr-defined]
-src/sentry/integrations/gitlab/repository.py:14: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/gitlab/repository.py:6: error: Incompatible types in assignment (expression has type "str", base class "IntegrationRepositoryProvider" defined the type as "None")  [assignment]
 src/sentry/integrations/gitlab/repository.py:7: error: Incompatible types in assignment (expression has type "str", base class "IntegrationRepositoryProvider" defined the type as "None")  [assignment]
 src/sentry/integrations/gitlab/webhooks.py:242: error: Argument 1 of "dispatch" is incompatible with supertype "APIView"; supertype defines the argument type as "HttpRequest"  [override]
@@ -2548,9 +2515,7 @@
 src/sentry/integrations/jira/integration.py:268: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
 src/sentry/integrations/jira/integration.py:273: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "config"  [union-attr]
 src/sentry/integrations/jira/integration.py:275: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
-src/sentry/integrations/jira/integration.py:305: error: Item "JSONField[Union[str, Combinable], str]" of "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" has no attribute "update"  [union-attr]
 src/sentry/integrations/jira/integration.py:307: error: Item "RpcIntegration" of "Union[RpcIntegration, Integration]" has no attribute "save"  [union-attr]
-src/sentry/integrations/jira/integration.py:320: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/jira/integration.py:329: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "config"  [union-attr]
 src/sentry/integrations/jira/integration.py:366: error: Argument "integration" to "JiraCloudClient" has incompatible type "Union[RpcIntegration, Integration]"; expected "RpcIntegration"  [arg-type]
 src/sentry/integrations/jira/integration.py:367: error: Argument "org_integration_id" to "JiraCloudClient" has incompatible type "Union[int, Any]"; expected "Optional[str]"  [arg-type]
@@ -2637,9 +2602,7 @@
 src/sentry/integrations/jira_server/integration.py:419: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
 src/sentry/integrations/jira_server/integration.py:424: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "config"  [union-attr]
 src/sentry/integrations/jira_server/integration.py:426: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
-src/sentry/integrations/jira_server/integration.py:456: error: Item "JSONField[Union[str, Combinable], str]" of "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" has no attribute "update"  [union-attr]
 src/sentry/integrations/jira_server/integration.py:458: error: Item "RpcIntegration" of "Union[RpcIntegration, Integration]" has no attribute "save"  [union-attr]
-src/sentry/integrations/jira_server/integration.py:489: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/jira_server/integration.py:498: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "config"  [union-attr]
 src/sentry/integrations/jira_server/search.py:67: error: Need type annotation for "user_tuples"  [var-annotated]
 src/sentry/integrations/jira_server/webhooks.py:51: error: Argument 1 of "dispatch" is incompatible with supertype "APIView"; supertype defines the argument type as "HttpRequest"  [override]
@@ -2692,7 +2655,6 @@
 src/sentry/integrations/msteams/card_builder/issues.py:66: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 src/sentry/integrations/msteams/card_builder/notifications.py:134: error: Argument 1 to "build_attachment_title" has incompatible type "Optional[Any]"; expected "Union[Group, GroupEvent]"  [arg-type]
 src/sentry/integrations/msteams/card_builder/notifications.py:136: error: Argument 1 to "get_title_link" has incompatible type "Optional[Any]"; expected "Group"  [arg-type]
-src/sentry/integrations/msteams/client.py:122: error: Item "JSONField[Union[str, Combinable], str]" of "Union[JSONField[Union[str, Combinable], str], Dict[str, Any]]" has no attribute "update"  [union-attr]
 src/sentry/integrations/msteams/client.py:124: error: Incompatible types in assignment (expression has type "Optional[RpcIntegration]", variable has type "Union[Integration, RpcIntegration]")  [assignment]
 src/sentry/integrations/msteams/client.py:32: error: "MsTeamsClientMixin" has no attribute "get"  [attr-defined]
 src/sentry/integrations/msteams/client.py:35: error: "MsTeamsClientMixin" has no attribute "get"  [attr-defined]
@@ -2701,7 +2663,6 @@
 src/sentry/integrations/msteams/client.py:47: error: "MsTeamsClientMixin" has no attribute "post"  [attr-defined]
 src/sentry/integrations/msteams/client.py:51: error: "MsTeamsClientMixin" has no attribute "post"  [attr-defined]
 src/sentry/integrations/msteams/client.py:54: error: "MsTeamsClientMixin" has no attribute "put"  [attr-defined]
-src/sentry/integrations/msteams/client.py:96: error: Argument "integration_id" to "infer_org_integration" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "int"  [arg-type]
 src/sentry/integrations/msteams/integration.py:132: error: Value of type "Optional[Any]" is not indexable  [index]
 src/sentry/integrations/msteams/integration.py:137: error: Signature of "dispatch" incompatible with supertype "BaseView"  [override]
 src/sentry/integrations/msteams/integration.py:137: error: Signature of "dispatch" incompatible with supertype "View"  [override]
@@ -2766,7 +2727,7 @@
 src/sentry/integrations/pagerduty/client.py:36: note:     def _request(self, method: str, path: str, headers: Optional[Mapping[str, str]] = ..., data: Optional[Mapping[str, str]] = ..., params: Optional[Mapping[str, str]] = ..., auth: Optional[str] = ..., json: bool = ..., allow_text: Optional[bool] = ..., allow_redirects: Optional[bool] = ..., timeout: Optional[int] = ..., ignore_webhook_errors: bool = ..., prepared_request: Optional[PreparedRequest] = ..., raw_response: bool = ...) -> Union[BaseApiResponse, Mapping[str, Any], Response]
 src/sentry/integrations/pagerduty/client.py:36: note: Possible overload variants:
 src/sentry/integrations/pagerduty/client.py:49: error: Item "None" of "Optional[Group]" has no attribute "qualified_short_id"  [union-attr]
-src/sentry/integrations/pagerduty/client.py:54: error: Item "FlexibleForeignKey[Union[Project, Combinable], Project]" of "Union[FlexibleForeignKey[Union[Project, Combinable], Project], Any]" has no attribute "slug"  [union-attr]
+src/sentry/integrations/pagerduty/client.py:54: error: Item "ForwardManyToOneDescriptor" of "Union[Any, ForwardManyToOneDescriptor]" has no attribute "slug"  [union-attr]
 src/sentry/integrations/pagerduty/client.py:54: error: Item "None" of "Optional[Group]" has no attribute "project"  [union-attr]
 src/sentry/integrations/pagerduty/client.py:59: error: Item "None" of "Optional[Group]" has no attribute "get_absolute_url"  [union-attr]
 src/sentry/integrations/pagerduty/integration.py:102: error: Item "None" of "Optional[RpcOrganizationIntegration]" has no attribute "id"  [union-attr]
@@ -2814,8 +2775,6 @@
 src/sentry/integrations/slack/integration.py:140: error: Return type "Sequence[View]" of "get_pipeline_views" incompatible with return type "Sequence[PipelineView]" in supertype "IntegrationProvider"  [override]
 src/sentry/integrations/slack/integration.py:140: error: Return type "Sequence[View]" of "get_pipeline_views" incompatible with return type "Sequence[PipelineView]" in supertype "PipelineProvider"  [override]
 src/sentry/integrations/slack/integration.py:165: error: Value of type "Union[BaseApiResponse, Mapping[str, Any], Response]" is not indexable  [index]
-src/sentry/integrations/slack/integration.py:86: error: Unsupported right operand type for in ("Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]")  [operator]
-src/sentry/integrations/slack/integration.py:88: error: Item "JSONField[Union[str, Combinable], str]" of "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" has no attribute "get"  [union-attr]
 src/sentry/integrations/slack/message_builder/issues.py:315: error: Argument 1 to "build_fallback_text" of "SlackMessageBuilder" has incompatible type "object"; expected "Union[Group, Event, GroupEvent]"  [arg-type]
 src/sentry/integrations/slack/message_builder/issues.py:319: error: Argument 1 to "build_attachment_title" has incompatible type "object"; expected "Union[Group, GroupEvent]"  [arg-type]
 src/sentry/integrations/slack/message_builder/issues.py:42: error: Item "RpcUser" of "Union[Team, RpcUser]" has no attribute "slug"  [union-attr]
@@ -2833,8 +2792,6 @@
 src/sentry/integrations/slack/unfurl/discover.py:163: error: Argument 1 to "to_list" has incompatible type "Optional[Any]"; expected "Union[List[str], str]"  [arg-type]
 src/sentry/integrations/slack/unfurl/discover.py:168: error: Argument 1 to "to_list" has incompatible type "Optional[Any]"; expected "Union[List[str], str]"  [arg-type]
 src/sentry/integrations/slack/unfurl/issues.py:77: error: Argument "fn" to "Handler" has incompatible type "Callable[[HttpRequest, RpcIntegration, List[UnfurlableUrl], Optional[User]], Mapping[Any, Any]]"; expected "Callable[[HttpRequest, Integration, List[UnfurlableUrl], Optional[User]], Mapping[Any, Any]]"  [arg-type]
-src/sentry/integrations/slack/utils/channel.py:131: error: Argument "integration_id" to "SlackClient" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "Optional[int]"  [arg-type]
-src/sentry/integrations/slack/utils/channel.py:212: error: Argument "integration_id" to "SlackClient" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "Optional[int]"  [arg-type]
 src/sentry/integrations/slack/utils/channel.py:218: error: Argument 2 to "check_for_channel" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/integrations/slack/utils/channel.py:277: error: Missing return statement  [return]
 src/sentry/integrations/slack/utils/channel.py:291: error: Unsupported right operand type for in ("Union[BaseApiResponse, Mapping[str, Any], Response]")  [operator]
@@ -2848,7 +2805,7 @@
 src/sentry/integrations/slack/views/link_identity.py:64: error: Argument "user" to "link_identity" of "IdentityManager" has incompatible type "Union[User, AnonymousUser]"; expected "Union[User, RpcUser]"  [arg-type]
 src/sentry/integrations/slack/views/link_identity.py:68: error: Argument 1 to "has_any_provider_settings" of "NotificationsManager" has incompatible type "Union[User, AnonymousUser]"; expected "Union[RpcActor, Team, User]"  [arg-type]
 src/sentry/integrations/slack/views/link_identity.py:70: error: Argument 2 to "IntegrationNudgeNotification" has incompatible type "Union[User, AnonymousUser]"; expected "User"  [arg-type]
-src/sentry/integrations/slack/views/link_team.py:104: error: Argument 1 to "list" has incompatible type "dict_values[Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any], Union[Team, Tuple[Team, Sequence[Project]]]]"; expected "Iterable[Team]"  [arg-type]
+src/sentry/integrations/slack/views/link_team.py:104: error: Argument 1 to "list" has incompatible type "dict_values[Any, Union[Team, Tuple[Team, Sequence[Project]]]]"; expected "Iterable[Team]"  [arg-type]
 src/sentry/integrations/slack/views/link_team.py:107: error: Incompatible return value type (got "HttpResponseBase", expected "HttpResponse")  [return-value]
 src/sentry/integrations/slack/views/link_team.py:139: error: Item "Tuple[object, ...]" of "Union[Team, Tuple[Team, Sequence[Project]]]" has no attribute "actor_id"  [union-attr]
 src/sentry/integrations/slack/views/link_team.py:140: error: Item "Tuple[object, ...]" of "Union[Team, Tuple[Team, Sequence[Project]]]" has no attribute "organization"  [union-attr]
@@ -2939,11 +2896,8 @@
 src/sentry/integrations/vsts/integration.py:132: error: Return type "Sequence[Mapping[str, str]]" of "get_repositories" incompatible with return type "Sequence[Repository]" in supertype "RepositoryMixin"  [override]
 src/sentry/integrations/vsts/integration.py:141: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice]"  [index]
 src/sentry/integrations/vsts/integration.py:142: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice]"  [index]
-src/sentry/integrations/vsts/integration.py:184: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/vsts/integration.py:188: error: Argument 2 to "get_base_url" of "VstsIntegrationProvider" has incompatible type "Union[str, CharField[Union[str, int, Combinable], str]]"; expected "int"  [arg-type]
-src/sentry/integrations/vsts/integration.py:190: error: Unsupported target for indexed assignment ("Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]")  [index]
+src/sentry/integrations/vsts/integration.py:188: error: Argument 2 to "get_base_url" of "VstsIntegrationProvider" has incompatible type "str"; expected "int"  [arg-type]
 src/sentry/integrations/vsts/integration.py:191: error: Item "RpcIntegration" of "Union[RpcIntegration, Integration]" has no attribute "save"  [union-attr]
-src/sentry/integrations/vsts/integration.py:194: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/vsts/integration.py:202: error: No overload variant of "__getitem__" of "bytes" matches argument type "str"  [call-overload]
 src/sentry/integrations/vsts/integration.py:202: note:     def __getitem__(self, SupportsIndex, /) -> int
 src/sentry/integrations/vsts/integration.py:202: note:     def __getitem__(self, slice, /) -> bytes
@@ -2953,8 +2907,6 @@
 src/sentry/integrations/vsts/integration.py:206: note:     def __getitem__(self, slice, /) -> bytes
 src/sentry/integrations/vsts/integration.py:206: note: Possible overload variants:
 src/sentry/integrations/vsts/integration.py:208: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice]"  [index]
-src/sentry/integrations/vsts/integration.py:336: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
-src/sentry/integrations/vsts/integration.py:341: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 src/sentry/integrations/vsts/integration.py:437: error: Item "None" of "Optional[RpcOrganization]" has no attribute "id"  [union-attr]
 src/sentry/integrations/vsts/integration.py:443: error: Item "None" of "Optional[RpcOrganization]" has no attribute "id"  [union-attr]
 src/sentry/integrations/vsts/integration.py:463: error: Argument "base_url" to "VstsSetupApiClient" has incompatible type "Optional[str]"; expected "str"  [arg-type]
@@ -3186,7 +3138,6 @@
 src/sentry/migrations/0418_add_actor_constraints.py:26: error: Incompatible types in assignment (expression has type "List[RunSQL]", base class "Migration" defined the type as "List[Operation]")  [assignment]
 src/sentry/migrations/0418_add_actor_constraints.py:26: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
 src/sentry/migrations/0418_add_actor_constraints.py:26: note: Consider using "Sequence" instead, which is covariant
-src/sentry/models/actor.py:123: error: Incompatible types in assignment (expression has type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]", variable has type "int")  [assignment]
 src/sentry/models/actor.py:163: error: Incompatible return value type (got "None", expected "ActorTuple")  [return-value]
 src/sentry/models/actor.py:28: error: Incompatible return value type (got "Type[BaseModel]", expected "Union[Type[Team], Type[RpcUser]]")  [return-value]
 src/sentry/models/actor.py:52: error: Missing return statement  [return]
@@ -3212,7 +3163,6 @@
 src/sentry/models/group.py:742: error: "Callable[[Group], Any]" has no attribute "short_description"  [attr-defined]
 src/sentry/models/group.py:75: error: Incompatible return value type (got "None", expected "ShortId")  [return-value]
 src/sentry/models/group.py:762: error: Module has no attribute "get_groups_user_counts"  [attr-defined]
-src/sentry/models/groupassignee.py:105: error: Argument 2 to "sync_group_assignee_outbound" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "Optional[int]"  [arg-type]
 src/sentry/models/grouphistory.py:245: error: Argument 1 to "get" of "dict" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/models/groupowner.py:227: error: Incompatible types (expression has type "str", TypedDict item "type" has type "GroupOwnerType")  [typeddict-item]
 src/sentry/models/groupowner.py:233: error: Incompatible return value type (got "defaultdict[Any, List[OwnersSerialized]]", expected "List[OwnersSerialized]")  [return-value]
@@ -3227,7 +3177,6 @@
 src/sentry/models/integrations/organization_integrity_backfill_mixin.py:26: error: "save" undefined in superclass  [misc]
 src/sentry/models/integrations/pagerduty_service.py:26: error: Incompatible types in assignment (expression has type "DateTimeField[Union[str, datetime, date, Combinable], datetime]", base class "DefaultFieldsModel" defined the type as "DateTimeField[Union[str, datetime, date, Combinable, None], Optional[datetime]]")  [assignment]
 src/sentry/models/integrations/sentry_app.py:204: error: Item "None" of "Optional[ApiApplication]" has no attribute "client_secret"  [union-attr]
-src/sentry/models/integrations/sentry_app.py:206: error: Item "TextField[Union[str, Combinable], str]" of "Union[TextField[Union[str, Combinable], str], Any]" has no attribute "encode"  [union-attr]
 src/sentry/models/integrations/sentry_app_installation.py:163: error: "Options[SentryAppInstallation]" has no attribute "concrete_fields"; maybe "concrete_model"?  [attr-defined]
 src/sentry/models/integrations/sentry_app_installation.py:163: error: "Options[SentryAppInstallation]" has no attribute "many_to_many"  [attr-defined]
 src/sentry/models/integrations/sentry_app_installation_token.py:31: error: Incompatible types in assignment (expression has type "Optional[int]", variable has type "int")  [assignment]
@@ -3369,7 +3318,6 @@
 src/sentry/new_migrations/monkey/__init__.py:79: error: Cannot assign to a type  [misc]
 src/sentry/newsletter/dummy.py:69: error: Need type annotation for "_subscriptions"  [var-annotated]
 src/sentry/nodestore/bigtable/backend.py:64: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Iterator[Tuple[str, bytes]]"; expected "Iterable[Tuple[Any, None]]"  [arg-type]
-src/sentry/notifications/additional_attachment_manager.py:30: error: Argument 1 to "validate_provider" has incompatible type "Union[CharField[Union[str, int, Combinable], str], str]"; expected "str"  [arg-type]
 src/sentry/notifications/additional_attachment_manager.py:30: error: Argument 2 to "validate_provider" has incompatible type "List[ExternalProviders]"; expected "Optional[Set[ExternalProviders]]"  [arg-type]
 src/sentry/notifications/helpers.py:600: error: Argument 1 to "get_provider_name" has incompatible type "ExternalProviders"; expected "int"  [arg-type]
 src/sentry/notifications/manager.py:421: error: "NotificationSetting" object is not iterable  [misc]
@@ -3383,7 +3331,6 @@
 src/sentry/notifications/manager.py:436: error: Cannot determine type of "value"  [has-type]
 src/sentry/notifications/manager.py:437: error: Cannot determine type of "scope_type"  [has-type]
 src/sentry/notifications/manager.py:438: error: Cannot determine type of "scope_identifier"  [has-type]
-src/sentry/notifications/manager.py:534: error: Argument "user_id" to "update_settings" of "NotificationsManager" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "Optional[int]"  [arg-type]
 src/sentry/notifications/notifications/activity/base.py:161: error: Argument "provider" to "format_url" of "BaseNotification" has incompatible type "Optional[ExternalProviders]"; expected "ExternalProviders"  [arg-type]
 src/sentry/notifications/notifications/activity/base.py:176: error: Argument 1 to "avatar_as_html" has incompatible type "Optional[RpcUser]"; expected "Union[User, RpcUser]"  [arg-type]
 src/sentry/notifications/notifications/activity/new_processing_issues.py:60: error: Argument "text" to "format_url" of "BaseNotification" has incompatible type "Optional[str]"; expected "str"  [arg-type]
@@ -3530,7 +3477,6 @@
 src/sentry/queue/command.py:9: error: "Type[BaseCommand]" has no attribute "option_list"  [attr-defined]
 src/sentry/quotas/redis.py:212: error: Need type annotation for "keys" (hint: "keys: List[<type>] = ...")  [var-annotated]
 src/sentry/quotas/redis.py:213: error: Need type annotation for "args" (hint: "args: List[<type>] = ...")  [var-annotated]
-src/sentry/ratelimits/utils.py:93: error: Incompatible types in assignment (expression has type "Union[int, None, BoundedBigAutoField[Union[Combinable, int, str], int]]", variable has type "Optional[int]")  [assignment]
 src/sentry/receivers/outbox/__init__.py:69: error: "Type[T]" has no attribute "_meta"  [attr-defined]
 src/sentry/receivers/outbox/control.py:106: error: Item "Mapping[str, Any]" of "Union[BaseApiResponse, Mapping[str, Any], Response]" has no attribute "status_code"  [union-attr]
 src/sentry/receivers/releases.py:105: error: Incompatible types in assignment (expression has type "Tuple[]", variable has type "List[Any]")  [assignment]
@@ -3724,7 +3670,6 @@
 src/sentry/scim/endpoints/members.py:147: note:      Subclass:
 src/sentry/scim/endpoints/members.py:147: note:      Superclass:
 src/sentry/scim/endpoints/members.py:147: note:      Superclass:
-src/sentry/scim/endpoints/members.py:519: error: Incompatible type for "inviter_id" of "OrganizationMember" (got "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]", expected "Union[float, int, str, Combinable]")  [misc]
 src/sentry/scim/endpoints/members.py:63: error: Argument 1 to "extend_schema_field" has incompatible type "object"; expected "Union[Union[Serializer[Any], Type[Serializer[Any]]], Union[Field[Any, Any, Any, Any], Type[Field[Any, Any, Any, Any]]], OpenApiTypes, Dict[Any, Any]]"  [arg-type]
 src/sentry/scim/endpoints/teams.py:156: error: Argument 1 to "ListField" has incompatible type "CharField"; expected "bool"  [arg-type]
 src/sentry/scim/endpoints/teams.py:158: error: Argument 1 to "ListField" has incompatible type "IntegerField"; expected "bool"  [arg-type]
@@ -3817,7 +3762,7 @@
 src/sentry/search/events/builder/metrics.py:1272: note:     Got:
 src/sentry/search/events/builder/metrics.py:1272: note: Following member(s) of "str" have conflicts:
 src/sentry/search/events/builder/metrics.py:1273: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice]"  [index]
-src/sentry/search/events/builder/metrics.py:134: error: Argument "org_id" to "MetricsQuery" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [arg-type]
+src/sentry/search/events/builder/metrics.py:134: error: Argument "org_id" to "MetricsQuery" has incompatible type "Union[Any, BoundedBigAutoField[Union[Combinable, int, str, None], int]]"; expected "int"  [arg-type]
 src/sentry/search/events/builder/metrics.py:134: error: Item "None" of "Optional[Organization]" has no attribute "id"  [union-attr]
 src/sentry/search/events/builder/metrics.py:409: error: Argument 1 of "resolve_snql_function" is incompatible with supertype "QueryBuilder"; supertype defines the argument type as "SnQLFunction"  [override]
 src/sentry/search/events/builder/metrics.py:409: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
@@ -4057,10 +4002,6 @@
 src/sentry/sentry_metrics/indexer/postgres/postgres_v2.py:326: error: Unexpected attribute "use_case_id" for model "BaseIndexer"  [misc]
 src/sentry/services/hybrid_cloud/actor.py:122: error: Subclass of "RpcActor" and "Actor" cannot exist: would have incompatible method signatures  [unreachable]
 src/sentry/services/hybrid_cloud/actor.py:123: error: Statement is unreachable  [unreachable]
-src/sentry/services/hybrid_cloud/actor.py:68: error: Argument 1 to "append" of "list" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "int"  [arg-type]
-src/sentry/services/hybrid_cloud/actor.py:70: error: Incompatible types in assignment (expression has type "Union[SlugField[Union[str, int, Combinable], str], str]", target has type "str")  [assignment]
-src/sentry/services/hybrid_cloud/actor.py:70: error: Invalid index type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]" for "MutableMapping[int, str]"; expected type "int"  [index]
-src/sentry/services/hybrid_cloud/actor.py:71: error: Argument 1 to "append" of "list" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "int"  [arg-type]
 src/sentry/services/hybrid_cloud/auth/impl.py:146: error: Statement is unreachable  [unreachable]
 src/sentry/services/hybrid_cloud/auth/impl.py:156: error: Argument 1 to "authenticate" of "BaseAuthentication" has incompatible type "FakeAuthenticationRequest"; expected "Request"  [arg-type]
 src/sentry/services/hybrid_cloud/auth/impl.py:163: error: Argument 1 to "_load_auth_user" of "DatabaseBackedAuthService" has incompatible type "Optional[User]"; expected "User"  [arg-type]
@@ -4070,7 +4011,6 @@
 src/sentry/services/hybrid_cloud/integration/impl.py:394: error: Argument 1 to "send_card" of "MsTeamsClientMixin" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/services/hybrid_cloud/integration/impl.py:61: error: Argument "paginator_cls" to "do_hybrid_cloud_pagination" of "RpcPaginationArgs" has incompatible type "Type[OffsetPaginator]"; expected "Type[PaginatorLike]"  [arg-type]
 src/sentry/services/hybrid_cloud/integration/impl.py:87: error: Argument "paginator_cls" to "do_hybrid_cloud_pagination" of "RpcPaginationArgs" has incompatible type "Type[OffsetPaginator]"; expected "Type[PaginatorLike]"  [arg-type]
-src/sentry/services/hybrid_cloud/integration/service.py:247: error: Argument 1 has incompatible type "Union[str, CharField[Union[str, int, Combinable], str]]"; expected "str"  [arg-type]
 src/sentry/services/hybrid_cloud/log/impl.py:33: error: "AuditLogEntry" has no attribute "actor_user_id"; maybe "actor_key_id" or "actor_id"?  [attr-defined]
 src/sentry/services/hybrid_cloud/log/impl.py:72: error: Incompatible type for "payload" of "RegionOutbox" (got "Dict[str, Any]", expected "Union[str, Combinable, None]")  [misc]
 src/sentry/services/hybrid_cloud/log/impl.py:81: error: Incompatible type for "payload" of "RegionOutbox" (got "Dict[str, Any]", expected "Union[str, Combinable, None]")  [misc]
@@ -4444,7 +4384,6 @@
 src/sentry/tasks/check_auth.py:57: error: Incompatible types in assignment (expression has type "Optional[RpcOrganizationMember]", variable has type "RpcOrganizationMember")  [assignment]
 src/sentry/tasks/check_auth.py:61: error: Statement is unreachable  [unreachable]
 src/sentry/tasks/codeowners/update_code_owners_schema.py:40: error: Item "int" of "Union[Organization, int]" has no attribute "id"  [union-attr]
-src/sentry/tasks/codeowners/update_code_owners_schema.py:58: error: Incompatible return value type (got "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]", expected "Optional[int]")  [return-value]
 src/sentry/tasks/commit_context.py:281: error: "object" object is not iterable  [misc]
 src/sentry/tasks/commit_context.py:285: error: Cannot determine type of "code_mapping"  [has-type]
 src/sentry/tasks/commit_context.py:286: error: Cannot determine type of "commit_context"  [has-type]
@@ -4525,7 +4464,6 @@
 src/sentry/tasks/merge.py:149: error: Module has no attribute "models_with_environment_support"  [attr-defined]
 src/sentry/tasks/merge.py:14: error: Need type annotation for "EXTRA_MERGE_MODELS" (hint: "EXTRA_MERGE_MODELS: List[<type>] = ...")  [var-annotated]
 src/sentry/tasks/post_process.py:101: error: Item "None" of "Optional[Group]" has no attribute "platform"  [union-attr]
-src/sentry/tasks/post_process.py:104: error: Item "CharField[Union[str, int, Combinable, None], Optional[str]]" of "Union[CharField[Union[str, int, Combinable, None], Optional[str]], Any]" has no attribute "split"  [union-attr]
 src/sentry/tasks/post_process.py:1090: error: Argument "event" to "detect_sdk_crash" of "SDKCrashDetection" has incompatible type "Union[Event, GroupEvent]"; expected "Event"  [arg-type]
 src/sentry/tasks/post_process.py:120: error: Argument 1 to "should_write_event_stats" has incompatible type "Union[Event, GroupEvent]"; expected "Event"  [arg-type]
 src/sentry/tasks/post_process.py:124: error: Argument 1 to "format_event_platform" has incompatible type "Union[Event, GroupEvent]"; expected "Event"  [arg-type]
@@ -4541,16 +4479,15 @@
 src/sentry/tasks/post_process.py:328: error: Item "RpcUser" of "Union[RpcUser, Team]" has no attribute "user_id"  [union-attr]
 src/sentry/tasks/post_process.py:328: error: Item "Team" of "Union[RpcUser, Team]" has no attribute "user_id"  [union-attr]
 src/sentry/tasks/post_process.py:332: error: Item "RpcUser" of "Union[RpcUser, Team]" has no attribute "delete"  [union-attr]
-src/sentry/tasks/post_process.py:334: error: Argument 1 to "get" of "dict" has incompatible type "Tuple[Type[BaseModel], Any, str]"; expected "Tuple[Union[Type[RpcUser], Type[Team]], Union[int, BoundedBigAutoField[Union[Combinable, int, str, None], int]], Any]"  [arg-type]
+src/sentry/tasks/post_process.py:334: error: Argument 1 to "get" of "dict" has incompatible type "Tuple[Type[BaseModel], Any, str]"; expected "Tuple[Union[Type[RpcUser], Type[Team]], Union[int, Any], Any]"  [arg-type]
 src/sentry/tasks/post_process.py:334: error: Item "RpcUser" of "Union[RpcUser, Team]" has no attribute "context"  [union-attr]
 src/sentry/tasks/post_process.py:334: error: Item "Team" of "Union[RpcUser, Team]" has no attribute "context"  [union-attr]
 src/sentry/tasks/post_process.py:334: error: Unsupported right operand type for in ("Optional[List[Any]]")  [operator]
-src/sentry/tasks/post_process.py:336: error: Argument 1 to "get" of "dict" has incompatible type "Tuple[Type[BaseModel], Any, str]"; expected "Tuple[Union[Type[RpcUser], Type[Team]], Union[int, BoundedBigAutoField[Union[Combinable, int, str, None], int]], Any]"  [arg-type]
+src/sentry/tasks/post_process.py:336: error: Argument 1 to "get" of "dict" has incompatible type "Tuple[Type[BaseModel], Any, str]"; expected "Tuple[Union[Type[RpcUser], Type[Team]], Union[int, Any], Any]"  [arg-type]
 src/sentry/tasks/post_process.py:337: error: Item "RpcUser" of "Union[RpcUser, Team]" has no attribute "delete"  [union-attr]
 src/sentry/tasks/post_process.py:345: error: Incompatible types in assignment (expression has type "Union[Type[RpcUser], Type[Team]]", variable has type "str")  [assignment]
 src/sentry/tasks/post_process.py:360: error: Incompatible type for "context" of "GroupOwner" (got "Dict[Any, Any]", expected "Union[str, Combinable]")  [misc]
-src/sentry/tasks/post_process.py:360: error: Incompatible type for "team_id" of "GroupOwner" (got "Union[int, BoundedBigAutoField[Union[Combinable, int, str, None], int], None]", expected "Union[Combinable, int, str, None]")  [misc]
-src/sentry/tasks/post_process.py:360: error: Incompatible type for "user_id" of "GroupOwner" (got "Union[int, BoundedBigAutoField[Union[Combinable, int, str, None], int], None]", expected "Union[float, int, str, Combinable]")  [misc]
+src/sentry/tasks/post_process.py:360: error: Incompatible type for "user_id" of "GroupOwner" (got "Union[int, Any, None]", expected "Union[float, int, str, Combinable]")  [misc]
 src/sentry/tasks/post_process.py:410: error: Module has no attribute "get"  [attr-defined]
 src/sentry/tasks/post_process.py:500: error: Argument "project_id" to "fetch" of "IssueOccurrence" has incompatible type "Optional[int]"; expected "int"  [arg-type]
 src/sentry/tasks/post_process.py:513: error: Item "None" of "Optional[IssueOccurrence]" has no attribute "event_id"  [union-attr]
@@ -4561,7 +4498,7 @@
 src/sentry/tasks/post_process.py:614: error: Item "None" of "Optional[Group]" has no attribute "issue_type"  [union-attr]
 src/sentry/tasks/post_process.py:614: error: Item "None" of "Optional[Group]" has no attribute "organization"  [union-attr]
 src/sentry/tasks/post_process.py:650: error: Incompatible types in assignment (expression has type "EventDict", variable has type "NodeData")  [assignment]
-src/sentry/tasks/post_process.py:665: error: Incompatible types in assignment (expression has type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]", variable has type "Optional[int]")  [assignment]
+src/sentry/tasks/post_process.py:665: error: Incompatible types in assignment (expression has type "Union[Any, BoundedBigAutoField[Union[Combinable, int, str, None], int]]", variable has type "Optional[int]")  [assignment]
 src/sentry/tasks/post_process.py:665: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 src/sentry/tasks/post_process.py:669: error: Missing keys ("is_new", "is_regression", "is_new_group_environment") for TypedDict "GroupState"  [typeddict-item]
 src/sentry/tasks/post_process.py:712: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
@@ -4577,9 +4514,9 @@
 src/sentry/tasks/post_process.py:754: error: Argument 3 to "manage_issue_states" has incompatible type "Union[Event, GroupEvent]"; expected "Optional[GroupEvent]"  [arg-type]
 src/sentry/tasks/post_process.py:761: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 src/sentry/tasks/post_process.py:776: error: Item "None" of "Optional[Group]" has no attribute "status"  [union-attr]
-src/sentry/tasks/post_process.py:781: error: Dict entry 0 has incompatible type "str": "Union[BoundedPositiveIntegerField[Union[float, int, str, Combinable], int], Any]"; expected "str": "Union[str, int, float, None]"  [dict-item]
+src/sentry/tasks/post_process.py:781: error: Dict entry 0 has incompatible type "str": "Union[Any, BoundedPositiveIntegerField[Union[float, int, str, Combinable], int]]"; expected "str": "Union[str, int, float, None]"  [dict-item]
 src/sentry/tasks/post_process.py:781: error: Item "None" of "Optional[Group]" has no attribute "status"  [union-attr]
-src/sentry/tasks/post_process.py:782: error: Dict entry 1 has incompatible type "str": "Union[BoundedIntegerField[Union[float, int, str, Combinable, None], Optional[int]], Any]"; expected "str": "Union[str, int, float, None]"  [dict-item]
+src/sentry/tasks/post_process.py:782: error: Dict entry 1 has incompatible type "str": "Union[Any, BoundedIntegerField[Union[float, int, str, Combinable, None], Optional[int]]]"; expected "str": "Union[str, int, float, None]"  [dict-item]
 src/sentry/tasks/post_process.py:782: error: Item "None" of "Optional[Group]" has no attribute "substatus"  [union-attr]
 src/sentry/tasks/post_process.py:799: error: Item "None" of "Optional[Group]" has no attribute "organization"  [union-attr]
 src/sentry/tasks/post_process.py:800: error: Argument 1 to "manage_issue_states" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
@@ -4800,8 +4737,6 @@
 src/sentry/types/integrations.py:44: error: Argument 1 to "get" of "dict" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/types/integrations.py:48: error: Generator has incompatible item type "Optional[str]"; expected "str"  [misc]
 src/sentry/utils/audit.py:193: error: Incompatible type for "organization_id" of "AuditLogEntry" (got "Optional[int]", expected "Union[float, int, str, Combinable]")  [misc]
-src/sentry/utils/audit.py:59: error: Incompatible types in assignment (expression has type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]", variable has type "Optional[int]")  [assignment]
-src/sentry/utils/audit.py:61: error: Incompatible type for "actor_id" of "AuditLogEntry" (got "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int, None]", expected "Union[Combinable, int, str, None]")  [misc]
 src/sentry/utils/audit.py:61: error: Incompatible type for "organization_id" of "AuditLogEntry" (got "Optional[int]", expected "Union[float, int, str, Combinable]")  [misc]
 src/sentry/utils/auth.py:254: error: Incompatible return value type (got "List[RpcUser]", expected "Sequence[User]")  [return-value]
 src/sentry/utils/auth.py:320: error: "User" has no attribute "backend"  [attr-defined]
@@ -5048,7 +4983,6 @@
 src/sentry/utils/sdk.py:464: error: Argument 4 to "init" has incompatible type "**Dict[str, object]"; expected "str"  [arg-type]
 src/sentry/utils/sdk.py:560: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
 src/sentry/utils/sdk.py:591: error: Dict entry 0 has incompatible type "str": "Optional[str]"; expected "str": "str"  [dict-item]
-src/sentry/utils/sdk.py:632: error: Argument 2 to "check_tag_for_scope_bleed" has incompatible type "Union[SlugField[str, str], str]"; expected "Union[str, int]"  [arg-type]
 src/sentry/utils/sdk.py:638: error: Statement is unreachable  [unreachable]
 src/sentry/utils/sentry_apps/webhooks.py:107: error: Argument 2 to "ClientError" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/utils/services.py:290: error: Argument 1 to "Context" has incompatible type "Optional[HttpRequest]"; expected "Request"  [arg-type]
@@ -5150,7 +5084,6 @@
 src/sentry/web/frontend/auth_close.py:13: note:      Subclass:
 src/sentry/web/frontend/auth_close.py:13: note:      Superclass:
 src/sentry/web/frontend/auth_login.py:224: error: Module has no attribute "is_limited"  [attr-defined]
-src/sentry/web/frontend/auth_login.py:250: error: Argument "user_id" to "get_organization_by_slug" of "OrganizationService" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/web/frontend/auth_login.py:306: error: Argument 1 of "handle" is incompatible with supertype "BaseView"; supertype defines the argument type as "HttpRequest"  [override]
 src/sentry/web/frontend/auth_login.py:306: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
 src/sentry/web/frontend/auth_login.py:306: note: This violates the Liskov substitution principle
@@ -5180,7 +5113,6 @@
 src/sentry/web/frontend/auth_provider_login.py:12: note:      Subclass:
 src/sentry/web/frontend/auth_provider_login.py:12: note:      Superclass:
 src/sentry/web/frontend/auth_provider_login.py:19: error: Incompatible return value type (got "HttpResponseBase", expected "HttpResponse")  [return-value]
-src/sentry/web/frontend/base.py:155: error: Argument "user_id" to "get_organization_by_slug" of "OrganizationService" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/web/frontend/base.py:161: error: "HttpRequest" has no attribute "subdomain"  [attr-defined]
 src/sentry/web/frontend/base.py:163: error: "HttpRequest" has no attribute "subdomain"  [attr-defined]
 src/sentry/web/frontend/base.py:171: error: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "has_2fa"  [union-attr]
@@ -5204,9 +5136,7 @@
 src/sentry/web/frontend/base.py:475: error: "HttpRequest" has no attribute "subdomain"  [attr-defined]
 src/sentry/web/frontend/base.py:511: error: Argument 2 to "make_login_link_with_redirect" has incompatible type "Optional[str]"; expected "str"  [arg-type]
 src/sentry/web/frontend/base.py:518: error: "HttpRequest" has no attribute "subdomain"  [attr-defined]
-src/sentry/web/frontend/base.py:518: error: Argument "user_id" to "get_organization_by_slug" of "OrganizationService" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/web/frontend/base.py:540: error: "HttpRequest" has no attribute "access"; maybe "accepts"?  [attr-defined]
-src/sentry/web/frontend/base.py:542: error: Argument 2 to "has_completed_sso" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], int]"; expected "int"  [arg-type]
 src/sentry/web/frontend/base.py:544: error: "HttpRequest" has no attribute "access"; maybe "accepts"?  [attr-defined]
 src/sentry/web/frontend/base.py:611: error: Statement is unreachable  [unreachable]
 src/sentry/web/frontend/base.py:619: error: "HttpRequest" has no attribute "access"; maybe "accepts"?  [attr-defined]
@@ -5378,7 +5308,6 @@
 src/sentry/web/frontend/reactivate_account.py:17: note:      Superclass:
 src/sentry/web/frontend/reactivate_account.py:26: error: Need type annotation for "context" (hint: "context: Dict[<type>, <type>] = ...")  [var-annotated]
 src/sentry/web/frontend/reactivate_account.py:27: error: Incompatible return value type (got "HttpResponseBase", expected "HttpResponse")  [return-value]
-src/sentry/web/frontend/restore_organization.py:37: error: Argument "user_id" to "get_organization_by_slug" of "OrganizationService" has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "Optional[int]"  [arg-type]
 src/sentry/web/frontend/setup_wizard.py:33: error: Statement is unreachable  [unreachable]
 src/sentry/web/frontend/setup_wizard.py:56: error: Incompatible return value type (got "HttpResponseBase", expected "HttpResponse")  [return-value]
 src/sentry/web/frontend/setup_wizard.py:78: error: "str" has no attribute "project_id"  [attr-defined]
@@ -6354,9 +6283,9 @@
 tests/sentry/integrations/msteams/test_message_builder.py:234: error: Unsupported right operand type for in ("Union[str, bool, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]], Any]")  [operator]
 tests/sentry/integrations/msteams/test_message_builder.py:242: error: Invalid index type "str" for "Union[str, Mapping[str, Union[str, bool]], Mapping[str, Union[str, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]]]], Mapping[str, Any]]"; expected type "Union[SupportsIndex, slice]"  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:246: error: Item "None" of "Optional[Group]" has no attribute "data"  [union-attr]
-tests/sentry/integrations/msteams/test_message_builder.py:246: error: Value of type "Union[GzippedDictField[Union[str, Combinable, None], Optional[str]], Any]" is not indexable  [index]
+tests/sentry/integrations/msteams/test_message_builder.py:246: error: Value of type "Union[Any, GzippedDictField[Union[str, Combinable, None], Optional[str]]]" is not indexable  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:247: error: Item "None" of "Optional[Group]" has no attribute "data"  [union-attr]
-tests/sentry/integrations/msteams/test_message_builder.py:247: error: Unsupported target for indexed assignment ("Union[GzippedDictField[Union[str, Combinable, None], Optional[str]], Any]")  [index]
+tests/sentry/integrations/msteams/test_message_builder.py:247: error: Unsupported target for indexed assignment ("Union[Any, GzippedDictField[Union[str, Combinable, None], Optional[str]]]")  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:250: error: Argument "group" to "MSTeamsIssueMessageBuilder" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
 tests/sentry/integrations/msteams/test_message_builder.py:257: error: Invalid index type "str" for "Union[str, Mapping[str, Union[str, bool]], Mapping[str, Union[str, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]]]], Mapping[str, Any]]"; expected type "Union[SupportsIndex, slice]"  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:257: error: Unsupported right operand type for in ("Union[str, bool, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]], Any]")  [operator]
@@ -6416,9 +6345,9 @@
 tests/sentry/integrations/msteams/test_message_builder.py:323: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[SupportsIndex, slice]"  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:323: error: Value of type "Union[Any, str, bool]" is not indexable  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:332: error: Item "None" of "Optional[Group]" has no attribute "data"  [union-attr]
-tests/sentry/integrations/msteams/test_message_builder.py:332: error: Value of type "Union[GzippedDictField[Union[str, Combinable, None], Optional[str]], Any]" is not indexable  [index]
+tests/sentry/integrations/msteams/test_message_builder.py:332: error: Value of type "Union[Any, GzippedDictField[Union[str, Combinable, None], Optional[str]]]" is not indexable  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:333: error: Item "None" of "Optional[Group]" has no attribute "data"  [union-attr]
-tests/sentry/integrations/msteams/test_message_builder.py:333: error: Unsupported target for indexed assignment ("Union[GzippedDictField[Union[str, Combinable, None], Optional[str]], Any]")  [index]
+tests/sentry/integrations/msteams/test_message_builder.py:333: error: Unsupported target for indexed assignment ("Union[Any, GzippedDictField[Union[str, Combinable, None], Optional[str]]]")  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:336: error: Argument "group" to "MSTeamsIssueMessageBuilder" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
 tests/sentry/integrations/msteams/test_message_builder.py:343: error: Invalid index type "str" for "Union[str, Mapping[str, Union[str, bool]], Mapping[str, Union[str, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]]]], Mapping[str, Any]]"; expected type "Union[SupportsIndex, slice]"  [index]
 tests/sentry/integrations/msteams/test_message_builder.py:343: error: Unsupported right operand type for in ("Union[str, bool, Sequence[Mapping[str, Union[str, Sequence[Union[str, Mapping[str, Union[str, bool]], Mapping[str, str]]]]]], Any]")  [operator]
@@ -6729,7 +6658,6 @@
 tests/sentry/integrations/utils/test_codecov.py:106: error: "ExceptionInfo[Exception]" has no attribute "status"  [attr-defined]
 tests/sentry/integrations/vercel/test_webhook.py:72: error: Argument 4 to "post" of "APIClient" has incompatible type "**Dict[str, str]"; expected "bool"  [arg-type]
 tests/sentry/integrations/vsts/test_integration.py:353: error: Dict entry 1 has incompatible type "str": "str"; expected "str": "Dict[int, Dict[str, str]]"  [dict-item]
-tests/sentry/integrations/vsts/test_integration.py:410: error: Value of type "Union[Dict[str, Any], JSONField[Union[str, Combinable], str]]" is not indexable  [index]
 tests/sentry/integrations/vsts/test_provider.py:115: error: Incompatible types in assignment (expression has type "Dict[str, str]", variable has type "QueryDict")  [assignment]
 tests/sentry/integrations/vsts/test_provider.py:125: error: Argument 1 to "dispatch" of "AccountConfigView" has incompatible type "_MutableHttpRequest"; expected "Request"  [arg-type]
 tests/sentry/integrations/vsts/test_provider.py:133: error: Argument 2 to "get_accounts" of "AccountConfigView" has incompatible type "str"; expected "int"  [arg-type]
@@ -6751,7 +6679,7 @@
 tests/sentry/issues/test_escalating.py:233: error: Argument 1 to "archive_until_escalating" of "DailyGroupCountsEscalating" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
 tests/sentry/issues/test_escalating.py:238: error: Argument "group" to "save_mock_escalating_group_forecast" of "DailyGroupCountsEscalating" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
 tests/sentry/issues/test_escalating.py:240: error: Argument 1 to "is_escalating" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
-tests/sentry/issues/test_escalating.py:244: error: Item "FlexibleForeignKey[Union[Project, Combinable], Project]" of "Union[FlexibleForeignKey[Union[Project, Combinable], Project], Any]" has no attribute "id"  [union-attr]
+tests/sentry/issues/test_escalating.py:244: error: Item "ForwardManyToOneDescriptor" of "Union[Any, ForwardManyToOneDescriptor]" has no attribute "id"  [union-attr]
 tests/sentry/issues/test_escalating.py:244: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 tests/sentry/issues/test_escalating.py:244: error: Item "None" of "Optional[Group]" has no attribute "project"  [union-attr]
 tests/sentry/issues/test_escalating.py:257: error: Argument 1 to "archive_until_escalating" of "DailyGroupCountsEscalating" has incompatible type "Optional[Group]"; expected "Group"  [arg-type]
@@ -7654,9 +7582,9 @@
 tests/sentry/tasks/deletion/test_scheduled.py:91: error: "RegionalRunScheduleDeletionTest" has no attribute "tasks"  [attr-defined]
 tests/sentry/tasks/integrations/github/test_pr_comment.py:246: error: Value of type "int" is not indexable  [index]
 tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
-tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 0 has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [list-item]
-tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 1 has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [list-item]
-tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 2 has incompatible type "Union[BoundedBigAutoField[Union[Combinable, int, str, None], int], Any]"; expected "int"  [list-item]
+tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 0 has incompatible type "Union[Any, BoundedBigAutoField[Union[Combinable, int, str, None], int]]"; expected "int"  [list-item]
+tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 1 has incompatible type "Union[Any, BoundedBigAutoField[Union[Combinable, int, str, None], int]]"; expected "int"  [list-item]
+tests/sentry/tasks/integrations/github/test_pr_comment.py:275: error: List item 2 has incompatible type "Union[Any, BoundedBigAutoField[Union[Combinable, int, str, None], int]]"; expected "int"  [list-item]
 tests/sentry/tasks/integrations/github/test_pr_comment.py:280: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 tests/sentry/tasks/integrations/github/test_pr_comment.py:288: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 tests/sentry/tasks/integrations/github/test_pr_comment.py:296: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
@@ -7927,7 +7855,7 @@
 tests/sentry_plugins/victorops/test_plugin.py:87: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 tests/sentry_plugins/victorops/test_plugin.py:92: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
 tests/sentry_plugins/victorops/test_plugin.py:93: error: Item "None" of "Optional[Group]" has no attribute "id"  [union-attr]
-tests/sentry_plugins/victorops/test_plugin.py:94: error: Item "FlexibleForeignKey[Union[Project, Combinable], Project]" of "Union[FlexibleForeignKey[Union[Project, Combinable], Project], Any]" has no attribute "id"  [union-attr]
+tests/sentry_plugins/victorops/test_plugin.py:94: error: Item "ForwardManyToOneDescriptor" of "Union[Any, ForwardManyToOneDescriptor]" has no attribute "id"  [union-attr]
 tests/sentry_plugins/victorops/test_plugin.py:94: error: Item "None" of "Optional[Group]" has no attribute "project"  [union-attr]
 tests/snuba/api/endpoints/test_discover_key_transactions.py:33: error: Cannot call function of unknown type  [operator]
 tests/snuba/api/endpoints/test_discover_key_transactions.py:899: error: Argument "data" to "get" of "APIClient" has incompatible type "Dict[str, Union[List[Any], str, None]]"; expected "Union[Mapping[str, Union[str, bytes, int, Iterable[Union[str, bytes, int]]]], Iterable[Tuple[str, Union[str, bytes, int, Iterable[Union[str, bytes, int]]]]], None]"  [arg-type]

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #53308 (39e30c1) into master (7a826c9) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #53308      +/-   ##
==========================================
- Coverage   79.53%   79.53%   -0.01%     
==========================================
  Files        4940     4940              
  Lines      208111   208111              
  Branches    35480    35480              
==========================================
- Hits       165523   165519       -4     
- Misses      37554    37557       +3     
- Partials     5034     5035       +1     
Impacted Files Coverage Δ
src/sentry/api/bases/organization.py 91.28% <ø> (ø)
src/sentry/integrations/discord/integration.py 100.00% <ø> (ø)
src/sentry/models/activity.py 96.55% <100.00%> (ø)
src/sentry/relay/config/metric_extraction.py 91.83% <100.00%> (ø)

... and 3 files with indirect coverage changes

Copy link
Contributor

@corps corps left a comment

Choose a reason for hiding this comment

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

Awesome, anything that is improving mypy coverage on orm models helps alot.

@asottile-sentry asottile-sentry merged commit 0bab8a6 into master Jul 21, 2023
@asottile-sentry asottile-sentry deleted the asottile-fields-not-overloaded branch July 21, 2023 19:25
armenzg pushed a commit that referenced this pull request Jul 24, 2023
working around python/mypy#5570

this is especially important as more things are being moved to unions of
`HC | Model`
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 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.

3 participants