Skip to content

fix(rest/python): return 422 for version_unsupported#141

Closed
vishkaty wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
vishkaty:fix/version-unsupported-status
Closed

fix(rest/python): return 422 for version_unsupported#141
vishkaty wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
vishkaty:fix/version-unsupported-status

Conversation

@vishkaty

Copy link
Copy Markdown
Contributor

What

The version-negotiation check in rest/python/server/dependencies.py raised
HTTP 400 when a platform requests a newer protocol version than the server
supports. The error registry in docs/specification/overview.md maps
version_unsupported to REST 422. This returns 422.

Why

422 lets a platform distinguish a protocol-negotiation failure (retry with an
older version / re-discover) from a generic 400 malformed request. The structured
error body (detail.errors[].code, severity: critical) is unchanged.

Test

Adds test_unsupported_version_returns_422: a future UCP-Agent version
(version="2999-01-01") now yields 422 with the negotiation error. It fails on
the old 400 and passes on the fix. Full suite green (8 passed), pre-commit clean.

Note (not changed here)

The registry also lists the code as lowercase version_unsupported, while the
server (and the a2a business_agent resolver) emit VERSION_UNSUPPORTED. Since
the casing is shared across both reference implementations, I left it untouched
to avoid an inconsistent partial change — happy to align both if you'd like it in
a follow-up.

The overview.md error registry maps version_unsupported to REST 422, but the
version-negotiation check in dependencies.py raised HTTP 400. Return 422 so a
platform can distinguish a negotiation failure from a generic bad request.

Adds a test asserting a future UCP-Agent version yields 422 with the structured
negotiation error.
@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Jul 22, 2026
@damaz91

damaz91 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Thanks for opening this, we addressed this already in #137 so I'm closing this!

@damaz91 damaz91 closed this Jul 23, 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.

3 participants