Skip to content

fix: route invalid_input order requests through the discovered endpoint - #75

Open
XiaolongZhang-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
XiaolongZhang-TT:fix/invalid-input-test-order-url
Open

fix: route invalid_input order requests through the discovered endpoint#75
XiaolongZhang-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
XiaolongZhang-TT:fix/invalid-input-test-order-url

Conversation

@XiaolongZhang-TT

Copy link
Copy Markdown
Contributor

Description

The four order GET/PUT calls in invalid_input_test.py used a raw "/orders/{order_id}" path against the httpx base_url, while every order call in order_test.py goes through self.get_order_url(order_id), which resolves the shopping-service endpoint discovered from /.well-known/ucp:

def get_order_url(self, order_id: str) -> str:
    return self.get_shopping_url(f"/orders/{order_id}")   # {discovered_endpoint}/orders/{id}

The raw path only works when the shopping service is hosted at the server root. For a conformant server whose shopping service lives at a sub-path, these requests 404 before validation ever runs — so test_invalid_adjustment_status and test_malformed_adjustment_payload would fail (or pass) for the wrong reason (404 instead of the intended 422) instead of exercising the intended validation path.

Switched all four to get_order_url to match the rest of the suite. Behavior is unchanged for the sample server, whose shopping endpoint is at the root.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, including removal of schema files or fields)
  • Documentation update

Is this a Breaking Change or Removal?

N/A — test-only fix, no schema/field removal.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (N/A — test-only fix)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

The four order GET/PUT calls in invalid_input_test.py used a raw
"/orders/{order_id}" path against the httpx base_url, while every call in
order_test.py goes through self.get_order_url(order_id), which resolves the
shopping service endpoint discovered from /.well-known/ucp. When the shopping
service is not hosted at the server root, the raw path 404s before validation
runs, so these tests would fail (or pass) for the wrong reason instead of
exercising the intended 422 validation path.

Use get_order_url to match the rest of the suite; behavior is unchanged for
the sample server, whose shopping endpoint is at the root.
@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Aug 7, 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