Repository navigation
fix(webhooks): keep 3.2 challenge helpers backward compatible - #1936
Merged
Merged
Conversation
PR 1897 made create_webhook_challenge_payload, challenge_webhook_destination and WebhookSender.send_webhook_challenge require seller_agent_url and event_types, and made proof challenges require an RFC 9421 sender. That broke calls that worked on 9.6.2, so the next main release would have been 10.0.0. The adcp 9.6 call shapes work again and emit a DeprecationWarning: - Omitting seller_agent_url and event_types builds and sends the 9.6 four-field challenge. - challenge_webhook_destination with authentication= and no sender= sends that challenge with legacy Bearer or HMAC-SHA256 headers, as 9.6 did. - send_webhook_challenge on a sender that does not sign with RFC 9421 sends it with that sender's own authentication, as 9.6 did. Passing seller_agent_url and event_types keeps the AdCP 3.2 behaviour from PR 1897 unchanged: schema-validated payload, delivery_auth binding, and RFC 9421 signing required. The defaults are a private sentinel, so only omitting both arguments selects the 9.6 shape; an explicit None takes the 3.2 path and fails as it does on main. Omitting only one raises TypeError. adcp 10.0 makes both arguments and the RFC 9421 sender required. Release-As: 9.7.0 Co-Authored-By: Claude Opus 5.5 <[email protected]>
bokelley
requested review from
KonstantinMirin and
rachitm022
as code owners
November 21, 2026 17:48
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — reintroduces adcp 9.6 webhook-challenge call shapes behind a private _UNSET sentinel, restoring the DR-0032/DR-0033 pathway-back that #1897 removed.
No blocking findings. The reviewer verified the load-bearing items:
src/adcp/webhooks.py(+397): 3.2 builder is the oldcreate_webhook_challenge_payloadbody renamed to_build_webhook_challenge_payloadunchanged; XOR guard_check_challenge_fields_passed_togetherfails-closed on a single arg;_send_legacy_webhook_challengekeeps SSRF protection via the validated URL and signs HMAC over the same compact-separator bytes it posts (no spaced-vs-compact drift).- Op-readiness: sender and legacy paths both thread the sender timeout /
timeout_secondsthrough. - Semver: required→optional loosening is non-breaking;
fix:+Release-As: 9.7.0is the correct signal. - Pathway: DR-0032/DR-0033 deprecated-path handling present with comprehensive tests (28 + 18) covering every shape, the
TypeErrors, and caller-line warning attribution.
Decision trace: no critical/high/medium findings (row 1 n/a); gated_paths false (row 2 n/a); high_risk false (rows 3/5 n/a); no medium findings (rows 4/8 n/a); no prior decision (row 6 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve. Note: review_decision is REVIEW_REQUIRED, but with gated_paths false that does not gate approval.
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.
Why
#1897 (
fix(webhooks)!: comply with AdCP 3.2 challenge schema) made the webhook challenge helpers requireseller_agent_urlandevent_types, and made proof challenges require an RFC 9421WebhookSender. Calls that worked on 9.6.2 now fail, so release-please proposes10.0.0frommain(#1898). That release fails CI because of the version number itself: the generated-alias removal test andadcp-reporting-storage'sadcp>=9.0.0,<10pin. It would also outrank the10.0.0bNbetas onnext, which track AdCP 3.3.This PR makes #1897 backward compatible so
maincan ship it as 9.7.0.What changes
create_webhook_challenge_payload,challenge_webhook_destinationandWebhookSender.send_webhook_challengeacceptseller_agent_urlandevent_typesas optional again.When you pass both, nothing changes from #1897. The payload is schema-validated,
delivery_authis bound, and an RFC 9421 sender is required. The new-argument code is untouched apart from the parameter defaults and a private rename of the payload builder.When you omit both, you get 9.6.2's behaviour plus a
DeprecationWarningthat names what to pass and says both become required in 10.0. Only omitting them counts. The defaults are a private sentinel, notNone, so an explicitNone(say, from empty config) takes the 3.2 path and fails exactly as it does onmain. The public annotations staystr/Sequence[str], as onmain.create_webhook_challenge_payload(account_id=, subscriber_id=, challenge=)challenge_webhook_destination(..., sender=<RFC 9421 sender>)challenge_webhook_destination(..., authentication=<Bearer/HMAC>), nosender=Authorization: BearerorX-ADCP-Signatureheaders. Warns about the missing fields and, separately, about the missing RFC 9421 sender.sender.send_webhook_challenge(url=, account_id=, subscriber_id=, ...)on an RFC 9421 senderThese 9.6.2 behaviours are unchanged: passing both
sender=andauthentication=without the new fields raisesambiguous_auth_mode(the error now suggests passing the new fields); passing neither raisessender_required; a non-RFC 9421sender=tochallenge_webhook_destinationraisessender_auth_mode_mismatch.New call shapes that were never valid on 9.6.2 raise
TypeErrorinstead of guessing what the caller meant:seller_agent_urlandevent_types, which matchesmain's missing-argumentTypeErrorauthentication=passed tocreate_webhook_challenge_payloadorsend_webhook_challengewithout the new fieldsPassing the new fields opts into the whole 3.2 contract, the RFC 9421 sender included. So
challenge_webhook_destination(seller_agent_url=..., event_types=..., authentication=...)with nosender=still raisessender_required, as it does onmain.Also in this PR:
README.mdanddocs/handler-authoring.mddescribe each function's deprecated behaviour separately._challenge_webhook_destination_v9_6andWebhookSender._send_v9_6_webhook_challenge. Delete them in 10.0, together with the two compat test modules.Release notes for 9.7.0
DeprecationWarning. A singlechallenge_webhook_destination(..., authentication=...)call with nosender=can emit up to three: missing fields, no RFC 9421 sender, and the existing once-per-processPushNotificationConfig.authenticationwarning. Adopters running with warnings-as-errors (-W error,filterwarnings = error) will see these calls fail until they migrate.await. When the call runs inside an asyncio task (asyncio.gather,create_task), they are attributed to asyncio internals (asyncio/events.py), so module-based warning filters won't match them.Release
fixand ends withRelease-As: 9.7.0.Release-As: 9.7.0footer. Squash-merge with the default commit-messages body, a merge commit, or a rebase all keep it, but only if the body isn't edited away. If you squash and rewrite the message, the squash commit message MUST still end withRelease-As: 9.7.0.!on fix(webhooks)!: comply with AdCP 3.2 challenge schema #1897's branch commit (bedea16) would still put a BREAKING CHANGES section in the 9.7.0 changelog. To remove it, fix(webhooks)!: comply with AdCP 3.2 challenge schema #1897's PR body now ends with a release-please commit-override block whose message isfix(webhooks): comply with AdCP 3.2 challenge schema. (The marker words are left out of this body on purpose: release-please also scans this PR's body for them.) Release-please attaches the PR to both fix(webhooks)!: comply with AdCP 3.2 challenge schema #1897 commits, so the override replaces both messages.mainlets release-please propose 9.7.0 from thefeatcommits alone. Until this PR lands, that 9.7.0 would still contain fix(webhooks)!: comply with AdCP 3.2 challenge schema #1897's breaking signatures.Testing
tests/test_webhook_challenge_legacy_compat.pyhas 28 tests. Each legacy call shape gets one or more; they assert the 9.6 wire payload and auth headers, theDeprecationWarningtext, and that the warning points at the caller's line. It also covers theTypeErrors, explicitNonefollowing the 3.2 path (invalid_configuration,sender_required, RFC 9421 rejection), and that the new-field path emits no warnings.tests/test_webhook_challenge_v9_6_compat.pyis v9.6.2'stests/test_webhook_challenge.pychecked in verbatim (18 tests, all passing). It covers config URLs, non-2xx responses, sender client and hook rejection, host override, preflight error wrapping,policy=, the sender timeout default, and model-typedauthentication.tests/test_webhook_challenge.py,tests/conformance/signing/test_webhook_sender_e2e.py,tests/test_webhook_signing_capabilities.py) still pass, unchanged.origin/mainin this sandbox: 6tests/test_reporting_interop_*TypeScript-interop gates andtest_reporting_production_harness.py::test_installed_cleanup_still_writes_evidence_when_pipe_draining_expires(PermissionErroron process-group control). Linux CI is authoritative for those.🤖 Generated with Claude Code
Release-As: 9.7.0