René's URL Explorer Experiment


Title: feat(testing): forward pre_validation_hooks through build_asgi_app (follow-up to #626) · Issue #651 · adcontextprotocol/adcp-client-python · GitHub

Open Graph Title: feat(testing): forward pre_validation_hooks through build_asgi_app (follow-up to #626) · Issue #651 · adcontextprotocol/adcp-client-python

X Title: feat(testing): forward pre_validation_hooks through build_asgi_app (follow-up to #626) · Issue #651 · adcontextprotocol/adcp-client-python

Description: Problem (follow-up to #626) adcp.testing.build_asgi_app (PR #626) is the public test-harness builder we adopted in salesagent (replacing private _build_mcp_and_a2a_app / _apply_asgi_middleware imports). It accepts every production serve(...

Open Graph Description: Problem (follow-up to #626) adcp.testing.build_asgi_app (PR #626) is the public test-harness builder we adopted in salesagent (replacing private _build_mcp_and_a2a_app / _apply_asgi_middleware impo...

X Description: Problem (follow-up to #626) adcp.testing.build_asgi_app (PR #626) is the public test-harness builder we adopted in salesagent (replacing private _build_mcp_and_a2a_app / _apply_asgi_middleware impo...

Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/651

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(testing): forward pre_validation_hooks through build_asgi_app (follow-up to #626)","articleBody":"## Problem (follow-up to #626)\n\n`adcp.testing.build_asgi_app` (PR #626) is the public test-harness builder we adopted in salesagent (replacing private `_build_mcp_and_a2a_app` / `_apply_asgi_middleware` imports). It accepts every production `serve()` kwarg we needed — auth, asgi_middleware, context_factory, streaming_responses, allowed_hosts/origins, validation, etc. — but **not `pre_validation_hooks`**.\n\nEffect on adopters: in-process HTTP-shaped tests driven via `httpx.ASGITransport(app=build_asgi_app(...))` get a different validation surface than production. Pre-v3 buyer payloads (`buying_mode` omitted, bare-string `format_id`, missing `asset_type`) that production auto-defaults via `serve(pre_validation_hooks=...)` are rejected by `build_asgi_app`-driven tests. Tests pass on payloads that would have been coerced in prod; tests fail on payloads that prod accepts.\n\nWe hit this during salesagent's 5.0 migration. Our [code reviewer flagged it](https://github.com/bokelley/salesagent/pull/...) as IMPORTANT: \"Pre-v3 buyer shapes that production would auto-default to will not be auto-defaulted in tests. This means in-process HTTP-shaped tests can pass while production fails on the same payload, or vice versa.\"\n\n## Concrete divergence\n\n```python\n# Production:\nserve(\n    router,\n    pre_validation_hooks={\"get_products\": apply_buying_mode_default},\n    ...\n)\n# Buyer payload {\"brand\": ...} (no buying_mode) → coerced to {\"brand\": ..., \"buying_mode\": \"brief\"} → validates.\n\n# Test:\napp = build_asgi_app(router, ...)\n# Same payload → ValidationError: \"buying_mode\" field required.\n```\n\nTests can't reach the production code path without re-implementing the coercion in test setup — which defeats the point of testing the production wiring.\n\n## Proposed fix\n\nAdd `pre_validation_hooks` to `build_asgi_app`'s signature, forwarded the same way `serve()` forwards it to `create_adcp_server_from_platform` or the underlying MCP server builder:\n\n```python\ndef build_asgi_app(\n    platform: DecisioningPlatform,\n    *,\n    name: str = ...,\n    # ... existing kwargs ...\n    pre_validation_hooks: dict[str, Callable[[str, dict[str, Any]], dict[str, Any]]] | None = None,\n    factory_kwargs: ...,\n) -> Any: ...\n```\n\nSymmetric with `serve()`. Forwards to whatever internal path `serve()` uses to install the hooks pre-dispatcher.\n\n## Why this matters\n\nThis is the second adopter friction point on `build_asgi_app` since 5.0 (the first was the [#618 pre-existing gap that the PR addressed](https://github.com/adcontextprotocol/adcp-client-python/pull/626)). Every kwarg `serve()` accepts that `build_asgi_app` doesn't accept is a place adopters either (a) lose production fidelity in tests, or (b) re-implement plumbing on the test side.\n\nFor salesagent, the workaround for now is documenting in `build_app()`'s docstring that pre-v3 wire fidelity is not preserved in in-process tests — adopters who need pre-v3-shape testing must use the production `serve()` path or pre-shape payloads themselves. Worth fixing properly upstream.\n\n## Files\n\n- Our `build_app()`: [bokelley/salesagent core/main.py](https://github.com/bokelley/salesagent/blob/main/core/main.py) — search for `build_asgi_app`. Currently drops `pre_validation_hooks` with a comment justifying the divergence; that comment can be removed once this lands.\n\n## Related\n\n- #626 (closed) — shipped the public `build_asgi_app`. This is a per-kwarg gap, not a regression.\n- #629 — the `pre_validation_hooks` mechanism this would forward.\n- Our composition issue [#645](https://github.com/adcontextprotocol/adcp-client-python/issues/645) (TenantRegistry → serve adapter) and #647 (per-request public_url) — same pattern of \"SDK shipped the production primitive, but the test/composition surface lags.\"\n","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-11T07:05:16Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/651"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6b7d03c1-e8bc-a065-56d1-5660678a4167
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9E02:3F8AB1:286E249:335935F:6B0184F3
html-safe-nonce13c042357916e7720fda5f30606ec421021c3ccba003c489f8bb789b6487d8c0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTAyOjNGOEFCMToyODZFMjQ5OjMzNTkzNUY6NkIwMTg0RjMiLCJ2aXNpdG9yX2lkIjoiOTEwNzUwOTA5MzkwNzY2MjA2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace3fdf4d39b286b9624b55bd34ede4a4feba4a2f01d338ba796ebb8a3834a32f0
hovercard-subject-tagissue:4418759039
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/651/issue_layout
twitter:imagehttps://opengraph.githubassets.com/744301431f2923e91bf1dc601b8aabc4fd447ca5f127c4406c18f6529ce628ff/adcontextprotocol/adcp-client-python/issues/651
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/744301431f2923e91bf1dc601b8aabc4fd447ca5f127c4406c18f6529ce628ff/adcontextprotocol/adcp-client-python/issues/651
og:image:altProblem (follow-up to #626) adcp.testing.build_asgi_app (PR #626) is the public test-harness builder we adopted in salesagent (replacing private _build_mcp_and_a2a_app / _apply_asgi_middleware impo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebokelley
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git
octolytics-dimension-user_id221690821
octolytics-dimension-user_loginadcontextprotocol
octolytics-dimension-repository_id1090305973
octolytics-dimension-repository_nwoadcontextprotocol/adcp-client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1090305973
octolytics-dimension-repository_network_root_nwoadcontextprotocol/adcp-client-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/adcontextprotocol/adcp-client-python/issues/651#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F651
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F651
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=adcontextprotocol%2Fadcp-client-python
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/651
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/651
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/651
adcontextprotocolhttps://github.com/adcontextprotocol
adcp-client-pythonhttps://github.com/adcontextprotocol/adcp-client-python
Codehttps://github.com/adcontextprotocol/adcp-client-python
Issues44 (44)https://github.com/adcontextprotocol/adcp-client-python/issues
Pull requests13 (13)https://github.com/adcontextprotocol/adcp-client-python/pulls
Actionshttps://github.com/adcontextprotocol/adcp-client-python/actions
Projectshttps://github.com/adcontextprotocol/adcp-client-python/projects
Security and qualityhttps://github.com/adcontextprotocol/adcp-client-python/security
Insightshttps://github.com/adcontextprotocol/adcp-client-python/insights
https://github.com/adcontextprotocol/adcp-client-python
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/651
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/651
#655https://github.com/adcontextprotocol/adcp-client-python/pull/655
feat(testing): forward pre_validation_hooks through build_asgi_app (follow-up to #626)https://github.com/adcontextprotocol/adcp-client-python/issues/651#top
#655https://github.com/adcontextprotocol/adcp-client-python/pull/655
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 11, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#issue-4418759039
#626https://github.com/adcontextprotocol/adcp-client-python/pull/626
#626https://github.com/adcontextprotocol/adcp-client-python/pull/626
code reviewer flagged ithttps://github.com/bokelley/salesagent/pull/...
#618 pre-existing gap that the PR addressedhttps://github.com/adcontextprotocol/adcp-client-python/pull/626
bokelley/salesagent core/main.pyhttps://github.com/bokelley/salesagent/blob/main/core/main.py
feat(testing): extend build_asgi_app with full serve-layer kwargs #626https://github.com/adcontextprotocol/adcp-client-python/pull/626
feat(server): pre-validation request hook for spec-default injection (#614) #629https://github.com/adcontextprotocol/adcp-client-python/pull/629
#645https://github.com/adcontextprotocol/adcp-client-python/issues/645
feat(a2a): per-request agent-card URL resolution (follow-up to #616) #647https://github.com/adcontextprotocol/adcp-client-python/issues/647
bokelleyhttps://github.com/bokelley
claude-triagingTriage routine is actively working on this issue (1-3 min)https://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaging%22
on May 11, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#event-25369632580
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 11, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#issuecomment-4418372725
#655https://github.com/adcontextprotocol/adcp-client-python/pull/655
https://claude.ai/code/session_01H8Trwexkgv1VyFJwDdZMoahttps://claude.ai/code/session_01H8Trwexkgv1VyFJwDdZMoa
Claude Codehttps://claude.ai/code
bokelleyhttps://github.com/bokelley
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
claude-triagingTriage routine is actively working on this issue (1-3 min)https://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaging%22
on May 11, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#event-25370080690
bokelleyhttps://github.com/bokelley
completedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#655https://github.com/adcontextprotocol/adcp-client-python/pull/655
on May 11, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#event-25370835175
KonstantinMirinhttps://github.com/KonstantinMirin
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/651#event-25486673877
feat(testing): forward pre_validation_hooks through build_asgi_app (a…https://github.com/KonstantinMirin/adcp-client-python/commit/2df49c03d4c34902c0869a6f25e65488ad303968
a…https://github.com/adcontextprotocol/adcp-client-python/pull/655
https://docs.github.com/articles/closing-issues-via-commit-messages
2df49c0https://github.com/KonstantinMirin/adcp-client-python/commit/2df49c03d4c34902c0869a6f25e65488ad303968
Sign up for freehttps://github.com/signup?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/651
Sign in to commenthttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/651
claude-triagedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22claude-triaged%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.