Repository navigation
feat(server): serve extra wire versions through version_aliases - #2013
Merged
Merged
Conversation
…ids it The alias echo stamped the caller's version into every response before validation. The compact AdCP 3.2 roots of list_products, buy_products, control_media_buy, accept_proposal and decline_proposals are closed and declare no adcp_version, so a 3.2-rc.7 caller of those tools got a response-validation failure. The echo now checks the served release's response schema for the response variant first (response_admits_property, a conservative structural check: any composed object schema that is closed without declaring the field suppresses the echo). The claim is read from the caller's raw request, before pre-validation hooks, so a hook that rewrites the version no longer loses the caller's alias; a version a hook supplies to an envelope-less request still counts. Only a claim that is an alias of the served release is echoed. docs/validation-contract.md documents the echo rule the SDK follows (spec question: adcontextprotocol/adcp#9370). Refs #2007 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
serve, ServeConfig, create_mcp_server, create_a2a_server,
adcp.decisioning.serve, MCPToolSet, create_tool_caller and the testing
helpers accept version_aliases, a mapping of extra wire version to a
release the server serves, for example {"3.3-rc.2": "3.3"}.
A request claiming an alias is accepted on every tool and transport,
task polling and comply_test_controller included, and is routed,
converted and validated as its target; ToolContext.resolved_adcp_version
is the target. get_adcp_capabilities advertises each alias in
adcp.supported_versions while it advertises the target, re-applied after
the response enhancer. Responses echo the alias where the target's
response schema admits adcp_version.
The selection travels as ServedVersions, a tuple of the accepted wire
versions that carries the server's alias map, so every path that already
receives supported_versions honors the aliases. Without
supported_versions the server keeps the SDK default set and default
handler release, plus the aliases. Keys must be release-precision
versions of this major that the SDK does not serve natively; targets
must be native releases in the selection. Bad configurations raise
ConfigurationError at construction.
3.3-rc.3 is now a built-in alias of 3.3, beside 3.2-rc.7, per
adcontextprotocol/adcp#9223: the rc.3 to 3.3.0 schema delta only adds
maxItems and maxLength bounds. It is deprecated and removed in 11.0.
A client that negotiates with a seller advertising only 3.3-rc.3 now
speaks 3.3 to it under that alias instead of falling back to 3.2.
Refs #2009
Refs adcontextprotocol/adcp#9223
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_UNSUPPORTED The dispatcher and comply_test_controller filled details.supported_versions from whichever check raised. Both now report the server's effective served list: its supported_versions selection, or every version the SDK serves, followed by its version_aliases. Tests pin the list for explicit claims, omitted envelopes outside an explicit selection, the default set with aliases, and comply_test_controller on MCP and A2A. Refs #2008 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pre_validation_hooks accepts a "*" key, exported as adcp.server.GLOBAL_PRE_VALIDATION_HOOK_KEY. Its hooks run for every tool, before that tool's own hooks, on MCP and A2A, so a cross-cutting hook such as a version bridge or unknown-field policy covers tools added later without listing them. compose_pre_validation_hooks composes the key like any other. The SkillMiddleware docs now state the ordering contract the SDK keeps: middleware wraps the tool caller and receives the caller's raw request; pre-validation hooks run inside call_next and each receives a shallow copy, so top-level rewrites never reach the dict middleware holds. A test pins it on both transports. Refs #2008 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…typed surface create_mcp_tools forwards version_aliases to MCPToolSet like the other factories. A strict mypy and pyright adopter fixture covers version_aliases on every public server factory, ServedVersions, and a global pre-validation hook keyed by GLOBAL_PRE_VALIDATION_HOOK_KEY. Refs #2009 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er docstring A converted response carries the release it was converted to, besides the alias echo; the docstring said the echo was the only source. Refs #2007 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups for version_aliases: - An alias key must be a release-precision prerelease of its target's own release line: 3.3-rc.3 for 3.3 is accepted; a stable key such as 3.4 for 3.3, or another line's prerelease such as 3.3-beta.1 for 3.2, raises ConfigurationError. Such a key would advertise a release the server does not serve and break the spec's downshift rule. - build_asgi_app and build_test_client check the handler's pin against the served set the way serve does. - The "*" pre-validation hook chain never applies to comply_test_controller, and the A2A executor no longer builds a hooked caller for it before the managed controller replaces it. - The validation contract and v9 to v10 migration notes state that the built-in 3.3-rc.3 alias is accepted and advertised by default, how to refuse it, and that a client speaks 3.3 to an rc.3 seller and checks its responses against the 3.3.0 bounds. Refs #2009 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rding test On Python 3.10 the dotted target adcp.server.serve.serve resolves adcp.server.serve to the re-exported serve function rather than the submodule, so mock.patch failed. Patch the module object instead. Refs #2009 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2007, #2008, #2009
Refs adcontextprotocol/adcp#9223, adcontextprotocol/adcp#9370
From the Apostra migration to AdCP 3.3 GA, with a Python 10.0.0 seller and a TS 17.0.0 buyer. Each commit is one conventional change, in this order:
adcp_versioninto a response schema that forbids it (Alias echo stamps adcp_version into closed compact 3.2 responses #2007). The alias echo now checks the served release's response schema for that response variant first, using the newresponse_admits_property. Compact 3.2 roots that are closed and don't declare the field get no echo:list_products,buy_products,control_media_buy,accept_proposalanddecline_proposals. The echo now reads the caller's raw claim, from before pre-validation hooks ran.version_aliases(serve(version_aliases=...): a supported way for a seller to serve an extra wire version #2009). This is a supported way to serve an extra wire version, and it adds the built-in3.3-rc.3 → 3.3alias (adcp#9223). The alias is deprecated and goes away in 11.0.VERSION_UNSUPPORTEDreports the effective served list, aliases included (Pre-validation hooks: document ordering, add a global hook, and report the server's versions in VERSION_UNSUPPORTED #2008.3)."*"pre-validation hook key for every tool, plus the middleware/hook ordering contract, documented and pinned by a test (Pre-validation hooks: document ordering, add a global hook, and report the server's versions in VERSION_UNSUPPORTED #2008.1, Pre-validation hooks: document ordering, add a global hook, and report the server's versions in VERSION_UNSUPPORTED #2008.2).create_mcp_toolsacceptsversion_aliases, an adopter type-check fixture, and a docstring fix.3.3-rc.3 → 3.3;3.4 → 3.3and3.3-beta.1 → 3.2raise). The testing helpers check the handler pin likeserve()."*"hooks explicitly never apply tocomply_test_controller. The default-on rc.3 alias and its client-side effect are documented in the validation contract and the migration notes.Public API
The same keyword is on
ServeConfig.version_aliases,create_mcp_server,create_a2a_server,ADCPAgentExecutor,MCPToolSet,create_mcp_tools,create_tool_caller,adcp.decisioning.serve,build_asgi_appandbuild_test_client. It also addsadcp.server.GLOBAL_PRE_VALIDATION_HOOK_KEY == "*", andadcp.server.version_policy.ServedVersions, a tuple of served wire versions with.aliasesand.explicit.An alias:
get_task_status,list_tasksandcomply_test_controllerincluded;ToolContext.resolved_adcp_versionis the target;get_adcp_capabilitiesadcp.supported_versionswhile its target is, applied again after the response enhancer runs;VERSION_UNSUPPORTEDdetails;Bad configurations raise
ConfigurationErrorat construction.Echo rule (docs/validation-contract.md)
The SDK adds
adcp_versionto a response only where the served release's response schema admits it:Otherwise the SDK adds nothing. The spec question is still open in adcp#9370.
Design calls to review
ServedVersionsis atuplesubclass, so the aliases reach every path that already takessupported_versionswithout new plumbing. Withversion_aliasesbut nosupported_versions, the selection is non-explicit: the server keeps the default handler release and the handler's advertised list, and appends the aliases to that list._admits_version_envelope, so the SDK now has two definitions.supported_versionsaccepts and advertises3.3-rc.3. It changes the client side too.negotiate_version(["3.3-rc.3", "3.2"])now returns3.3-rc.3(speaking 3.3 to an rc.3 seller) instead of3.2. An rc.3 payload over a new 3.3.0 bound now getsVALIDATION_ERROR, where it used to getVERSION_UNSUPPORTED. This reverses the "no rc.3 alias" note in MIGRATION_v9_to_v10.md, which this PR updates."*"hooks run before the tool's own hooks and never apply tocomply_test_controller. The managed controller runs no hooks at all.details.supported_versionsexplicit. The behavior change, aliases appearing in the list, comes with commit 2.Tests
New files:
tests/test_version_aliases.py(MCP and A2A over HTTP, task polling, test controller, decisioning testing client, capabilities, configuration errors, hooks, middleware ordering),tests/test_response_version_echo.py, andtests/type_checks/server_version_aliases.py. Existing tests that asserted rc.3 is refused were updated.Results:
test_large_received_decimal_cannot_replay_a_different_filter, fails the same way on unmodifiedorigin/nextin this environment.make typecheck-alland ruff are clean.BEGIN_COMMIT_OVERRIDE
fix(server): never echo adcp_version into a response schema that forbids it
feat(server): serve extra wire versions through version_aliases
feat(server): accept and advertise 3.3-rc.3 by default as a built-in alias of 3.3, deprecated and removed in 11.0; a seller that must refuse rc.3 passes an explicit supported_versions that omits it
fix(client): negotiate a seller's 3.3-rc.3 as AdCP 3.3; responses from such a seller are checked against the 3.3.0 bounds, strict by default and warn under ADCP_ENV=production
fix(server): report the served versions, aliases included, in VERSION_UNSUPPORTED
feat(server): run star pre-validation hooks for every tool except comply_test_controller
END_COMMIT_OVERRIDE
🤖 Generated with Claude Code