feat(testing): forward pre_validation_hooks through build_asgi_app#655
Merged
bokelley merged 2 commits intoMay 11, 2026
Merged
Conversation
build_asgi_app and build_test_client now accept pre_validation_hooks and forward it to create_mcp_server, so in-process ASGI tests see the same coercion surface as production serve() calls. Closes #651 https://claude.ai/code/session_01H8Trwexkgv1VyFJwDdZMoa
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 #651
Summary
build_asgi_appandbuild_test_clientwere missingpre_validation_hooksfrom their signatures. Becausecreate_mcp_serveralready accepts this parameter, in-process ASGI tests silently got a different validation surface than productionserve()calls — pre-v3 buyer payloads thatserve(pre_validation_hooks=...)would coerce were rejected bybuild_asgi_app-driven tests, causing false-red test failures and false-green production gaps.This PR adds
pre_validation_hooks: dict[str, Callable[..., Any]] | None = Noneto both helpers and forwards it to the existingcreate_mcp_servercall. No change to internals — pure forwarding, fully backwards-compatible.What was tested
pytest tests/test_testing_decisioning.py tests/test_pre_validation_hooks.py→ 41 passedpytest tests/ -k "not test_real_tls" --ignore=tests/integration→ 4318 passed (TLS test is a pre-existing network-dependent failure unrelated to this change)ruff check src/adcp/testing/decisioning.py→ all checks passedmypy src/adcp/testing/→ no new errorsPre-PR review
hook_callsvariable from smoke test)Session: https://claude.ai/code/session_01H8Trwexkgv1VyFJwDdZMoa
Generated by Claude Code