Title: Phase 2: TestControllerStore + AdCPTestContext header-driven compatibility (PR-R) · Issue #227 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: Phase 2: TestControllerStore + AdCPTestContext header-driven compatibility (PR-R) · Issue #227 · adcontextprotocol/adcp-client-python
X Title: Phase 2: TestControllerStore + AdCPTestContext header-driven compatibility (PR-R) · Issue #227 · adcontextprotocol/adcp-client-python
Description: Summary Downstream (salesagent) drives mock-ad-server behaviors via request headers (AdCPTestContext.from_headers(...)). The SDK's TestControllerStore is storyboard-shaped — transitions are triggered via the comply_test_controller skill,...
Open Graph Description: Summary Downstream (salesagent) drives mock-ad-server behaviors via request headers (AdCPTestContext.from_headers(...)). The SDK's TestControllerStore is storyboard-shaped — transitions are trigger...
X Description: Summary Downstream (salesagent) drives mock-ad-server behaviors via request headers (AdCPTestContext.from_headers(...)). The SDK's TestControllerStore is storyboard-shaped — transitions are tri...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/227
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Phase 2: TestControllerStore + AdCPTestContext header-driven compatibility (PR-R)","articleBody":"## Summary\n\nDownstream (salesagent) drives mock-ad-server behaviors via request headers (`AdCPTestContext.from_headers(...)`). The SDK's `TestControllerStore` is storyboard-shaped — transitions are triggered via the `comply_test_controller` skill, not via headers. The two models don't compose; downstreams that adopt `TestControllerStore` lose their header-driven test scaffolding.\n\n## Proposed fix\n\nAdd a `test_context_factory` hook to `register_test_controller()` / `create_mcp_server(test_controller=...)` that lets downstream derive the test-runtime context from request headers before the skill dispatches. Minimum signature:\n\n```python\nTestContextFactory = Callable[[RequestMetadata, Mapping[str, str]], Any]\n\ndef register_test_controller(\n mcp: Any,\n store: TestControllerStore,\n *,\n test_context_factory: TestContextFactory | None = None,\n) -> None: ...\n```\n\nWhen set, the factory is invoked per tool call with request headers — it returns whatever test-runtime context the seller's mock-ad-server code expects, which the handler can read off `ToolContext.metadata[\"test_context\"]`.\n\nAlternative (lower ambition): document the integration pattern without adding a hook. Downstream reads headers from their own middleware (via ContextVars) and sets `ToolContext.metadata[\"test_context\"]` inside their `context_factory`.\n\n## Acceptance\n\n- One of the two shapes above — prefer the hook since it formalizes the pattern.\n- Section in `docs/handler-authoring.md` under a new \"Testing hooks\" heading showing header-driven + storyboard-driven testing side-by-side.\n- Integration test exercising the factory against a mock seller.\n\n## Context\n\nRoadmap item PR-R (Phase 2) from `.context/sdk-adoption-roadmap.md`. Not a blocker for MCP migration; becomes relevant when salesagent's header-driven test framework needs to coexist with storyboard compliance testing.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-04-20T06:07:18Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/227"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ecfc419a-2277-716b-c8ff-8b8c9aee7651 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 832A:2F9718:AEEF0C:EBB820:6B00F690 |
| html-safe-nonce | 899056c31fb45cf3173c6f1d13e2e62b1ab8a202214c4dfb7b064677f617df9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzJBOjJGOTcxODpBRUVGMEM6RUJCODIwOjZCMDBGNjkwIiwidmlzaXRvcl9pZCI6Ijg0NzI3MzM3NjI0NDUxNzg1MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8def0cebf0de4394eaa952ea395cf3a5e8c8ee2112f3c3c47a6d6d94a207c005 |
| hovercard-subject-tag | issue:4293473992 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/227/issue_layout |
| twitter:image | https://opengraph.githubassets.com/690bdd350c703e4c4ed78130defadf5857cc0a0ca3740f3c83392df6455a7811/adcontextprotocol/adcp-client-python/issues/227 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/690bdd350c703e4c4ed78130defadf5857cc0a0ca3740f3c83392df6455a7811/adcontextprotocol/adcp-client-python/issues/227 |
| og:image:alt | Summary Downstream (salesagent) drives mock-ad-server behaviors via request headers (AdCPTestContext.from_headers(...)). The SDK's TestControllerStore is storyboard-shaped — transitions are trigger... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width