Raised as inline review feedback on #1544 and never tracked; verified still open at f94e72f92 and confirmed pre-existing (the same lines exist on main, so no PR introduced it).
Problem
status_filter is annotated Any at four sites where a concrete type exists:
src/routes/api_v1.py:130 and :148 (context: Any on the same signatures)
src/core/schemas/_base.py:2856
src/core/tools/media_buy_delivery.py:867
The concrete type is MediaBuyStatus | list[MediaBuyStatus] | None — the parameter accepts a single status or a list of them, and the values are drawn from the existing MediaBuyStatus vocabulary. Annotating it Any means neither mypy nor the IDE catches a caller passing an unmodelled status string, which is exactly the class of bug the persisted-status vocabulary work has been tightening elsewhere.
context: Any on the same two api_v1.py signatures has a concrete type available as well.
Why this is not already covered
The repo has ratcheting baselines for typing debt (.mypy-untyped-defs-baseline, .type-ignore-baseline), but neither covers an explicit Any annotation on a typed def — those ratchets track untyped definitions and type: ignore comments respectively. So these sites are invisible to the existing ratchets and will not be picked up by them over time.
Fix
Replace the Any annotations with the concrete union, fix any call sites the narrowing surfaces, and run mypy over the four files. If a site genuinely needs to stay permissive, narrow it to the widest honest type rather than Any and note why inline.
Context
Surfaced by review feedback on #1544 ("status_filter: Any (and context: Any below) where concrete types exist"); filed separately because it is pre-existing and out of that PR's scope.
Raised as inline review feedback on #1544 and never tracked; verified still open at
f94e72f92and confirmed pre-existing (the same lines exist onmain, so no PR introduced it).Problem
status_filteris annotatedAnyat four sites where a concrete type exists:src/routes/api_v1.py:130and:148(context: Anyon the same signatures)src/core/schemas/_base.py:2856src/core/tools/media_buy_delivery.py:867The concrete type is
MediaBuyStatus | list[MediaBuyStatus] | None— the parameter accepts a single status or a list of them, and the values are drawn from the existingMediaBuyStatusvocabulary. Annotating itAnymeans neither mypy nor the IDE catches a caller passing an unmodelled status string, which is exactly the class of bug the persisted-status vocabulary work has been tightening elsewhere.context: Anyon the same twoapi_v1.pysignatures has a concrete type available as well.Why this is not already covered
The repo has ratcheting baselines for typing debt (
.mypy-untyped-defs-baseline,.type-ignore-baseline), but neither covers an explicitAnyannotation on a typed def — those ratchets track untyped definitions andtype: ignorecomments respectively. So these sites are invisible to the existing ratchets and will not be picked up by them over time.Fix
Replace the
Anyannotations with the concrete union, fix any call sites the narrowing surfaces, and run mypy over the four files. If a site genuinely needs to stay permissive, narrow it to the widest honest type rather thanAnyand note why inline.Context
Surfaced by review feedback on #1544 ("
status_filter: Any(andcontext: Anybelow) where concrete types exist"); filed separately because it is pre-existing and out of that PR's scope.