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
adcp.types.CreativeAsset resolves to a different type at runtime than under mypy #1141
In adcp==6.6.0, the public adcp.types.CreativeAsset symbol has incompatible runtime and static meanings. Runtime resolves it to the legacy CreativeAsset1 branch, while mypy resolves it to the generated CreativeAsset root union over CreativeAsset1 | CreativeAsset2.
This makes code that type-checks against the 3.1+ format_kind branch fail or become impossible when it uses the public runtime symbol.
Revealed type is "def (root: CreativeAsset1 | CreativeAsset2) -> CreativeAsset"
The generated module does define the root union, but _generated.py then deliberately replaces the public runtime binding for subclassing compatibility:
Because the reassignment is ignored statically, the TYPE_CHECKING re-export and runtime lazy re-export disagree.
Impact
A downstream request DTO can subclass or construct CreativeAsset believing it represents both schema branches, while runtime actually fixes it to the legacy branch that requires format_id. The spec-legal format_kind branch is represented by CreativeAsset2 and is unavailable through that public name.
Expected
The public symbol should mean the same thing at runtime and under static analysis. Either:
export the root union as CreativeAsset and give the concrete compatibility class a separate explicit name, or
type CreativeAsset as CreativeAsset1 and document/use CreativeAssetUnion for the schema union.
SDK 7's canonical CreativeAsset plus explicit LegacyCreativeAsset surface provides a clearer migration seam, but the 6.6.0 mismatch should at least be documented and covered by a runtime/static alias regression test if a 6.x patch is not planned.
Affected version
Confirmed: 6.6.0
SDK 7 uses the canonical creative boundary for unqualified CreativeAsset; its explicit LegacyCreativeAsset imports the generated root model, so this exact mismatch does not appear to apply there.
Classification: Bug (confirmed in 6.6.0; already fixed in current main) Bucket(s): client (public type export surface — no matching label in repo; noted here) Status: ready-to-implement Milestone: (omitted — fix already shipped in main; remaining work is test coverage)
What the experts said:
code-reviewer: The specific CreativeAsset runtime/static split is gone in 8.0.0b14. _eager.py line 891 binds CreativeAsset = _canonical_creative.CreativeAsset — a straight assignment, no type: ignore, pointing to a concrete CanonicalBoundaryModel subclass built by _canonical_clone. No union, no rebind. However, _generated.py lines 3744–3753 still use the identical # type: ignore[misc,assignment] rebind for AuthorizedAgents (six-step chain) and Transport — producing the same static/runtime split for those names today.
dx-expert: (analysis pending; will update if material new information arrives)
My take: The reported mismatch is fixed in current main via the canonical creative boundary (canonical_creative.py). The outstanding work is a regression test to prevent recurrence, plus a decision on AuthorizedAgents/Transport which exhibit the same footgun pattern. Both items are non-breaking.
Implementation scope:
Add tests/test_creative_asset_regression.py:
fromadcp.types.canonical_creativeimportCanonicalBoundaryModelimportadcp, adcp.typesfrompydanticimportBaseModeldeftest_creative_asset_is_concrete_canonical_class() ->None:
cls=adcp.types.CreativeAssetassertisinstance(cls, type), "CreativeAsset must be a class, not a union"assertissubclass(cls, CanonicalBoundaryModel)
assertissubclass(cls, BaseModel)
assertcls.__name__=="CreativeAsset"assertclsisnotadcp.types.LegacyCreativeAssetassertadcp.CreativeAssetisadcp.types.CreativeAssetassert"format_id"incls.model_fieldsassert"format_kind"incls.model_fieldsassertcls.model_fields["format_kind"].is_required()
Separately (or in the same PR if reviewer prefers): replace # type: ignore[misc,assignment] rebinds for AuthorizedAgents/Transport in _generated.py lines 3744–3753 with accurate TypeAlias annotations, or document why the static/runtime split is intentional for those names.
Non-breaking rationale: test-only addition for primary scope; TypeAlias annotation changes are internal (_generated.py is not a public import path per CLAUDE.md).
Note: a 6.x backport is out of scope — main is at 8.0.0b14 and the fix has been in place since SDK 7.
Note: no client bucket label exists in this repo — flagging for maintainer to create if desired.
Activity
bokelley commentedon Sep 11, 2026
Triage
Classification: Bug (confirmed in 6.6.0; already fixed in current main)
Bucket(s): client (public type export surface — no matching label in repo; noted here)
Status: ready-to-implement
Milestone: (omitted — fix already shipped in main; remaining work is test coverage)
What the experts said:
CreativeAssetruntime/static split is gone in 8.0.0b14._eager.pyline 891 bindsCreativeAsset = _canonical_creative.CreativeAsset— a straight assignment, notype: ignore, pointing to a concreteCanonicalBoundaryModelsubclass built by_canonical_clone. No union, no rebind. However,_generated.pylines 3744–3753 still use the identical# type: ignore[misc,assignment]rebind forAuthorizedAgents(six-step chain) andTransport— producing the same static/runtime split for those names today.My take: The reported mismatch is fixed in current main via the canonical creative boundary (
canonical_creative.py). The outstanding work is a regression test to prevent recurrence, plus a decision onAuthorizedAgents/Transportwhich exhibit the same footgun pattern. Both items are non-breaking.Implementation scope:
tests/test_creative_asset_regression.py:# type: ignore[misc,assignment]rebinds forAuthorizedAgents/Transportin_generated.pylines 3744–3753 with accurateTypeAliasannotations, or document why the static/runtime split is intentional for those names.pytest tests/test_creative_asset_regression.py,mypy src/,ruff check .,black --check .TypeAliasannotation changes are internal (_generated.pyis not a public import path perCLAUDE.md).Note: a 6.x backport is out of scope — main is at 8.0.0b14 and the fix has been in place since SDK 7.
Note: no
clientbucket label exists in this repo — flagging for maintainer to create if desired.Triaged by Claude Code. Session: https://claude.ai/code/session_01Rg7rwcYtZYMcNRsoGnePSa
Generated by Claude Code