Repository navigation
fix(compat): percent-encode ids in v0.3 REST transport paths - #1458
Merged
Iwaniukooo11 merged 2 commits intoNov 13, 2026
Merged
Conversation
CompatRestTransport put task ids and push notification config ids into
URL paths as raw text, so an id containing '#', '?' or '%' reached a
different resource: getting the push config 'alerts#ops' returned the
config 'alerts', and get_task('t1?x') returned task 't1'.
Encode each id with urllib.parse.quote(safe='') as RestTransport does
since a2aproject#1436.
Fixes a2aproject#1457
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/compat/v0_3/rest_transport.py | 95.73% | 95.78% | 🟢 +0.05% |
| src/a2a/server/request_handlers/default_request_handler_v2.py | 88.34% | 88.60% | 🟢 +0.26% |
| Total | 93.59% | 93.60% | 🟢 +0.01% |
Generated by coverage-comment.yml
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.
Description
CompatRestTransport(the v0.3 REST client) put task ids and push notification config ids into URL paths as raw text. An id containing#,?or%then reached a different resource: getting the push configalerts#opsreturned the configalerts, andget_task('t1?x')returned taskt1. #1436 fixed this forRestTransport; the v0.3 client was not covered.This PR encodes each id with
urllib.parse.quote(value, safe=''), the same helperRestTransportuses, at the six path sites (get_task,cancel_task,subscribe, and push config create, get and list). Ids without reserved characters produce the same URL as before.Tests:
TestCompatRestTransportPathEncodingintests/compat/v0_3/test_rest_transport.pyruns a realDefaultRequestHandlerbehindcreate_rest_routes(..., enable_v0_3_compat=True)throughhttpx.ASGITransport. One test createsalertsandalerts#opsand checks that gettingalerts#opsreturns that config. The other checks thatget_task('t1?x')does not return taskt1.ruff check,ruff formatandty checkpass on the changed files.This change was written with Claude Code.
CONTRIBUTINGGuide.bash scripts/format.shfrom the repository root to format)Fixes #1457 🦕
🤖 Generated with Claude Code