Repository navigation
Conversation
…eativesRequest Per AdCP 3.0.6+, account is optional when the seller uses implicit or derived resolution mode — identity is resolved from the auth chain instead of the wire field. The Pydantic models for create_media_buy and sync_creatives had account as required (no default), causing INVALID_REQUEST before the handler could resolve identity from auth. AccountStore.resolve already accepts ref=None; no handler changes needed. ExplicitAccounts.resolve still raises ACCOUNT_NOT_FOUND when ref=None, preserving fail-closed behavior for explicit-mode adopters. Fixes #623 https://claude.ai/code/session_01JX6bQ9FK2YxLefGnUSkg6x
- Remove account from required[] in all four schema cache files so generate_types.py regen preserves the optional field - Replace model_construct tests with model_validate to exercise the actual Pydantic validation path (the real failure mode from #623) - Add ExplicitAccounts wire-dispatch test confirming ACCOUNT_NOT_FOUND is returned (not a 500) when account is omitted in explicit mode https://claude.ai/code/session_01JX6bQ9FK2YxLefGnUSkg6x
Closing — the premise of this PR is wrongAfter re-deriving the resolution-mode semantics with @bokelley:
Either way, the buyer must identify which account they're transacting against. There's no resolution mode where the dispatcher should accept This PR makes See updated discussion on #623. |
|
Acknowledged. The protocol reasoning is sound — regardless of resolution mode (explicit or derived), the buyer must supply an Closing this draft is the right call. I can't close PRs directly, so a repo member will need to hit the close button. The source issue #623 should be updated to reflect that the fix belongs in the salesagent auth-chain middleware (buyer should pass the Triaged by Claude Code. Session: https://claude.ai/code/session_01EnjvAYLJHWtayiyP9My91X Generated by Claude Code |
Closes #623
Summary
The typed dispatcher was rejecting valid
create_media_buyandsync_creativesrequests when the buyer omittedaccount. Per AdCP 3.0.6+,accountis optional when the seller uses implicit or derived resolution mode — account identity is resolved from the verified auth chain instead of the wire field.Root cause:
CreateMediaBuyRequest.accountandSyncCreativesRequest.accountwere defined as required Pydantic fields (no default). Pydantic rejected the request withINVALID_REQUESTbefore the handler could callAccountStore.resolve, which already acceptsref=Noneand correctly derives account identity for implicit/derived mode.Changes:
src/adcp/types/generated_poc/media_buy/create_media_buy_request.py:account: AccountReference→account: AccountReference | None = Nonesrc/adcp/types/generated_poc/creative/sync_creatives_request.py: sameschemas/cache/{media-buy,creative}/+bundled/variants: removedaccountfromrequired[]sogenerate_types.pyregen reproduces the optional field on next stable-tag runtests/test_issue_623_implicit_account_optional.py: 7 regression tests (model-level + wire dispatch for derived mode + explicit-mode fail-closed)tests/test_mcp_schema_drift.py: updated spot-check to assertaccountis NOT increate_media_buy.requiredGetProductsRequest.accountwas alreadyAccountReference | None = None— this change aligns the other two request types with that existing pattern.ExplicitAccounts.resolvestill raisesACCOUNT_NOT_FOUNDwhenref=None, preserving fail-closed behavior for explicit-mode adopters without any handler changes.What was tested
ruff check src/— cleanmypyon changed files — no new errors (pre-existing import-not-found for httpx/a2a stubs unrelated)pytest tests/test_issue_623_implicit_account_optional.py— 7/7 passedpytest tests/test_mcp_schema_drift.py— 19/19 passedpytest tests/ --ignore=tests/conformance/signing/— 3773 passed, 24 skipped, 1 xfailed (pre-existing TLS network test unrelated to this change)Pre-PR review
required[]+ model_construct→model_validate tests); no new blockersGetProductsRequestprecedent;AccountStore.resolve(ref=None)contract already correct for implicit/derived;ExplicitAccountsfail-closed path preservedNits surfaced (not fixed):
lambda account_id: Nonein_ExplicitModePlatformfixture could belambda _: Nonefrom adcp.decisioning.types import AdcpErrorimport inside test function could move to module-level importstest_mcp_schema_drift.pyspot-check has no parallelsync_creativesassertion (covered by model-level test instead)idempotency_keydescription still reads "unique per (seller, request) pair" — with implicit mode the scope is actually(store_qualname, account.id)whereaccount.idis synthesized by the store (pre-existing description, out of this PR's scope)Session: https://claude.ai/code/session_01JX6bQ9FK2YxLefGnUSkg6x
Generated by Claude Code