Repository navigation
Conversation
damaz91
left a comment
There was a problem hiding this comment.
LGTM — thank you for adding conformance coverage for "ucp_request": "omit" field ownership on Checkout, @vishkaty!
Layering CALLER_SUPPLIED (continue_url, expires_at, messages, and order) onto the raw POST /checkout-sessions payload and verifying via test_create_does_not_adopt_caller_supplied_omit_members and test_create_does_not_persist_caller_supplied_omit_members that none of those business-owned values appear in either the create response or the subsequent GET /checkout-sessions/{id} read—paired with test_create_without_omit_members_is_unaffected—cleanly tests the checkout.json contract.
Three cases asserting that a create does not adopt or persist members the request schema marks `omit`, and that a create without them is unaffected. Placed as `shopping/checkout/field_ownership_test.py` and registered as `shopping.checkout.field_ownership_test`, following the layout Universal-Commerce-Protocol#121 landed and dropping the redundant `checkout_` prefix the way `checkout_lifecycle_test` became `shopping.checkout.lifecycle_test`. The path and the module name are a suggestion and easy to change. Universal-Commerce-Protocol#120 made `SUITE_REGISTRY` the only path `--suite=all` runs, so the entry is what makes the module execute at all: without it `--suite=all` resolves 78 cases and selects none of these three, and with it 81. Run against the sample server from samples main: 3 passed on their own, and 81 passed for the whole suite with one skip elsewhere.
9288e31 to
56cded9
Compare
|
Rebased onto main at The test content is unchanged. What changed is where it lives and how it is registered:
The path and the module name are a suggestion, not a position. If you would rather it kept the Measured on this head against the sample server from samples main: the module alone gives 3 |
Four cases over cart conversion: conversion uses cart contents over the payload, a second conversion returns the existing checkout, cancel returns the cart state before deletion, and cart discount codes carry forward. Placed as `shopping/cart/cart_test.py` in a new `shopping/cart/` package, following the layout Universal-Commerce-Protocol#121 landed, and registered as `shopping.cart.cart_test`. What makes the module execute: without the registry entry `--suite=all` resolves 83 cases and selects none of these four, and with it 87. Rebased onto main past Universal-Commerce-Protocol#122. The only conflict was the registry list, where Universal-Commerce-Protocol#112 and Universal-Commerce-Protocol#122 had each added an entry. The cart entry sits at the head of the shopping list, which keeps that list grouped by subpackage in alphabetical order. Obligations are cited by section name, in the module docstring and at each case, rather than by line number. The line numbers the module carried were correct when it was written and had since drifted, one of them onto an unrelated paragraph, which is the hazard of citing a moving document by line. Two cases were judging a conformant business wrongly, and both are corrected here. The discount case used the presence of the code in the response as its evidence that the code had applied, but a business may return a code it received without applying it, as the reference does for an unknown code. With a configured code that does not apply at the business under test, the case therefore ran with nothing applied, and it failed a business that carried its applied codes forward and dropped the unapplied one with a `discount_code_invalid` warning, which discount.md allows. Application now needs an applied entry naming the code or a discount in totals, so such a code skips the case instead. Carry-forward is still satisfied by naming the code, and a discount standing in for it must now be at least as large as the one on the cart, so an unrelated discount no longer counts. The contents comparison took line items as a bag of id and quantity pairs, which failed a business expressing two units as two single-unit lines. It now sums quantity per item id and leaves out lines naming a parent, which still catches a business that takes its quantities from the request payload. Verified against the flower shop reference: the module alone gives 4 passed and 0 skipped; --suite=all gives 87 executed, 85 passed, 2 skipped, 0 failures; the pinned pre-commit, ruff, ruff format and cspell are clean. Nine servers each breaking one obligation redden their own case and nothing else, and the two corrections above are each held by a server that fails the old code and passes the new one.
Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Description
checkout.jsonmarkscontinue_url,expires_at,messagesandorderwithucp_request: omit, so a caller has no schema legal way to set them. A createhandler that builds its response by spreading the raw request body will still
let a caller supplied value through, because the SDK request model simply has
no field to stop it.
That bug was real in both reference servers and was fixed in samples#193 for
nodejs and samples#196 for python. Nothing in this suite checks it, so a
regression would go unnoticed. This adds the check.
What it does
The module posts a raw JSON body carrying values for all four members, which is
what a client not using the SDK can do, and asserts the values the business set
come back instead:
that merely strips them from the response while persisting them
A third test sends none of the four, so a server that starts rejecting their
absence is caught too.
Verification
Against the reference server, with python-sdk pinned to
v2026-04-08-6exactlyas this suite pins it:
The two failures name the leaked value in both places:
Full suite: 17 of 18 files pass.
order_test.pyfails on the two pre existing500s from samples#218, which this does not touch.
pre-commit run --all-filespasses.
Sequencing
#107 restructures the suite across 58 files. If it lands first this module moves
to the new layout. Happy to rebase either way round.