Skip to content

feat(server): match media ranges such as image/* in validate_input_modes - #1469

Open
miinimal wants to merge 1 commit into
a2aproject:mainfrom
miinimal:feat/input-mode-media-ranges
Open

miinimal wants to merge 1 commit into
a2aproject:mainfrom
miinimal:feat/input-mode-media-ranges

Conversation

@miinimal

Copy link
Copy Markdown

Description

With validate_input_modes=True, a card that declares a media range such as image/* rejected every concrete image type, because the validator compared type/subtype literally. This was the question left open in #1425, and it breaks cards built by other SDKs: Microsoft Agent Framework's A2A hosting adapter documents image/* modes and returns a native AgentCard for use with this SDK's handlers, so the same card accepts image/png there and rejects it here (reproduction in #1468).

A declared type/* now matches any part of that type, and */* matches any part (RFC 9110 section 12.5.1). Everything from #1425 stays: case-insensitive, parameters ignored, parts without media_type unchecked. Exact declarations behave as before, and image/* still rejects video/mp4.

$ uv run pytest tests/utils/test_input_mode_validator.py   # fix reverted, new tests kept
5 failed, 18 passed
$ uv run pytest tests/utils/test_input_mode_validator.py   # with the fix
23 passed
$ uv run pytest --cov=src
src/a2a/utils/input_mode_validator.py   100%
TOTAL   94%
$ ./scripts/lint.sh
SUCCESS: All linting and formatting tasks complete!

The full local run was on Windows, where 4 failures and 8 errors in tests/integration/ (cross-version client/server, push notifications, samples smoke) also happen on unmodified main; they start subprocess servers and are unrelated to this change. CI covers them on Linux.

AI assistance: the analysis, the change and the tests were prepared with an AI coding assistant; I reviewed the diff and ran the checks above.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (if necessary)
    • The validate_input_modes docstring now states how media ranges match.

Fixes #1468 🦕

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/cluster/database_event_stream.py 97.27% 93.64% 🔴 -3.64%
Total 93.67% 93.63% 🔴 -0.03%

Generated by coverage-comment.yml

@miinimal
miinimal marked this pull request as ready for review November 13, 2026 23:13
@miinimal
miinimal requested a review from a team as a code owner November 13, 2026 23:13

This branch has not been deployed

No deployments
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.

[Feat]: validate_input_modes: match media ranges such as image/* declared in the agent card

1 participant