René's URL Explorer Experiment


Title: feat(types): cross-class entity overrides on response schemas — Protocol bounds or Generic response types · Issue #710 · adcontextprotocol/adcp-client-python · GitHub

Open Graph Title: feat(types): cross-class entity overrides on response schemas — Protocol bounds or Generic response types · Issue #710 · adcontextprotocol/adcp-client-python

X Title: feat(types): cross-class entity overrides on response schemas — Protocol bounds or Generic response types · Issue #710 · adcontextprotocol/adcp-client-python

Description: Problem PR #635 widened response-only list fields to Sequence[T], which solved subclass overrides — adopters subclassing Creative with MyCreative can now assign list[MyCreative] to Sequence[Creative] cleanly. But the more common adopter ...

Open Graph Description: Problem PR #635 widened response-only list fields to Sequence[T], which solved subclass overrides — adopters subclassing Creative with MyCreative can now assign list[MyCreative] to Sequence[Creativ...

X Description: Problem PR #635 widened response-only list fields to Sequence[T], which solved subclass overrides — adopters subclassing Creative with MyCreative can now assign list[MyCreative] to Sequence[Creativ...

Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/710

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(types): cross-class entity overrides on response schemas — Protocol bounds or Generic response types","articleBody":"## Problem\n\nPR #635 widened response-only list fields to `Sequence[T]`, which solved **subclass** overrides — adopters subclassing `Creative` with `MyCreative` can now assign `list[MyCreative]` to `Sequence[Creative]` cleanly.\n\nBut the more common adopter pattern in salesagent (and likely other production deployments) is **cross-class** overrides: substituting a *shape-compatible but distinct* entity class for the canonical one. `Sequence[T]` doesn't help these because `MyDeliveryView` is not a subclass of `Creative`.\n\n## Verified cases in salesagent after 5.3.0 bump\n\nStripped every `# type: ignore[assignment]` from the schema modules and re-ran mypy against adcp 5.3.0. **12 errors came back. All 12 are cross-class, not subclass.**\n\n| File:Line | Override | Parent expects | Cross-class because |\n|---|---|---|---|\n| `_base.py:874-877` | `list[GeoCountry]` (+ 3 siblings) | `Sequence[GeoCountriesExcludeItem]` | `GeoCountry` is the *inclusion* variant; spec uses distinct `GeoCountriesExcludeItem` for exclusion |\n| `_base.py:1322` | `list[Creative]` (salesagent) | `Sequence[CreativeAsset]` | `Creative` extends `LibraryCreative`, not `CreativeAsset` |\n| `_base.py:1939` | `list[SignalDeployment]` | `Sequence[Deployments \\| Deployments3]` | `SignalDeployment` extends `PlatformDeployment`, not `Deployments` |\n| `_base.py:2407` | `list[GetMediaBuysMediaBuy]` | `Sequence[MediaBuy]` | `GetMediaBuysMediaBuy` is a delivery-context view, not a `MediaBuy` subclass |\n| `delivery.py:251` | `list[MediaBuyDeliveryData]` | `Sequence[MediaBuyDelivery]` | Different class, same shape |\n| `delivery.py:440` | `list[CreativeDeliveryData]` | `Sequence[Creative]` | Different class, same shape |\n| `creative.py:407` | `list[CreativeAsset]` (local) | `list[CreativeAsset]` (library) | Same name, **different class** — local wraps with internal fields |\n| `creative.py:677` | `QuerySummary` (local) | `QuerySummary` (library) | Same name, different class |\n\nThis is exactly the pattern your own docs at #644 (\\\"Picking the Right Base Class — Context-Specific Schema Variants\\\") explicitly acknowledges as legitimate and documents how to type:ignore correctly. So the SDK has admitted these aren't bugs in adopter code — they're the intended pattern. But the type system has no way to express \\\"this field accepts any class with the shape of X\\\" without giving up on the safety entirely.\n\n## Proposed\n\nPick one. Listed in order of escalating invasiveness.\n\n### (a) Document the pattern + provide a typed escape hatch\n\nSmallest change. Ship a `SchemaVariant` mixin / decorator that marks the override as intentional and silences mypy without `# type: ignore`. Effectively codifies what PR #644's docs already say.\n\n```python\nclass GetMediaBuyDeliveryResponse(LibraryGetMediaBuyDeliveryResponse):\n    media_buy_deliveries: SchemaVariant[list[MediaBuyDeliveryData]]\n```\n\nThe type alias resolves to the field type at runtime; mypy treats it as `Any`-bounded. Loses precise inference inside the override but kills the ignores.\n\n### (b) Generate response types as Generic over their entity items\n\n```python\nclass GetCreativeDeliveryResponse(Generic[CreativeT], ...):\n    creatives: Sequence[CreativeT]\n```\n\nThen:\n\n```python\nclass GetCreativeDeliveryResponse(LibraryGetCreativeDeliveryResponse[CreativeDeliveryData]):\n    ...  # no override needed; the Generic specialization handles it\n```\n\nMechanically clean, fully type-safe, but requires the codegen path to emit Generic classes — bigger change.\n\n### (c) Use structural Protocol bounds in response types\n\n```python\nclass CreativeLike(Protocol):\n    creative_id: str\n    # ... minimum shape\n\nclass GetCreativeDeliveryResponse(...):\n    creatives: Sequence[CreativeLike]\n```\n\nAny class with the right shape satisfies the type. No subclass relation needed. Closest to what the adopter pattern actually means. But: structural typing in Pydantic-generated types is unusual and requires careful codegen.\n\n## What I'd push for\n\n**(b) is the cleanest** if the codegen pipeline can absorb it. Generic response types specialize cleanly, give adopters full inference inside their overrides, and don't require the SDK to predict which fields adopters will override.\n\n**(a) is the smallest reasonable step** if (b) is too invasive — it at least removes the visual noise and centralizes the pattern so reviewers know what they're seeing.\n\n## Acceptance\n\n- Salesagent can remove all 12 `# type: ignore[assignment]` comments listed above without changing override behavior\n- mypy `--strict` passes on the resulting schema modules\n- An example in `examples/` showing the documented adopter pattern\n- PR #644's docs guidance gets a \\\"prefer this over type:ignore\\\" pointer to the new mechanism\n\n## Real-world demand\n\nSame audit as #709. This was the single largest category of \\\"workarounds we hoped 5.3.0 would let us delete\\\" that turned out not to be addressed by PR #635.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-12T22:56:44Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/710"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8b67be51-7766-4ea8-8340-859d4186e3f1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE6BC:26ECEB:D5E660:11338CA:6B00F247
html-safe-nonce471e160292b9bba0031aa7971950a8ca5281c77be5f0c47f911fd71a424ffcf8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkJDOjI2RUNFQjpENUU2NjA6MTEzMzhDQTo2QjAwRjI0NyIsInZpc2l0b3JfaWQiOiI1NTE1ODM5Njc3NTYwNTgyNzI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf0e219ee9e25cd8f76d5676c55863aae8c2c2948a4bda37608177abb5ed9ad89
hovercard-subject-tagissue:4433203546
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/710/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ced7f4dea299adaf6ce5bc6cbc3dd0c0360aeb01bd9cb6b05d428d6581b37110/adcontextprotocol/adcp-client-python/issues/710
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ced7f4dea299adaf6ce5bc6cbc3dd0c0360aeb01bd9cb6b05d428d6581b37110/adcontextprotocol/adcp-client-python/issues/710
og:image:altProblem PR #635 widened response-only list fields to Sequence[T], which solved subclass overrides — adopters subclassing Creative with MyCreative can now assign list[MyCreative] to Sequence[Creativ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebokelley
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git
octolytics-dimension-user_id221690821
octolytics-dimension-user_loginadcontextprotocol
octolytics-dimension-repository_id1090305973
octolytics-dimension-repository_nwoadcontextprotocol/adcp-client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1090305973
octolytics-dimension-repository_network_root_nwoadcontextprotocol/adcp-client-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/adcontextprotocol/adcp-client-python/issues/710#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F710
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F710
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=adcontextprotocol%2Fadcp-client-python
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/710
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/710
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/710
adcontextprotocolhttps://github.com/adcontextprotocol
adcp-client-pythonhttps://github.com/adcontextprotocol/adcp-client-python
Codehttps://github.com/adcontextprotocol/adcp-client-python
Issues44 (44)https://github.com/adcontextprotocol/adcp-client-python/issues
Pull requests13 (13)https://github.com/adcontextprotocol/adcp-client-python/pulls
Actionshttps://github.com/adcontextprotocol/adcp-client-python/actions
Projectshttps://github.com/adcontextprotocol/adcp-client-python/projects
Security and qualityhttps://github.com/adcontextprotocol/adcp-client-python/security
Insightshttps://github.com/adcontextprotocol/adcp-client-python/insights
https://github.com/adcontextprotocol/adcp-client-python
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/710
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/710
#718https://github.com/adcontextprotocol/adcp-client-python/pull/718
feat(types): cross-class entity overrides on response schemas — Protocol bounds or Generic response typeshttps://github.com/adcontextprotocol/adcp-client-python/issues/710#top
#718https://github.com/adcontextprotocol/adcp-client-python/pull/718
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 12, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#issue-4433203546
#635https://github.com/adcontextprotocol/adcp-client-python/pull/635
#644https://github.com/adcontextprotocol/adcp-client-python/pull/644
#644https://github.com/adcontextprotocol/adcp-client-python/pull/644
docs: response-extension import path guidance for context-specific schema variants #644https://github.com/adcontextprotocol/adcp-client-python/pull/644
#709https://github.com/adcontextprotocol/adcp-client-python/issues/709
#635https://github.com/adcontextprotocol/adcp-client-python/pull/635
bokelleyhttps://github.com/bokelley
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
on May 12, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#event-25454417433
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#issuecomment-4437463860
Claude Codehttps://claude.ai/code
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#issuecomment-4439052440
#709https://github.com/adcontextprotocol/adcp-client-python/issues/709
#713https://github.com/adcontextprotocol/adcp-client-python/pull/713
#644https://github.com/adcontextprotocol/adcp-client-python/pull/644
#710https://github.com/adcontextprotocol/adcp-client-python/issues/710
#713https://github.com/adcontextprotocol/adcp-client-python/pull/713
#709https://github.com/adcontextprotocol/adcp-client-python/issues/709
Claude Codehttps://claude.ai/code
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#event-25476298058
feat(types): SchemaVariant marker + mypy plugin for cross-class entit…https://github.com/adcontextprotocol/adcp-client-python/commit/6145b3659945f533f66886a2114d1fc8d410fe3c
https://docs.github.com/articles/closing-issues-via-commit-messages
6145b36https://github.com/adcontextprotocol/adcp-client-python/commit/6145b3659945f533f66886a2114d1fc8d410fe3c
bokelleyhttps://github.com/bokelley
completedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#718https://github.com/adcontextprotocol/adcp-client-python/pull/718
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#event-25476525306
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#event-25485761129
docs(extending-types): use SchemaVariant for cross-class overrideshttps://github.com/adcontextprotocol/adcp-client-python/commit/7ead634f24bb4921612202aab0f87e5a608324e8
7ead634https://github.com/adcontextprotocol/adcp-client-python/commit/7ead634f24bb4921612202aab0f87e5a608324e8
docs: response-extension import path guidance for context-specific sc…https://github.com/adcontextprotocol/adcp-client-python/commit/61fb835fb7c141ddec95b6e890eb804024b21edb
61fb835https://github.com/adcontextprotocol/adcp-client-python/commit/61fb835fb7c141ddec95b6e890eb804024b21edb
KonstantinMirinhttps://github.com/KonstantinMirin
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/710#event-25486676064
feat(types): SchemaVariant marker + mypy plugin for cross-class overr…https://github.com/KonstantinMirin/adcp-client-python/commit/0b53cc9187cbe40da28db666d31030ebd6ff0d83
0b53cc9https://github.com/KonstantinMirin/adcp-client-python/commit/0b53cc9187cbe40da28db666d31030ebd6ff0d83
Sign up for freehttps://github.com/signup?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/710
Sign in to commenthttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/710
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.