feat(examples): enable ValidationHookConfig at boot in v3 reference seller#400
Draft
feat(examples): enable ValidationHookConfig at boot in v3 reference seller#400
Conversation
…eller Threads `validation: ValidationHookConfig | None = None` through `adcp.server.serve()`, `create_mcp_server()`, `create_a2a_server()`, and `ADCPAgentExecutor` so a single parameter covers both MCP and A2A transports — previously the A2A executor silently ignored any validation config passed via `serve(transport="both", ...)`. The v3 reference seller boots with strict mode by default and drops to warn when `ADCP_ENV=production`, reusing the same convention the client-side `_default_response_mode()` already uses. https://claude.ai/code/cse_01L78kF12Kbmf1QvBCuN5k5W
… README wire format - mode: str → mode: ValidationMode removes type: ignore[arg-type] - add missing cfg.responses assertion in prod-alias test - add wire-format example for VALIDATION_ERROR response to README https://claude.ai/code/cse_01L78kF12Kbmf1QvBCuN5k5W
… create_a2a_server Also removes private-function cross-reference from example docstring. https://claude.ai/code/cse_01L78kF12Kbmf1QvBCuN5k5W
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 #387
Summary
validation: ValidationHookConfig | None = Nonethroughadcp.server.serve(),create_mcp_server(),create_a2a_server(), andADCPAgentExecutor.__init__— previously the A2A executor silently ignored any validation config passed viaserve(transport="both", ...), so strict mode had no effect on the A2A leg of the reference seller.ValidationHookConfig(requests="strict", responses="strict")by default and drops towarnwhenADCP_ENV=production, reusing the same convention_default_response_mode()already uses on the client side so both sides flip together.VALIDATION_ERRORrejection looks like on the wire._build_validation_config()env-var behavior, 2 async tests confirming strict rejects malformed requests before the handler runs and warn mode processes them with a logged warning.What was tested
pytest tests/ --asyncio-mode=auto(excluding unrelated TLS hostname test): 3078 passed, 26 skippedpytest examples/v3_reference_seller/tests/test_smoke.py: 12 passed (7 pre-existing + 5 new)ruff check src/ examples/v3_reference_seller/src/: cleanmypy src/adcp/server/serve.py src/adcp/server/a2a_server.py --ignore-missing-imports: no issuesPre-PR review
validation=intoADCPAgentExecutorandcreate_a2a_server; flaggedADCP_ENVvs new env-var inconsistency → resolved by readingADCP_ENVdirectly.mode: str→mode: ValidationModeremoves# type: ignore[arg-type]→ fixed; missingcfg.responsesassertion in prod-alias test → fixed; README wire-format example → added.Nits (not fixed — surfaced for reviewer awareness)
ADCPTaskErrorthe way request-side errors do. This is pre-existing asymmetry increate_tool_caller; not in scope here._build_validation_config()collapses requests+responses to a single mode. TheValidationHookConfigdataclass supports independent control; adopters who need independent knobs can callValidationHookConfig(requests=..., responses=...)directly.Session: https://claude.ai/code/cse_01L78kF12Kbmf1QvBCuN5k5W
Generated by Claude Code