fix(rest/python): return 422 for version_unsupported#141
Closed
vishkaty wants to merge 1 commit into
Closed
Conversation
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.
Contributor
|
Thanks for opening this, we addressed this already in #137 so I'm closing this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The version-negotiation check in
rest/python/server/dependencies.pyraisedHTTP 400 when a platform requests a newer protocol version than the server
supports. The error registry in
docs/specification/overview.mdmapsversion_unsupportedto 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 futureUCP-Agentversion(
version="2999-01-01") now yields 422 with the negotiation error. It fails onthe 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 theserver (and the a2a
business_agentresolver) emitVERSION_UNSUPPORTED. Sincethe 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.