You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Canonical response fields typed SchemaVariant lose element types (pyright errors, Any under the mypy plugin) #1416
Since #1392 made the canonical models real subclasses, src/adcp/types/canonical_creative.py annotates 10 overriding fields as SchemaVariant[...] (lines ~692, 701, 704, 845, 885, 917, 930, 936, 1000, 1023). These include GetProductsResponse.products, CreateMediaBuyResponse1.packages, ListCreativesResponse.creatives and Product.format_options. The deleted canonical_creative.pyi typed them precisely (e.g. list[Product] | None).
SchemaVariant was designed for adopter subclass overrides. With adcp.types.mypy_plugin it becomes Any; without it, it isn't a valid type at all. So for library-internal overrides:
pyright / Pylance:list[Product] is not assignable to SchemaVariant, and SchemaVariant is not iterable, on ordinary adopter code like for p in resp.products.
mypy without the plugin: the same errors.
mypy with the plugin: no errors, but the fields are Any, so element typing is silently lost.
CI misses it because the repo enables the plugin and doesn't gate pyright.
Expected: inside the library, declare these overrides with their precise types, using targeted suppressions for the intentional override (# type: ignore[assignment] / # pyright: ignore[reportIncompatibleVariableOverride]), consistent with scripts/check_type_ignore_contract.py. Adopters should see list[Product] | None etc. under both checkers, with or without the plugin.
Acceptance: a strict adopter fixture iterating each of the 10 fields and using an element attribute passes mypy --strict with and without the plugin, and pyright. Add pyright on tests/type_checks/ to CI, or at least to make typecheck-all, so this can't regress silently.
Activity
fix(types): declare the canonical list overrides precisely for every …