Probe sample envelope always carries resource; thread extensions - #116
Merged
Conversation
…p to 2.7.0 Python twin of node-commerce 2.9.0. x402 v2 envelope validators (mppx, and the shared discovery engine behind x402scan and MPPScan) refuse a PAYMENT-REQUIRED header without a resource block, and read the Bazaar extension's example input to build valid follow-up probe bodies. - build_discovery_probe_response: the sample envelope always carries a v2 resource (explicit, resource_url shorthand, or synthesized from the realm) and threads optional extensions into header and body. - Checkout: an x402_sample on discovery_probe inherits resource (the checkout's url + resource_info) and enriched Bazaar extensions from discovery_extensions; explicit values win. - Tests pin the sources, passthrough, and inheritance; README/CLAUDE.md document the behavior. Co-Authored-By: Claude Fable 5 <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
Python twin of agentscore/node-commerce PR 109 (2.9.0). x402 v2 envelope validators (mppx, and the shared discovery engine behind x402scan and MPPScan) refuse a PAYMENT-REQUIRED header without a
resourceblock, so a discovery-probe sample that omitted it read as "no valid x402 response"; the same engines read the Bazaar extension's example input to build valid bodies for their follow-up probes, so a probe withoutextensionsgot re-probed with junk bodies and the merchant's validation answers were reported as paywall failures.build_discovery_probe_response: the sample envelope now always carries a v2resource(explicitresource, theresource_urlshorthand, or synthesized from the realm with an http-prefix guard) and threads optionalextensionsinto both the header and the body mirror.Checkout: anx402_sampleondiscovery_probeinheritsresource(the checkout's ownurl+resource_info) and enriched Bazaarextensionsfromdiscovery_extensions; explicit values still win.Type of change
Public API
X402SampleProbegains optionalresourceandextensionsfields. No caller migration needed: existing configs keep working, and their emitted probes gain theresource(and, underCheckout, the inheritedextensions) that validators require. The real 402 path is untouched.Test plan
New tests: probe always carries resource (synthesized and explicit) and mirrors extensions in header and body; Checkout inheritance test (resource from url + resource_info, extensions from discovery_extensions).
uv run pytest(1863 passed, coverage 95.37% over the 95% gate),uv run ruff check/format --check,uv run ty checkall green locally. Deployed-path smoke with mppx validate and the @agentcash/discovery engine follows the core-store dep bump, this session.Checklist