test: add order-event webhook structural conformance module - #73
Merged
carolinerg1 merged 2 commits intoAug 5, 2026
Merged
Conversation
Covers the 2026-04-08 order.md delivery contract beyond event arrival (webhook_test.py): Standard Webhooks headers (Webhook-Id, unix Webhook-Timestamp), the fully populated order entity as body on the 'Order created' and update events (order.json required properties, ids reconciling with the originating checkout, never a delta), and the webhook signing contract (UCP-Agent + Signature + Signature-Input + Content-Digest, SHA-256 Content-Digest over the raw body, and ucp-agent among the signed components per the signatures.md component table). The signature tests skip with an explicit message while the server sends unsigned deliveries, mirroring how other structural tests skip on shapes the server does not emit; the update-event test skips when the server exposes no /testing/simulate-shipping path. MockWebhookServer now records the raw request bytes so Content-Digest can be verified without re-serializing JSON.
damaz91
approved these changes
Aug 5, 2026
ptiper
approved these changes
Aug 5, 2026
carolinerg1
approved these changes
Aug 5, 2026
carolinerg1
merged commit Aug 5, 2026
9e6201c
into
Universal-Commerce-Protocol:main
16 checks passed
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.
What
Adds
webhook_structure_test.py: structural conformance for the order event webhook contract that the 2026-04-08 order specification pins beyond "an event arrives" (whichwebhook_test.pyalready covers):Webhook-Idand a unixWebhook-Timestamp(order.md, Order Event Webhook, Required Headers).Content-Digestcomputed over the raw body bytes (signatures.md requires sha-256 over raw bytes;MockWebhookServernow records raw bytes so re serialized JSON cannot mask a digest mismatch), and the signed component list. This checks structure, not cryptographic verification of the signature value against published keys; that would be a natural follow up.Design decisions stated plainly for review
ucp-agentsigned component is graded conditionally: the signatures.md component table requires it whenever the header is present, but the order.md example webhook signature omits it. That inconsistency has a proposed fix in flight (ucp#659); until the spec is self consistent a merchant following the example verbatim is not failed, and the skip cites the discrepancy.Verification
Full suite against the reference server per the CI recipe: all 17 test files pass (this module: 3 pass, 2 loud skips on the unsigned reference; existing
webhook_test.pyunaffected, 3/3). Every assertion was mutation tested against a modified merchant: delta body, wrong ids, dropped Webhook-Id, millisecond timestamp, sha-512 digest, digest over re serialized JSON, and a component list omitting ucp-agent each turn the specific test red, and a correctly signed delivery turns the signature tests green. Pinned pre-commit clean.