Skip to content

fix(typing): Add None guards for ORM lookups with nullable values#107726

Closed
JoshFerge wants to merge 1 commit intojferg/upgrade-mypy-upstream-django-stubsfrom
jferg/fix-type-ignores-orm-none-guards
Closed

fix(typing): Add None guards for ORM lookups with nullable values#107726
JoshFerge wants to merge 1 commit intojferg/upgrade-mypy-upstream-django-stubsfrom
jferg/fix-type-ignores-orm-none-guards

Conversation

@JoshFerge
Copy link
Member

Summary

Stacked on #107710. Adds explicit None checks and assertions before ORM .get(id=...) and .filter() calls where the ID could be None, replacing # type: ignore[misc].

Changes

  • vsts/client.py — guard identity_id is None before .get()
  • vercel/integration.py — extract and check user_id before .get()
  • user_authenticator_enroll.py — assert request.user.id is not None
  • organization_trace_item_attributes.py — assert organization_id is not None
  • organization_group_search_views_starred.py — assert request.user.id is not None
  • debug_files.py — extract request.GET.get("id") into variable
  • user_option.py — use project_id=project.id for HybridCloudForeignKey

Test plan

  • mypy passes on all changed files
  • Pre-commit hooks pass

Add explicit None checks and assertions before ORM .get(id=...) and
.filter() calls where the ID or value could be None, replacing
type: ignore[misc] comments.
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 5, 2026
@JoshFerge
Copy link
Member Author

Split into individual PRs against master: #107740, #107741, #107742, #107743, #107744, #107745, #107746

@JoshFerge JoshFerge closed this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant