Repository navigation
Comparing changes
Open a pull request
base repository: adcontextprotocol/adcp-client-python
base: v4.6.1
head repository: adcontextprotocol/adcp-client-python
compare: v5.0.0
- 16 commits
- 80 files changed
- 3 contributors
Commits on May 10, 2026
-
fix(server): register /.well-known/agent.json alias route in create_a…
…2a_server (#613) * fix(server): register /.well-known/agent.json alias route in create_a2a_server The 0.3 discovery alias was exempted from auth (auth.py _A2A_DISCOVERY_PATHS) but never registered as a Starlette route, causing buyer SDKs that probe the alias (including @adcp/sdk CLI auto-detection) to receive 404/503. Adds a second create_agent_card_routes call with card_url="/.well-known/agent.json" so both paths serve identical agent-card JSON without a redirect round-trip. Also tightens three tests that masked the bug by accepting 404 as valid, fixes the misleading auth comment, adds an inverse coverage check asserting all _A2A_DISCOVERY_PATHS entries are registered routes, and corrects the docs path. Closes #612 https://claude.ai/code/session_01JHq6DLPhFf2kQQpUkPtfZe * fix(server): address pre-PR review findings on alias route fix - Remove brand name from inline comment (use generic "A2A 0.3 buyer SDKs") - Expand A2ABearerAuthMiddleware docstring to mention 0.3 alias path - Add comment to inverse-drift-guard test noting it's structural-only https://claude.ai/code/session_01JHq6DLPhFf2kQQpUkPtfZe --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2989101 - Browse repository at this point
Copy the full SHA 2989101View commit details -
feat(a2a): add public_url param to agent card for production deployme…
…nts (#621) * feat(a2a): add public_url param to agent card for production deployments Fixes #616 Adds `public_url` to `_build_agent_card`, `create_a2a_server`, `serve`, and `ServeConfig` so adopters running behind a load balancer or reverse proxy can advertise the correct public URL in `/.well-known/agent-card.json` instead of leaking `http://localhost:{port}/`. Also checks the `PUBLIC_URL` environment variable as a zero-code-change fallback for Cloud Run / Fly.io / Railway deployments. https://claude.ai/code/session_01NXgGie4ARyxg3hWBYo5tG6 * fix(a2a): address pre-PR review findings for public_url - Add public_url docstring to serve() (was missing despite being present in create_a2a_server) - Normalise trailing slash so callers can pass "https://x.com" or "https://x.com/" - Remove redundant `or None` from resolved_public_url assignment - Remove dead handler_ref loop from test https://claude.ai/code/session_01NXgGie4ARyxg3hWBYo5tG6 * test(a2a): add missing public_url edge case tests - Assert trailing-slash normalisation (URL without trailing slash) - Assert create_a2a_server defaults to localhost when PUBLIC_URL unset https://claude.ai/code/session_01NXgGie4ARyxg3hWBYo5tG6 --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 14d294c - Browse repository at this point
Copy the full SHA 14d294cView commit details -
feat(webhooks)!: create_mcp_webhook_payload returns McpWebhookPayload (…
…#632) Closes #607. `create_mcp_webhook_payload` now returns a typed `McpWebhookPayload` instance instead of `dict[str, Any]`. Adopters drop the `McpWebhookPayload.model_construct(**dict)` ceremony and get attribute access + IDE autocomplete directly. Pair with `to_wire_dict(payload)` for HTTP transport. `task_type` becomes a required `TaskType | str` argument and is validated against the closed `TaskType` enum at construction. Synchronous-only operations (`get_products`, `list_creatives`, `preview_creative`, etc.) are deliberately not in the enum because they don't flow through the task management system — they shouldn't appear in webhook payloads. Failing fast at the publisher surfaces the bug here rather than as a silent receiver-side rejection. Also: - `WebhookSender.send_mcp` and `WebhookDeliverySupervisor.send_mcp` propagate the same required `task_type: TaskType | str`. - The PG supervisor coerces `TaskType` enum to its on-wire string before binding to psycopg, preventing `repr()` corruption of the `adcp_webhook_delivery_queue.task_type` column. - `webhook_sender.py:550` callsite uses `payload.idempotency_key` and `to_wire_dict(payload)` for HTTP transport. BREAKING CHANGE: `create_mcp_webhook_payload` returns a Pydantic model, not a dict; `task_type` is now required. Migration: | Old | New | |---|---| | `payload["task_id"]` | `payload.task_id` | | `json=payload` (HTTP) | `json=to_wire_dict(payload)` | | `create_mcp_webhook_payload(...)` without `task_type` | required arg | Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9eb962c - Browse repository at this point
Copy the full SHA 9eb962cView commit details -
feat(server): expose RequestContext.transport and current_transport C…
…ontextVar (#627) * feat(server): expose RequestContext.transport and current_transport ContextVar Closes #617 Adopters building webhook services need to know whether the current request arrived via MCP or A2A so they can select the correct payload shape (Task/TaskStatusUpdateEvent vs McpWebhookPayload). The transport was already known to the dispatcher (via RequestMetadata.transport) but was buried in the opaque ToolContext.metadata dict with no typed surface. - Add `transport: Literal["mcp", "a2a"] | None` field to RequestContext; populated in _build_request_context from tool_ctx.metadata["transport"] (always present in production paths; None only in bare test fixtures) - Add `current_transport: ContextVar[Literal["mcp", "a2a"] | None]` to adcp.server.auth; set in _build_request_context so webhook services called from handlers can read it without a RequestContext in scope - Export current_transport from adcp.server (alongside current_tenant) - Also export current_principal and current_principal_metadata from adcp.server — pre-existing gap where these were accessible only via the private adcp.server.auth module path https://claude.ai/code/session_01UifYgpi26gbfXmhrNRFDvK * fix(server): address pre-PR review findings on transport field - Validate that metadata["transport"] is "mcp", "a2a", or None before assigning to RequestContext.transport; raises ValueError on invalid values so misconfigured context_factories fail visibly - Strip SDK-internal keys ("transport", "tool_name") from the handler-visible RequestContext.metadata so ctx.transport is the sole typed surface and adopters can't accidentally rely on the dict path - Add Literal import to dispatch.py for the explicit transport annotation - Add current_transport ContextVar assertion and "tool_name" not in ctx.metadata assertions to the parametrized transport extraction test - Extend RequestContext.transport docstring to cross-link current_transport and note that custom context_factories that omit metadata["transport"] also produce None https://claude.ai/code/session_01UifYgpi26gbfXmhrNRFDvK --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 20e5d53 - Browse repository at this point
Copy the full SHA 20e5d53View commit details -
feat(testing): extend build_asgi_app with full serve-layer kwargs (#626)
* feat(testing): extend build_asgi_app with full serve-layer kwargs build_asgi_app previously returned only the bare mcp.streamable_http_app() without auth, ASGI middleware, path normalization, or request size capping. This caused silent gaps when tests needed transport-layer fidelity matching production (auth middleware, CORS, custom context_factory, etc.). Now applies the same wrapping chain as _run_mcp_http: auth (innermost) → path_normalize → discovery → size_limit → asgi_middleware New params on build_asgi_app and build_test_client: auth, asgi_middleware, context_factory, middleware, streaming_responses, enable_dns_rebinding_protection, allowed_origins, max_request_size, validation (default DEFAULT_VALIDATION matching production), discovery_base_url Also adds AGENTS.md import quick-reference entry for build_asgi_app, build_test_client, make_request_context so coding agents discover these helpers without falling back to network-layer mocks. Closes #618 https://claude.ai/code/session_012Ujdm5DZ7CyECWqSq9KrHN * fix(testing): correct SERVER_DEFAULT_VALIDATION import typo; add allowed_origins to build_test_client - Fix SERVERDEFAULT_VALIDATION → SERVER_DEFAULT_VALIDATION (ImportError blocker found in pre-PR review) - Add allowed_origins param to build_test_client and wire it through to build_asgi_app, matching issue spec https://claude.ai/code/session_012Ujdm5DZ7CyECWqSq9KrHN --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8679a95 - Browse repository at this point
Copy the full SHA 8679a95View commit details -
feat(server): add TenantRegistry with per-tenant health tracking (#628)
* feat(server): add TenantRegistry with per-tenant health tracking Closes #619. Adds TenantRegistry — a higher-level multi-tenant primitive that provides JS createTenantRegistry parity for Python deployments. Adopters pre-build per-tenant DecisioningPlatform instances and register them; the registry tracks health state (pending/healthy/unverified/disabled) and surfaces a synchronous resolve_by_host for the hot request path. Key design choices over the JS surface: - resolve_by_host is sync (in-memory dict) rather than async — Python owns the mapping directly via register()/unregister(), no external resolver. - auto_validate dropped; validator presence is the opt-in (None = principal- token mode, always healthy). - Per-tenant asyncio.Lock prevents TOCTOU on concurrent recheck() calls. - unregister()-during-recheck race is guarded: post-validator writes check whether the tenant was removed while the validator was awaited. Exports added to adcp.server: TenantRegistry, TenantResolution, TenantHealthState, TenantValidator. Tested with pytest: 25 tests covering lifecycle, state machine, host normalization, sync/async validators, and concurrency correctness. https://claude.ai/code/session_019ucMgF6YS9X5bygYUADztx * feat(server): add register_lazy + async resolve to TenantRegistry Adds lazy platform construction support requested by @bokelley (#628): - `register_lazy(factory=...)` — defers per-tenant DecisioningPlatform construction to first `resolve()` call; avoids paying KMS/GAM auth costs for all N tenants at boot - `async resolve(host)` — handles both eager and lazy tenants; invokes the factory on first hit, caches the result, serializes concurrent first-hit resolves with the per-tenant lock (single factory invocation per tenant) - `PlatformFactory` type alias exported from `adcp.server` - `register()` clears any lazy factory on eager re-registration; `register_lazy()` clears any cached platform on lazy re-registration; `unregister()` clears both - Docstring fixes: `_normalize_host` load-balancer port note, `serve_options` multi-tenant clarification, lock lifecycle docs - 14 new tests (39 total, all passing): lazy lifecycle, concurrent first-hit, factory/validator failures, unregister-during-resolve zombie guard, eager↔lazy re-registration https://claude.ai/code/session_01DRv6qahN7Jjt3Q4oxGBXkd * fix(server): clear lazy factory from TenantRegistry on resolve() failure When resolve() fails (factory raises, validator raises, or validator returns False), the _factories entry was left intact, causing every subsequent resolve() to re-enter the lazy path and invoke the dead factory again. A disabled tenant requires operator recheck() to recover — repeated silent retries are incorrect. Fix: pop _factories alongside the _health="disabled" write in all three failure paths. Also pop on success (factory no longer needed once the platform is cached in _platforms). Adds test: test_resolve_factory_failure_does_not_retry_on_subsequent_calls https://claude.ai/code/session_01DRv6qahN7Jjt3Q4oxGBXkd * fix(server): fix register_lazy+resolve disabled-state inconsistencies Two correctness issues found in pre-PR review: 1. register_lazy(await_first_validation=True) + validator returns False: the platform was being written to _platforms even though the tenant is disabled, and the factory was left in _factories. Mirrors the resolve() cold-path: on validator failure, discard the platform and clear the factory so the disabled tenant behaves consistently regardless of how it reached that state. 2. resolve() docstring claimed it returns None when validator returns False — only true for the lazy cold-path. The fast-path (eager or previously-resolved lazy) returns TenantResolution(health="disabled"). Rewritten to make the contract unambiguous and to warn against gating solely on result is None. Also adds: - Class docstring: do-not-use-as-SubdomainTenantRouter warning (same resolve(host) signature, incompatible return type) - recheck() docstring: lazy-pending and lazy-disabled caveats (recheck on pending-lazy advances health without building the platform; recheck on factory-disabled is insufficient — re-register is required) - Test: register_lazy + await_first_validation + validator=False must not cache platform and must not retry factory on subsequent resolve() https://claude.ai/code/session_01DRv6qahN7Jjt3Q4oxGBXkd --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ae687b6 - Browse repository at this point
Copy the full SHA ae687b6View commit details -
feat(server): pre-validation request hook for spec-default injection (#…
…614) (#629) * feat(server): pre-validation request hook for spec-default injection Adds `pre_validation_hooks` to `serve()`, `create_mcp_server()`, `create_a2a_server()`, and `create_tool_caller()`. The per-tool hook runs on the raw wire dict before `validate_request` (schema) and `model_validate` (Pydantic), so it can supply spec-mandated defaults that absent pre-v3 buyers omit. Hook exceptions surface as INVALID_REQUEST. Includes 7 new pytest tests. Closes #614 https://claude.ai/code/session_015hHQqXRbn2jX9WTu564gjZ * fix(server): snapshot raw_params before hook to preserve context-echo contract Both code-reviewer and dx-expert expert review flagged that assigning raw_params after the hook would echo server-injected defaults back to the buyer as if they were sent on the wire, violating the AdCP context-echo contract. Move the snapshot to before the hook call (raw_params = params), so inject_context always uses the original wire dict regardless of what the hook returns or mutates. Also strengthens test_hook_does_not_pollute_context_echo: the previous test passed a copy of the outer dict so the assertion was trivially true. The new test sends a wire payload with a context field, uses a stripping hook that returns a completely new dict (no context key), and asserts the response context echo still carries the original wire context — only possible if raw_params was captured before the hook ran. https://claude.ai/code/session_015hHQqXRbn2jX9WTu564gjZ * fix(server): defensive copy before hook call eliminates in-place mutation footgun Pass dict(params) to pre_validation_hook so hooks that mutate their argument in-place still leave raw_params (the context-echo snapshot) untouched. The "must return a new dict" restriction is removed from docstrings; either mutation style is now safe. Adds test_in_place_mutation_is_safe_for_context_echo to prove the invariant. Adds a docstring cross-reference to #623 for the account-omission case per adopter feedback on #629. Co-authored-by: bokelley <[email protected]> https://claude.ai/code/session_0115Pruuy4MbdaxhPvgTBFoo --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 05d4cd8 - Browse repository at this point
Copy the full SHA 05d4cd8View commit details -
feat(server): default MCP streamable-http to stateful with idle evict…
…ion (#636) Stateless was the production-broken default — upstream MCP holds GET-SSE streams open with no idle eviction, causing connection accumulation under load. Stateful mode + session_idle_timeout=1800s (the knob added in mcp 1.27.0) is the production-safe shape. To make stateful safe by default, plumb the originating Starlette Request into RequestMetadata.request_context (sourced from upstream's mcp.server.lowlevel.server.request_ctx, set reliably in both dispatch paths). BearerTokenAuthMiddleware mirrors principal/tenant onto request.state in addition to ContextVars; auth_context_factory reads request.state first and falls back to ContextVars. Adopters using the bundled middleware + factory get the fix for free. Adopters with custom factories using ContextVars need to migrate to meta.request_context.state for stateful — documented in the docstrings. Adopters who genuinely need stateless (multi-replica without sticky LB on Mcp-Session-Id) opt back in via stateless_http=True; the SDK suppresses session_idle_timeout in that combination to honor the upstream constructor's stateless+timeout RuntimeError contract. Bumps mcp pin to >=1.27.0,<2.0 — the upper bound is required because create_mcp_server pre-creates StreamableHTTPSessionManager (FastMCP doesn't expose session_idle_timeout in its settings) which reads four FastMCP private attrs whose contract is not preserved across majors. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3173a54 - Browse repository at this point
Copy the full SHA 3173a54View commit details -
fix(server): strip None-valued asset fields from dict-based response …
…builder output (#631) Optional ImageAsset / VideoAsset / UrlAsset fields (format, alt_text, provenance, container_format, etc.) default to None in the Pydantic models but the bundled JSON schemas declare them as non-nullable (\"type\": \"string\", not [\"string\", \"null\"]). When adopters build dict-based creative responses with those fields explicitly set to None, the null values reach the wire and cause the storyboard schema validator's oneOf branch to reject the asset. Add _strip_none_values() — a recursive helper that removes None-valued keys from dicts before wire serialisation — and apply it in _serialize() (for dict items after the write-only-field strip), sync_creatives_response(), preview_creative_response(), and build_creative_response(). The Pydantic model path was already safe via model_dump(exclude_none=True). Closes #622 https://claude.ai/code/session_01AkZRebtF7xsZJZ2FPnQmNL Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c02ea84 - Browse repository at this point
Copy the full SHA c02ea84View commit details -
feat(webhooks)!: replace
domainkwarg with typedprotocol(AdcpPr……otocol enum) (#637) * feat(webhooks)!: replace `domain` builder kwarg with typed `protocol` Follow-up to #632. The schema's `mcp-webhook-payload.json` defines a typed `protocol` field (`AdcpProtocol` enum: `media-buy | signals | governance | creative | brand | sponsored-intelligence`); the builder was instead accepting an undocumented `domain` string and stuffing it into the wire body via `extra='allow'`. The JS reference implementation (`buildTaskWebhookPayload` in `from-platform.ts`) sets `payload.protocol` and never sets `domain` — so the Python SDK was the outlier. Replaces `create_mcp_webhook_payload(..., domain=...)` and `WebhookSender.send_mcp(..., domain=...)` with `protocol=...`. The kwarg accepts either an `AdcpProtocol` enum value or a kebab-case string; unknown values raise `ValidationError` at construction. `AdcpProtocol` is now publicly exported from `adcp.types`. Zero in-repo callers passed `domain=`; verified by grep before the swap. The kwarg was added in #632's same migration window so the breaking- change cycle is bundled. BREAKING CHANGE: `domain` kwarg removed from `create_mcp_webhook_payload` and `WebhookSender.send_mcp`. Migrate to `protocol` (kebab-case string or `AdcpProtocol` enum value). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(webhooks): auto-derive `protocol` from `task_type` in builder Caller now passes only `task_type` and the builder fills `protocol` from the canonical `TaskType` → `AdcpProtocol` mapping. Mirrors `protocolForTool` in `adcontextprotocol/adcp-client:src/lib/server/ decisioning/runtime/protocol-for-tool.ts` so cross-SDK webhook bodies classify operations identically. The mapping covers all 20 spec values; explicit `protocol=` passed by the caller still wins. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fdd4053 - Browse repository at this point
Copy the full SHA fdd4053View commit details -
docs(types): document Field(exclude=True) and @model_serializer for n…
…ested wire isolation (#630) * docs(types): document Field(exclude=True) and @model_serializer for nested wire isolation Pydantic v2's Rust-backed serializer does not call Python model_dump() overrides on nested child instances — a gap that was driving adopters to write mechanical parent-level dispatch boilerplate (~59 overrides in at least one downstream integration). Neither Field(exclude=True) nor @model_serializer(mode='wrap') require parent-level workarounds; both work correctly at every nesting depth via Pydantic's own pipeline. This commit: - Adds a top-level serialization note to extending-types.md explaining the Pydantic v2 nesting behavior - Adds a "Field(exclude=True) — Recommended" section with a working nested example - Adds a "@model_serializer" section for custom Python-level logic - Adds a migration guide replacing the 59-style parent-dispatch pattern - Adds a serialize_as_any note for runtime-type field inclusion - Updates Best Practices #1 to prefer Field(exclude=True) over call-site exclude={} - Adds a one-line comment on AdCPBaseModel.model_dump() cross-referencing the doc so source readers hit the explanation at the declaration https://claude.ai/code/session_01P7MQW9tW7z4rYm13zghrVC * docs(types): fix pre-PR review blockers in extending-types.md - @model_serializer: correct nesting claim — serializer only fires when serialized directly or when parent calls model_dump(serialize_as_any=True); update example to use user-defined source_label field (no non-existent render_url), add serialize_as_any=True demonstration - Field(exclude=True): fix import (adcp.types.base not adcp.types), switch example to Creative/CreativePayload (verifiable fields), remove invalid Product constructor that would raise ValidationError - Migration section: rename GetCreativesResponse (non-existent) to MyCreativePayload - Best Practices #1: fix CreateMediaBuySuccess → CreateMediaBuySuccessResponse (correct export name), add imports https://claude.ai/code/session_01P7MQW9tW7z4rYm13zghrVC * docs(types): fix pre-existing wrong type names throughout extending-types.md CreateMediaBuySuccess is not exported from adcp — the correct name is CreateMediaBuySuccessResponse. WebhookPayload is also not exported — McpWebhookPayload is the correct replacement. All 10+ import and usage sites in the pre-existing patterns corrected; class name suffixes (CreateMediaBuySuccessExtended) preserved. https://claude.ai/code/session_01P7MQW9tW7z4rYm13zghrVC --------- Co-authored-by: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4912af9 - Browse repository at this point
Copy the full SHA 4912af9View commit details -
feat(testing): adopter type-checking test suite with zero-ignore cont…
…ract (#634) * feat(testing): adopter type-checking test suite with zero-ignore contract Adds tests/type_checks/ — seven files that exercise documented SDK extension patterns under mypy --strict with zero # type: ignore lines. Bundled with the AccountStore.resolution ClassVar fix required to make the patterns type-check cleanly. Closes #625 https://claude.ai/code/session_01NDYgk4r6ooU1Zj3qZwainB * ci: wire adopter type-check suite into test matrix Adds "Run adopter type-check suite" step to the test job so mypy --strict tests/type_checks/ runs on every CI pass across all four Python matrix versions. https://claude.ai/code/session_01NDYgk4r6ooU1Zj3qZwainB * fix(testing): address pre-PR review findings in type-check suite - extend_response_with_override: replace Field on _-prefixed name (Pydantic v2 NameError) with PrivateAttr - handler_three_branch_return: add AsyncSeller covering the async direct-return branch (all three SalesResult paths now present) - pyproject.toml: re-enable import-not-found in tests.type_checks.* override so broken imports fail rather than pass silently https://claude.ai/code/session_01NDYgk4r6ooU1Zj3qZwainB * fix(testing): update webhook type-check for typed McpWebhookPayload return create_mcp_webhook_payload was changed in #632 to return McpWebhookPayload (typed Pydantic model) instead of dict[str, Any]. The type-check test still demonstrated the dict + cast() pattern, which no longer typechecks. Update to demonstrate the new zero-ignore adopter pattern: typed attribute access (payload.task_id) for reads, to_wire_dict(payload) for HTTP serialization. Use TaskType.create_media_buy (a real async task type — get_products is sync-only and not in the TaskType enum). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(testing): use GeneratedTaskStatus enum return type in webhook test McpWebhookPayload.status is GeneratedTaskStatus (enum), not str. extract_status return type and assertion updated accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 20e496c - Browse repository at this point
Copy the full SHA 20e496cView commit details -
feat(types)!: default serialize_as_any=True in AdCPBaseModel.model_du…
…mp (#639) Symmetric with the existing exclude_none=True default. Removes the parent-side model_dump boilerplate that adopters previously needed to write per response type to make subclass @model_serializer overrides fire through base-typed parent fields. Field(exclude=True) remains the wire-isolation contract and continues to suppress internal fields at every nesting depth. BREAKING CHANGE: Subclasses that add fields without Field(exclude=True) will now have those fields appear in model_dump() output where they were previously dropped by Pydantic's declared-schema firewall. Audit each subclass and mark internal fields with Field(exclude=True). To restore the prior behavior at a specific call site, pass serialize_as_any=False explicitly. Closes #615 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3160ace - Browse repository at this point
Copy the full SHA 3160aceView commit details -
feat(types): widen extension-point list[X] to Sequence[X] (#624) (#640)
* feat(types): widen extension-point list[X] to Sequence[X] for adopter inheritance Closes #624. Adopters who follow Critical Pattern #1 (subclass a library response type and override a parent's `list[X]` field with `list[ChildX]`) hit `# type: ignore[assignment]` on every override under mypy --strict — list is invariant in its element type. Sequence is covariant, so a Sequence[Parent] parent permits list[Child] override (where Child <: Parent) cleanly. This PR adds a post-codegen processor (`widen_extension_point_lists_to_sequence` in `scripts/post_generate_fixes.py`) that rewrites annotations on a small allowlist of fields documented as extension points. The allowlist is keyed on (file, class, field) so it survives codegen reformatting and field-order drift. The current allowlist contains one confirmed entry — `UpdateMediaBuyResponse.affected_packages` (matches salesagent `_base.py:360`) — across the two emitted variants (`media_buy/` and `bundled/media_buy/`). Nine TODO entries are placeholders pending the salesagent `# type: ignore[assignment]` line list — fill in as they're mapped. `tests/type_checks/extend_response_with_sequence.py` is the regression gate: subclasses `UpdateMediaBuyResponse1` with an overridden `affected_packages: list[_InternalPackage]` and asserts mypy --strict accepts the override with zero ignores. The Pydantic plugin behavior was validated in a 2-file spike before this PR — see the comment on #624 for the validation result. BREAKING CHANGE: callers passing `affected_packages` into a function typed `def f(x: list[Package])` will see a mypy error and need to migrate to `Sequence[Package]`. Runtime behavior is unchanged; the change is annotation-only. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(types): expand #624 allowlist with full Category A entries Refactor allowlist from (file, class, field) to (class, field) tuples and walk every generated .py file. datamodel-codegen emits bundled response files that each inline copies of subordinate types (Placement, TargetingOverlay, etc.); the walker rewrites every emission so all paths stay consistent. Allowlist now covers all 15 Category A entries: - Response: UpdateMediaBuyResponse.affected_packages, GetMediaBuyDeliveryResponse.media_buy_deliveries, GetCreativeDeliveryResponse.creatives, Signal.deployments, GetSignalsResponse.signals, GetMediaBuysResponse.media_buys, ListCreativesResponse.creatives - Request: PackageRequest.creatives, CreateMediaBuyRequest.packages, UpdateMediaBuyRequest.packages - Cross-cutting: Placement.format_ids, TargetingOverlay.geo_*_exclude (4) Result: 47 fields widened across 21 generated files. Pairs that match zero files emit a WARN so allowlist drift surfaces fast. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(types): address pre-merge review on #624 — bound regex to class, silent idempotency, document scope Three fixes from expert review: 1. Regex now bounded to current class. _widen_field_annotation slices region up to next ^class before running the field search. Latent bug fix — current corpus has no collisions, but prevents future codegen changes from silently triggering it. 2. Idempotent re-runs are silent. New _field_already_widened helper tracks "already Sequence" separately from "no list found"; WARN fires only when neither is found anywhere (genuine drift). 3. Regression test scope honestly documented. Required-field overrides surface a separate codegen multi-emission issue (filed as #642): datamodel-codegen emits Creative/Package/etc. per response file, so public alias resolves to one emission while parent field references another. Test docstring documents the scope. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 96ccfd4 - Browse repository at this point
Copy the full SHA 96ccfd4View commit details -
fix(types): widen canceled Literal[True]=True to Literal[True]|None=N…
…one on request types (#643) * fix(types): widen canceled Literal[True]=True to Literal[True]|None=None on request types (#641) Omitting canceled from UpdateMediaBuyRequest or PackageUpdate previously defaulted to True (datamodel-codegen const:true handling), silently canceling the media buy on every routine update. Adds fix_canceled_literal_defaults() to post_generate_fixes.py, widens 4 request-type emissions to Literal[True] | None = None, and adds 11 behavioral tests. https://claude.ai/code/session_013iJiiNZi9aBGFawGKUNiGw * fix(tests): remove unused import re in test_canceled_literal_default (nit from pre-PR review) https://claude.ai/code/session_013iJiiNZi9aBGFawGKUNiGw
Configuration menu - View commit details
-
Copy full SHA for 120ae3b - Browse repository at this point
Copy the full SHA 120ae3bView commit details -
chore(main): release 5.0.0 (#620)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for b279d1a - Browse repository at this point
Copy the full SHA b279d1aView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v4.6.1...v5.0.0