Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ def _extract_document_urls(

return sorted(urls, key=lambda x: x[0])

import unittest
def _is_allowed_unreachable_url(self, url: str) -> bool:
"""Whether a discovery URL is declared not-yet-published by its owner.

Some payment-handler (Google Pay / Shop Pay), mock-handler and REST schema
URLs in the merchant's discovery profile are owned by external parties and
not yet published for the declared UCP version. They remain real pointer
entries in the profile, but their absence must not fail a conformance run.
Unreachable URLs are configured per fixture via ``allow_unreachable_urls``
in ``conformance_input.json`` (matched as substrings) and should be deleted
as each owning party publishes its URL. Every other URL is strictly
validated.
"""
allow = (self.conformance_config or {}).get("allow_unreachable_urls", [])
return any(pattern in url for pattern in allow)

@unittest.skip("Schemas not yet published on remote ucp.dev domain")
def test_discovery_urls(self):
"""Verify all spec and schema URLs in discovery profile are valid.

Expand All @@ -123,6 +135,11 @@ def test_discovery_urls(self):
# Handle relative URLs if any (AnyUrl should be absolute though)
res = client.get(url)
if res.status_code != 200:
if self._is_allowed_unreachable_url(url):
# Real profile pointer whose owning party has not published it
# yet (see _is_allowed_unreachable_url); keep the suite green
# while the dependency ships without weakening other checks.
continue
failures.append(f"[{path}] {url} returned status {res.status_code}")
continue

Expand Down
6 changes: 6 additions & 0 deletions test_data/flower_shop/conformance_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"dev.ucp.shopping.buyer_consent"
],
"currency": "USD",
"allow_unreachable_urls": [
"pay.google.com/gp/p/ucp/2026-04-08",
"shopify.dev/ucp/shop-pay-handler/2026-04-08",
"ucp.dev/2026-04-08/schemas/mock_payment_handler/spec",
"ucp.dev/2026-04-08/services/shopping/openapi.json"
],
"items": [
{
"id": "bouquet_roses",
Expand Down
Loading