Skip to content

docs(typing): annotate save_team_assignments ignore with FIXME#113929

Draft
JoshFerge wants to merge 1 commit intomasterfrom
joshferge/ref/document-save-team-assignments-fixme
Draft

docs(typing): annotate save_team_assignments ignore with FIXME#113929
JoshFerge wants to merge 1 commit intomasterfrom
joshferge/ref/document-save-team-assignments-fixme

Conversation

@JoshFerge
Copy link
Copy Markdown
Member

@JoshFerge JoshFerge commented Apr 24, 2026

Summary

Adds a FIXME comment above the `# type: ignore[arg-type]` on `save_team_assignments(member, None, team_roles)` documenting why the ignore is there: when `organizations:team-roles` is disabled, `team_roles` contains `(team, None)` tuples, which don't match the declared signature.

Placeholder follow-up — the real fix is to either normalize `team_roles` before the call or widen `save_team_assignments`' signature to accept the disabled-flag shape. Noting so a future engineer picking this up has context.

Drafted because it depends on #113419.

Test plan

  • `.venv/bin/python -m mypy src/sentry/core/endpoints/organization_member_details.py` passes

Agent transcript: https://claudescope.sentry.dev/share/gdEh4Y7Q4vCAzOLwqVqkl0EXROj79sQG-f7FEo87sPU

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 24, 2026
JoshFerge added a commit that referenced this pull request Apr 24, 2026
Bumps the mypy pin to 1.20.1. Prep PRs for the bulk
class-level-attribute fixes have already merged; what remains here is
the pin bump, the `GroupType` ClassVar + `__init_subclass__` migration,
a handful of small typing cleanups, and targeted `# type: ignore`
comments for cases that will get proper fixes in the follow-up PRs
below.

### Prep PRs (already merged)

- #113422 — `ref(typing)`: `RegressionDetector` + `AttributeHandler` →
`ClassVar`
- #113423 — `ref(issues)`: `GroupType` → `ClassVar` + move validation to
`__init_subclass__`
- #113424 — `fix(typing)`: `group_status` args are `int`, not
`GroupStatus`
- #113427 — `test(typing)`: refetch via queryset instead of
`refresh_from_db` after narrowing
- #113428 — `test(typing)`: misc test-side type hint fixes

### What's in this PR

- Bump `mypy>=1.19.1` → `mypy>=1.20.1` (+ `uv.lock`)
- Drop the now-stale `kombu.*` entry from `[[tool.mypy.overrides]]`
- `src/sentry/issues/grouptype.py` — convert `GroupType` fields to
`ClassVar` and move the category-validation check from the dead
`__post_init__` into `__init_subclass__`. Plus the corresponding test
updates in `tests/sentry/issues/test_grouptype.py` and
`tests/sentry/workflow_engine/endpoints/test_validators.py`.
- Small typing fixes that don't change runtime behavior:
- `digests/backends/base.py` — widen options map to `Mapping[str, Any]`
- `discover/compare_timeseries.py` — heterogeneous mismatches dict typed
as `dict[int, dict[str, Any]]`
- `explore/endpoints/explore_saved_queries.py` — drop unused `# type:
ignore`
- `tests/sentry/incidents/test_logic.py` — stringify both sides of the
`target_identifier` comparison so mypy stops flagging it as unreachable
- Targeted `# type: ignore` on six files where the proper fix is being
landed as a follow-up PR (see below)
- `.github/workflows/scripts/bootstrap-snuba.py` — `# type:
ignore[arg-type]` on `int(workers_str)` (single-file mypy can't see
through `sys.exit`; follow-up can replace with `NoReturn`)

### Follow-up PRs (drafts, based on this branch)

Each one removes one of the `# type: ignore` comments and applies the
proper fix. They'll merge after this lands.

- #113927 — `fix(typing)`: narrow `organization_id` in `from_auth`
- #113928 — `fix(typing)`: guard None options in `ReconnectingMemcache`
- #113929 — `docs(typing)`: annotate the `save_team_assignments` ignore
with a FIXME
- #113930 — `ref(typing)`: drop redundant cast in trace metric search
type
- #113932 — `ref(typing)`: drop redundant cast on
`TraceMetric.metric_type`
- #113933 — `ref(typing)`: drop redundant casts in
`resolve_measurement_value`

### Performance

| version | cold | warm |
|---|---|---|
| 1.19.1 | 49.22s | 17.82s |
| 1.20.1 | 39.04s | 5.73s |

### CI expectation

- `mypy` job: clean (0 errors)
- `uv` jobs: resolve against `pypi.devinfra.sentry.io` (1.20.1 has been
published there)
Base automatically changed from joshferge/ref/upgrade-mypy-to-1-20-1 to master April 24, 2026 16:18
The arg-type ignore was added in #113419; document the underlying
mismatch (team_roles can contain (team, None) tuples when
organizations:team-roles is disabled, which doesn't match the declared
signature) so the follow-up either fixes the signature or the caller.

Agent transcript: https://claudescope.sentry.dev/share/c6N6Q15yfk5b4v9xtEM2JZaFwXItVVVaA_yuZo2UyDY
@JoshFerge JoshFerge force-pushed the joshferge/ref/document-save-team-assignments-fixme branch from 0fe0993 to 85d626c Compare April 24, 2026 16:25
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