What happened?
TL;DR
A bug happened!
- Version: v0.2.0 / main (e1ea56d)
- Expected behavior:
- Evaluation should fail when acceptable_items is empty or fully undisclosed.
- A required quantity should be satisfied exactly (or at least to the required amount, depending on the intended doc semantics).
- Actual behavior:
- An empty acceptable_items list is treated as a wildcard, and quantity is interpreted only as a capacity limit instead of a required quantity.
Problem
Hi maintainers!
The current Python SDK and the v0.2 documentation appear to be inconsistent in two checkout.line_items cases(the following case 1 & case 2), while the identifier mapping remains underspecified(case 3).
1. Empty or fully undisclosed acceptable_items
The documentation says an item matches a requirement when its ID is present in the revealed acceptable_items; it does not define an empty list as a wildcard. ([documentation])
The schema makes acceptable_items selectively disclosable but does not require at least one element. )
The Python evaluator interprets an empty list as a wildcard, and an existing test explicitly accepts an arbitrary SKU. ([implementation], [test])
This is reachable through selective disclosure: the SDK documents that claims_to_disclose={} reveals nothing. In a local reproduction, withholding the only acceptable SKU produced:
verified acceptable_items: []
violations for a non-disclosed SKU: []
([presentation API], [disclosure filtering])
2. Required quantity versus capacity
The documentation says the maximum flow must equal both the total constraint quantity and the total Checkout quantity. The schema also describes quantity as the “Required quantity of matching items.” ([documentation], [schema])
The SDK only checks whether all Checkout units fit within the requirement capacities; it does not reject unused requirement capacity. Existing tests therefore accept quantity two against a requirement for three, and explicitly state that a cart smaller than the total capacity is valid. ([implementation], [tests])
3. Item identifier mapping
The documentation refers only to an “item ID.” The UCP model contains both a line-instance ID and a nested product ID, while the Python evaluator specifically compares checkout.line_items[].item.id. ([UCP LineItem schema], [evaluator])
For other Checkout profiles, AP2 does not state how their product identifier maps to the constraint ID. The acceptable ID is also described only as “often the SKU,” without stating whether it is globally unique or scoped to a Merchant or catalog. ([Checkout profile extension], [constraint item schema])
Suggested clarification
It would be good to clarify and align the documentation, schema, SDK and tests so that:
- a requirement with no revealed
acceptable_items fails closed, unless wildcard authorization is represented explicitly;
quantity is defined consistently as exact, minimum or maximum;
- the UCP comparison path is explicitly
checkout.line_items[].item.id;
- other Checkout profiles define an equivalent product-ID mapping;
- item IDs have a defined Merchant/catalog scope, or use a qualified identifier.
Relevant log output
Code of Conduct
What happened?
TL;DR
A bug happened!
- An empty acceptable_items list is treated as a wildcard, and quantity is interpreted only as a capacity limit instead of a required quantity.
Problem
Hi maintainers!
The current Python SDK and the v0.2 documentation appear to be inconsistent in two
checkout.line_itemscases(the following case 1 & case 2), while the identifier mapping remains underspecified(case 3).1. Empty or fully undisclosed
acceptable_itemsThe documentation says an item matches a requirement when its ID is present in the revealed
acceptable_items; it does not define an empty list as a wildcard. ([documentation])The schema makes
acceptable_itemsselectively disclosable but does not require at least one element. )The Python evaluator interprets an empty list as a wildcard, and an existing test explicitly accepts an arbitrary SKU. ([implementation], [test])
This is reachable through selective disclosure: the SDK documents that
claims_to_disclose={}reveals nothing. In a local reproduction, withholding the only acceptable SKU produced:([presentation API], [disclosure filtering])
2. Required quantity versus capacity
The documentation says the maximum flow must equal both the total constraint quantity and the total Checkout quantity. The schema also describes
quantityas the “Required quantity of matching items.” ([documentation], [schema])The SDK only checks whether all Checkout units fit within the requirement capacities; it does not reject unused requirement capacity. Existing tests therefore accept quantity two against a requirement for three, and explicitly state that a cart smaller than the total capacity is valid. ([implementation], [tests])
3. Item identifier mapping
The documentation refers only to an “item ID.” The UCP model contains both a line-instance ID and a nested product ID, while the Python evaluator specifically compares
checkout.line_items[].item.id. ([UCP LineItem schema], [evaluator])For other Checkout profiles, AP2 does not state how their product identifier maps to the constraint ID. The acceptable ID is also described only as “often the SKU,” without stating whether it is globally unique or scoped to a Merchant or catalog. ([Checkout profile extension], [constraint item schema])
Suggested clarification
It would be good to clarify and align the documentation, schema, SDK and tests so that:
acceptable_itemsfails closed, unless wildcard authorization is represented explicitly;quantityis defined consistently as exact, minimum or maximum;checkout.line_items[].item.id;Relevant log output
Code of Conduct