Conversation
…rning (#358) Adopters constructing ``AuthInfo`` with the flat ``kind`` / ``key_id`` / ``principal`` / ``scopes`` fields still get a typed bearer credential synthesized — and now also see a DeprecationWarning pointing at the migration path. Synthesis is removal-tracked for adcp 4.5.0; adopter code constructs the typed ``credential=`` directly going forward. The flat fields themselves stay (audit / log context); only the synthesis-from-flat path is on the removal track. * Refactor synthesis into ``AuthInfo._synthesize_bearer_credential`` (static helper), reusable from both ``__post_init__`` and the framework-internal dict shim. * New classmethod ``AuthInfo._from_legacy_dict`` pre-synthesizes the credential and passes it via ``credential=`` so ``__post_init__`` skips synthesis (and the warning) when the framework's ``_extract_auth_info`` translates ``ctx.metadata['adcp.auth_info']`` dicts. Pointing the warning at framework code on every request would be noise the adopter can't fix by changing their own code. * ``_extract_auth_info`` now uses ``_from_legacy_dict`` instead of inline construction. * Tests: synthesis tests assert the warning fires via ``pytest.warns(DeprecationWarning)``; explicit-credential tests assert NO warning fires; new test confirms ``_from_legacy_dict`` is silent. Incidental synthesis usage in dispatch tests migrated to explicit ``credential=ApiKeyCredential(...)`` pattern that adopters should follow. Closes #358. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
bokelley
added a commit
that referenced
this pull request
May 2, 2026
… verifier (#365) Closes the migration loop the AuthInfo flat-field deprecation (shipped in #363) points adopters at. The deprecation message says "use the bundled signed-request verifier middleware" — but the SDK didn't ship a helper that converts the verifier's ``VerifiedSigner`` output into typed ``AuthInfo`` / ``HttpSigCredential``. Adopters had to construct it themselves. * Add ``AuthInfo.from_verified_signer(signer, ...)`` classmethod — the supported v3 migration target. Takes the ``VerifiedSigner`` produced by ``adcp.signing.verify_request_signature``, projects ``key_id`` / ``verified_at`` / ``agent_url`` into a typed ``HttpSigCredential``, and returns ``AuthInfo`` ready for the registry dispatch. * Raises ``ValueError`` when ``signer.agent_url is None`` — the verifier wasn't configured to extract the AdCP v3 agent_url claim, and the registry has no key to dispatch on. Server-boot error rather than silent dispatch fallthrough. * Three new tests: typed projection roundtrip, missing-agent_url rejection, end-to-end VerifiedSigner → AuthInfo → registry resolves. No deprecation warning fires on the supported path. Adopter Flask middleware migrates from:: AuthInfo(kind="signed_request", key_id=signer.key_id, ...) to:: AuthInfo.from_verified_signer(signer, scopes=...) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
AuthInfo.credentialfromkind/key_id/principal/scopesnow emitsDeprecationWarning. Removal target: adcp 4.5.0.api_key/bearer/oauthso existing adopter code keeps working through 4.4.x.AuthInfo._from_legacy_dictclassmethod for the framework-internalctx.metadata['adcp.auth_info']dict path — pre-synthesizes and passescredential=explicitly so the warning isn't fired from framework code (it would point at framework, not adopter code, and be unactionable).Closes #358.
Test plan
pytest tests/— full suite 3032 passed (was 3030; +2 new deprecation tests)pytest -W error::DeprecationWarning tests/test_decisioning_buyer_agent_dispatch.py— all targeted tests usepytest.warns(DeprecationWarning)for the synthesis path; framework-internal_from_legacy_dictdoes not warnruff checkclean on touched filesmypyclean onsrc/adcp/decisioning/examples/buyer_agent_registry_sqlalchemy.pyruns without warnings (already used the typedApiKeyCredentialform)🤖 Generated with Claude Code