Title: feat(testing): reference upstream-traffic recorder middleware for query_upstream_traffic adopters (adcp#3830 item 4) · Issue #347 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: feat(testing): reference upstream-traffic recorder middleware for query_upstream_traffic adopters (adcp#3830 item 4) · Issue #347 · adcontextprotocol/adcp-client-python
X Title: feat(testing): reference upstream-traffic recorder middleware for query_upstream_traffic adopters (adcp#3830 item 4) · Issue #347 · adcontextprotocol/adcp-client-python
Description: Python sibling of adcp-client#TBD. Ship a reference middleware Python adopters drop into their `comply_test_controller` implementation to populate the session-scoped recording buffer that `query_upstream_traffic` returns. Why PR adcontex...
Open Graph Description: Python sibling of adcp-client#TBD. Ship a reference middleware Python adopters drop into their `comply_test_controller` implementation to populate the session-scoped recording buffer that `query_up...
X Description: Python sibling of adcp-client#TBD. Ship a reference middleware Python adopters drop into their `comply_test_controller` implementation to populate the session-scoped recording buffer that `query_up...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/347
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(testing): reference upstream-traffic recorder middleware for query_upstream_traffic adopters (adcp#3830 item 4)","articleBody":"Python sibling of adcp-client#TBD. Ship a reference middleware Python adopters drop into their \\`comply_test_controller\\` implementation to populate the session-scoped recording buffer that \\`query_upstream_traffic\\` returns.\n\n## Why\n\nPR adcontextprotocol/adcp#3816 ships the spec contract for \\`upstream_traffic\\` storyboard checks. Python-based adopters (sales-house adapters, signal marketplaces, governance tools written in FastAPI / Flask) opt in by exposing \\`query_upstream_traffic\\` from \\`comply_test_controller\\`. The recorder primitive lets them avoid hand-rolling the buffer + redaction + caller-scoping that the spec requires.\n\n## What to build\n\n\\`adcp.testing.upstream_recorder\\`:\n\n\\`\\`\\`python\nfrom adcp.testing import UpstreamRecorder\n\nrecorder = UpstreamRecorder(\n enabled=os.getenv(\\\"ADCP_SANDBOX\\\") == \\\"1\\\",\n redact_pattern=r\\\"^(authorization|token|api_key|...)\\$\\\",\n buffer_size=1000,\n ttl_seconds=3600,\n)\n\n# Wire as httpx event hook / requests session adapter\nimport httpx\nclient = httpx.Client(event_hooks={\\\"request\\\": [recorder.on_request], \\\"response\\\": [recorder.on_response]})\n\n# Or for requests:\nimport requests\nrequests.Session().mount(\\\"https://\\\", recorder.requests_adapter)\n\n# In your comply_test_controller handler for scenario: query_upstream_traffic:\ndef handle_query_upstream_traffic(req, principal):\n result = recorder.query(\n principal=principal,\n since_timestamp=req.params.get(\\\"since_timestamp\\\"),\n endpoint_pattern=req.params.get(\\\"endpoint_pattern\\\"),\n limit=req.params.get(\\\"limit\\\", 100),\n )\n return {\n \\\"success\\\": True,\n \\\"recorded_calls\\\": result.items,\n \\\"total_count\\\": result.total,\n \\\"truncated\\\": result.truncated,\n \\\"since_timestamp\\\": req.params[\\\"since_timestamp\\\"],\n }\n\\`\\`\\`\n\nSame key behaviors as the Node sibling: caller scoping (per-principal buffer), redaction at recording time, sandbox-only gating, optional purpose tagging callback.\n\n## HTTP client coverage\n\nShip adapters for the common Python HTTP clients:\n- \\`httpx\\` (event hooks — primary)\n- \\`requests\\` (transport adapter)\n- \\`aiohttp\\` (trace config)\n- \\`urllib3\\` (lowest level — nice-to-have)\n\n## References\n\n- Spec contract: adcontextprotocol/adcp#3816 (merged)\n- Sibling Node issue: adcp-client (file in parallel)\n- Source issue: adcontextprotocol/adcp#3830 item 4\n- Runner-side companion: adcp-client#1253 (consumer side; orthogonal to this)","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-02T16:18:06Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/347"}
| 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:cf1ff7dc-2584-9167-e2ad-1bc367814140 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D13E:2DBB21:D43761:11BDE7E:6B0101B0 |
| html-safe-nonce | ee959b63ddb9b5a452220d7d6f537e4bfc9acf29eb9afdf2ac267450b8aa5820 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTNFOjJEQkIyMTpENDM3NjE6MTFCREU3RTo2QjAxMDFCMCIsInZpc2l0b3JfaWQiOiI2MjgyODEyMDkyMzQ5MjE5MjQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 88e6603de3fdc824cc127fdf7f04f240b12c2e2ed2dd8a6ad4a9026e3d1a001e |
| hovercard-subject-tag | issue:4369418901 |
| 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/347/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e49f5b831c910b619b8b65f6f75354a5653bf48fdfe518ff91705fbdbec27cb/adcontextprotocol/adcp-client-python/issues/347 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e49f5b831c910b619b8b65f6f75354a5653bf48fdfe518ff91705fbdbec27cb/adcontextprotocol/adcp-client-python/issues/347 |
| og:image:alt | Python sibling of adcp-client#TBD. Ship a reference middleware Python adopters drop into their `comply_test_controller` implementation to populate the session-scoped recording buffer that `query_up... |
| 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 | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width