Commit 41eb6ae
committed
Fix mypy failure in Backend CI from django-stubs 6.0.3 upgrade
Two root causes introduced in quick succession during the 2026-04-23
batch of merges:
1. PR #1343 wired `Run mypy` into Backend CI with a per-module baseline
in mypy.ini. The baseline captured every file that had type errors
under django-stubs 6.0.2 (7208 errors across 357 files).
2. PR #1340 then bumped django-stubs 6.0.2 -> 6.0.3 in
requirements/local.txt. 6.0.3's stricter ValuesQuerySet typing
surfaced a new error on validate_v3_migration.py:303 -- a file that
was type-clean under 6.0.2 and therefore NOT in the baseline.
Result: Backend CI `linter` job fails on main and every PR branched
off main.
Additionally, the mirrors-mypy pre-commit hook still pinned
django-stubs==6.0.2 while CI's `Run mypy` step installs 6.0.3 from
requirements/local.txt -- the exact hook/CI drift that the comment
above `additional_dependencies` warns against. This let the new error
slip past pre-commit.
Fix:
- validate_v3_migration.py: use `.values_list("content_hash", "count")`
so the loop yields a typed tuple instead of relying on subscripting
an annotated ValuesQuerySet (which 6.0.3 types as an annotated model
rather than a dict). Functionally identical; zero behaviour change.
- .pre-commit-config.yaml: bump django-stubs pin to 6.0.3 so the hook
and CI check against the same stub version again.1 parent 55b6185 commit 41eb6ae
2 files changed
Lines changed: 5 additions & 3 deletions
File tree
- opencontractserver/documents/management/commands
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
302 | 304 | | |
303 | | - | |
| 305 | + | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| |||
0 commit comments