Skip to content

fix(rest/python): advertise order capability in responses - #273

Open
arjun2075 wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
arjun2075:fix/python-order-response-capability
Open

arjun2075 wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
arjun2075:fix/python-order-response-capability

Conversation

@arjun2075

Copy link
Copy Markdown
Contributor

Problem

GET /orders/{id} and order webhook bodies advertised dev.ucp.shopping.checkout in ucp.capabilities.

Root cause

The order was built by copying the completed checkout's ucp.capabilities (checkout_service.py). The stored order, the order endpoint and the webhook body, which is that stored order, all inherited the checkout capability.

Spec

overview.md, "Response Capability Selection": businesses MUST include in ucp.capabilities only the capabilities that are relevant to the response's operation type. Order webhooks map to dev.ucp.shopping.order, and the selection table says an Order response includes order and does not include checkout, cart or discount. The order.md and order-rest.md examples show dev.ucp.shopping.order. Checked against tag v2026-04-08.

Fix

Build the order's capabilities as the order capability at the server version, the same way checkout builds its own. The completed checkout response is unchanged.

Regression coverage

test_order_advertises_the_order_capability_not_checkout completes a checkout, then asserts that GET /orders/{id} and the webhook body advertise only dev.ucp.shopping.order at the matching version and still validate as Order, and that the checkout response keeps dev.ucp.shopping.checkout. It fails on main with ['dev.ucp.shopping.checkout'] != ['dev.ucp.shopping.order'].

Validation

  • rest/python/server: uv run pytest, 363 passed
  • ruff check and ruff format --diff clean on the changed files

Notes

The sample has no capability negotiation (checkout hardcodes its capabilities), so this follows the same convention and does not intersect with the platform profile.

The order was built by copying the completed checkout's ucp.capabilities,
so GET /orders/{id} and order webhook bodies advertised
dev.ucp.shopping.checkout. overview.md (Response Capability Selection)
requires a response to include only the capabilities relevant to its
operation type, and order responses to include dev.ucp.shopping.order.

Build the order's capabilities as the order capability at the server
version, as checkout does for its own. Add an integration test covering
GET /orders/{id} and the webhook body.
@google-cla

google-cla Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@arjun2075

Copy link
Copy Markdown
Contributor Author

I am not sure why it is flagging CLA failure, i checked it manually and it says signed, @damaz91 I would appreciate your guidance on the same...

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants