Skip to content

feat: add ucp_validate.py CLI readiness validator#34

Draft
sbeashwar wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
sbeashwar:pr3-validator
Draft

feat: add ucp_validate.py CLI readiness validator#34
sbeashwar wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
sbeashwar:pr3-validator

Conversation

@sbeashwar
Copy link
Copy Markdown
Contributor

@sbeashwar sbeashwar commented Apr 17, 2026

A standalone CLI that produces a single READY / NOT_READY verdict for a UCP merchant's discovery profile, without requiring the conformance test fixtures (sample items, buyer, payment instrument, SDK wiring).

Complements protocol_test.py rather than replacing it:

  • Discovery + schema parsing (uses SDK BusinessSchema / ReverseDomainName, same as protocol_test after fix: validate payment handler structure from profile instead of hardcoded list #33).
  • Spec version + structural consistency (services list-vs-object, capabilities dict-vs-list across 2026-01-11 / 2026-01-23).
  • Capability reporting: required, known optional, custom.
  • Handler reverse-DNS + config presence.
  • Reachability of every spec / schema / config_schema / instrument_schemas URL in the profile.
  • JWK validation for signing_keys[] (kid, kty, EC crv/x/y, RSA n/e) - not covered by the conformance suite today.
  • Optional smoke POST /checkout-sessions with a known-fake item; treats 400 as "endpoint alive" - not covered by conformance without a full integration setup.
  • --json output + non-zero exit on NOT_READY for CI gates.

Usage:

uv run ucp_validate.py https://merchant.example.com
uv run ucp_validate.py https://merchant.example.com --smoke --verbose
uv run ucp_validate.py https://merchant.example.com --json

Kept as draft pending feedback on whether maintainers want this in-tree or as a separate utility.

@sbeashwar sbeashwar requested review from a team as code owners April 17, 2026 23:41
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 17, 2026

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.

Standalone merchant readiness validator for UCP endpoints.
Point it at any merchant URL, get a structured pass/fail report.

Features:
- Fetches and validates /.well-known/ucp discovery profile
- Dual schema version support (2026-01-11 + 2026-01-23)
- Structural consistency checking (version vs service/capability format)
- Only checkout is required; other declared capabilities validated
- Payment handler validation (structure, reverse-DNS naming)
- URL reachability checking for all spec/schema references
- Signing key JWK format validation
- Optional checkout smoke test (--smoke)
- JSON output mode (--json)
- Colored terminal output with ANSI badges
- Exit code 0 for READY, 1 for NOT_READY

Usage:
  uv run ucp_validate.py https://merchant.example.com
  uv run ucp_validate.py http://localhost:8182 --smoke
  uv run ucp_validate.py https://merchant.example.com --json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant