feat: 2.1.0 — A2A v1.0 canonical wire format + tests - #52
Merged
Conversation
New helpers: - extract_owner_scope + OwnerScope dataclass (identity.tokens) - default_read_only_on_denied (identity.default_denied) - create_pay_to_address_from_stripe_pi (stripe_multichain) - has_x402_header / has_mppx_header (payment.payment_header) Behavior: - SolanaMppRailSpec.__post_init__ derives token (mint) from network (devnet CAIP-2 or raw 'devnet' -> devnet USDC mint). Mirrors X402BaseRailSpec.__post_init__. Explicit overrides still win. - AgentScoreGate.on_denied (FastAPI / Flask / aiohttp / Sanic) now accepts an optional 3-tuple (body, status, headers). Lets default_read_only_on_denied thread Cache-Control: no-store through to the response. Legacy 2-tuple (body, status) still works. Surface: - Adapter __all__ lists (fastapi / flask / django / aiohttp / sanic / middleware) trimmed to framework-specific surface only. Shared helpers (denial_reason_to_body, FIXABLE_DENIAL_REASONS, build_*_body, etc.) import from canonical top-level: agentscore_commerce. - identity/__init__.py drops cross-package re-export of has_payment_header. Bug fixes: - Inner-SDK: checkout.py + checkout_compute_first.py drop private _has_x402_header/_has_mppx_header; import from payment.payment_header. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hoist url/protocol_version/preferred_transport to top-level (camelCase on the wire), demote supported_interfaces to optional additional_interfaces, drop per-interface protocol_version, drop tenant, move extended_agent_card to top-level supports_authenticated_extended_card, add state_transition_history capability and per-skill security, rename security_requirements to security. Python attribute names stay snake_case; to_dict() emits camelCase to match the canonical wire format. Validated against @a2a-js/sdk@0.3.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign + verify + tamper-detection using joserfc EdDSA against the unsigned card body. Covers the signing contract end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace inert `# type: ignore[misc]` markers on the 3-tuple destructure branches in fastapi/flask/sanic/aiohttp on-denied wiring with explicit cast() narrowing — ty's len() check isn't a recognized type guard - Drop unused `retry_on_error_max_attempts` kwarg from `_try_create_redis` - Whitelist `seconds` Protocol method param in `_RedisLike` (structural typing for `redis.asyncio.Redis.expire`) ty + vulture + pytest all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…kout Mirror the node-commerce fix. CodeQL js/stack-trace-exposure flagged the `detail: str(exc)` field in the upstream_failed wire response — merchant errors may carry stack traces; the merchant's own logger is the right channel. Also add an explanatory comment on the empty `except RuntimeError` in the Flask rate-limit middleware's `_run_async` helper (per github-code-quality nudge): the except is intentional fallthrough to asyncio.run when no loop is current on the calling thread. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…re_names The whitelist file relied on bare-identifier statements (vulture's documented whitelist syntax). github-code-quality flagged each bare name as "statement has no effect" — accurate from a static-analysis perspective, since vulture matches `Name` AST nodes that look identical to dead code to other tools. Move the same name list into `[tool.vulture] ignore_names` in pyproject.toml; drop the whitelist file and its lefthook argument. Also collapse the mixed import style in tests/test_quote_cache_redis.py::test_quote_cache_in_memory_evicts_expired_entries (per the other github-code-quality nudge): use `import time` directly and patch `time.monotonic` — the quote_cache module re-exports `time` so a single identity is patched in both modules. vulture / ruff / ty / pytest (1380) all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the lefthook + pyproject.toml change in 1492c17. The ignore list now lives in [tool.vulture] ignore_names; the workflow only needs to scan the package directory. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Align our A2A
AgentCardbuilder with the canonical wire format from@a2a-js/sdk@0.3.13(the TypeScript reference SDK). This is the only behavior change in 2.1.0; the rest of the train shipped in 2.0.x.A2A wire format rewrite
Python attribute names stay snake_case (PEP 8);
to_dict()emits camelCase keys to match the canonical A2A wire format.url,protocol_version,preferred_transportto top-level (were per-interface)supported_interfaces→ optionaladditional_interfaces[](only set for multi-binding agents)protocol_versionand non-canonicaltenantextended_agent_card(capability) → top-levelsupports_authenticated_extended_cardstate_transition_historycapability + per-skillsecuritysecurity_requirements→security(typedlist[dict[str, list[str]]])A2A_PROTOCOL_VERSION,A2A_DEFAULT_TRANSPORTPermanent regression guards
tests/test_a2a_jws_roundtrip.pyexercises sign + verify + tamper-detection usingjoserfcEdDSA.tests/test_a2a.pyrewritten with an 18-key forbidden-snake-case list scanned against the serialized output.Note on PyPI a2a-sdk
a2a-sdk@1.0.3(Google's Python A2A package, protobuf-derived) ships an OLDER schema (supportedInterfaces[]+securityRequirements, no top-levelurl/protocolVersion). We align to the newer TypeScript SDK schema which mirrors https://a2a-protocol.org/latest/. The node-commerce sibling pins@a2a-js/sdk@0.3.13as a compile-time type guard.Test plan
uv run ruff check(clean)uv run ty check(clean)uv run vulture(clean)uv run pytest(1380 passing, 95.06% coverage)core/storebooted viaTestClient, served/.well-known/agent-card.jsonvalidated structurally against the canonical AgentCard shape — zero drift🤖 Generated with Claude Code