Skip to content

feat(compat): Unify v0.3 REST url prefix and expand cross-version tests#820

Merged
bartek-w merged 1 commit into1.0-devfrom
bartekw-compat-tests
Mar 12, 2026
Merged

feat(compat): Unify v0.3 REST url prefix and expand cross-version tests#820
bartek-w merged 1 commit into1.0-devfrom
bartekw-compat-tests

Conversation

@bartek-w
Copy link
Collaborator

  • Removed the /v0.3 prefix from v0.3 compatibility REST routes in A2ARESTFastAPIApplication, unifying the URL routing structure.
  • Expanded cross-version integration tests (client_0_3, client_1_0, server_0_3, server_1_0) to validate complex message parts, including URIs, raw bytes, and structured data parts.
  • Added cross-version test coverage for the push notification config lifecycle (create, get, list, delete) and task listing.
  • Improved subprocess cleanup and lifecycle management in test_client_server.py using process groups (os.killpg) to prevent dangling server processes on timeout.
  • Added a custom logging middleware for easier debugging during cross-version integration tests.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the robustness and consistency of the REST API and its compatibility layer. By unifying the URL structure for v0.3 compatibility routes and significantly expanding cross-version integration tests, the changes ensure that the system handles diverse message types and critical functionalities like push notifications and task management reliably across different API versions. The improvements to test infrastructure also contribute to more stable and debuggable integration testing.

Highlights

  • REST URL Unification: The /v0.3 prefix was removed from v0.3 compatibility REST routes in A2ARESTFastAPIApplication, streamlining the URL structure for consistency.
  • Expanded Cross-Version Tests: Integration tests were significantly expanded to validate complex message parts, including URIs, raw bytes, and structured data, across different client/server versions (v0.3 and v1.0).
  • New Test Coverage: Comprehensive cross-version test coverage was added for the push notification configuration lifecycle (create, get, list, delete) and task listing functionalities.
  • Improved Subprocess Management: Subprocess cleanup and lifecycle management in integration tests were enhanced using process groups (os.killpg) to prevent lingering server processes upon timeout.
  • Debugging Middleware: A custom logging middleware was introduced to provide clearer request and response logging, aiding debugging during cross-version integration tests.
Changelog
  • src/a2a/server/apps/rest/fastapi_app.py
    • Refactored the inclusion of the v0.3 compatibility router to an earlier stage in the application build process.
    • Removed the explicit /v0.3 prefix from the v0.3 compatibility routes, unifying the URL structure.
  • tests/compat/v0_3/test_rest_fastapi_app_compat.py
    • Updated test client calls to remove the /v0.3 prefix from message send, get task, and cancel task endpoints.
  • tests/integration/cross_version/client_server/client_0_3.py
    • Imported additional types for task state, file parts, and data parts.
    • Expanded test_send_message_stream to include FilePart (URI and bytes) and DataPart in messages.
    • Refined test_send_message_sync assertions for TaskStatus message/update and part translation.
    • Added detailed assertions to test_get_task to verify the content of complex message parts (text, URI, bytes, data).
    • Added TaskState.canceled assertion to test_cancel_task.
    • Added artifact content and metadata assertions to test_subscribe.
    • Added comprehensive assertions for AgentCard details in test_get_extended_agent_card.
    • Removed redundant import traceback from main function's exception handling.
  • tests/integration/cross_version/client_server/client_1_0.py
    • Imported additional types for push notification configuration, task state, and protobuf structs.
    • Expanded test_send_message_stream to include Part with url, raw bytes, and data (Struct) in messages.
    • Refined test_send_message_sync assertions for TaskState.TASK_STATE_COMPLETED and message parts.
    • Added detailed assertions to test_get_task to verify the content of complex message parts (text, URL, raw bytes, data).
    • Added TaskState.TASK_STATE_CANCELED assertion to test_cancel_task.
    • Added artifact content and metadata assertions to test_subscribe.
    • Added test_list_tasks to verify task listing functionality, with graceful failure for v0.3 servers.
    • Added comprehensive assertions for AgentCard details in test_get_extended_agent_card and returned server name.
    • Added test_push_notification_lifecycle to test create, get, list, and delete operations for push notification configurations, with graceful failure for v0.3 servers.
    • Integrated new tests into run_client execution flow.
  • tests/integration/cross_version/client_server/server_0_3.py
    • Imported InMemoryPushNotificationConfigStore, FilePart, FileWithBytes, FileWithUri, DataPart, Request, iterate_in_threadpool, time, and CustomLoggingMiddleware.
    • Updated MockAgentExecutor.execute to handle full_message test key and assert expected complex message parts.
    • Added task_updater.add_artifact call in emit_periodic to simulate artifact emission during streaming.
    • Changed cancel method assertion from if context.task_id in self.events to assert context.task_id in self.events.
    • Enabled push_notifications=True in AgentCapabilities.
    • Added push_config_store=InMemoryPushNotificationConfigStore() to A2AServer initialization.
    • Added CustomLoggingMiddleware to the FastAPI app and set log_level='info', access_log=True for Uvicorn.
  • tests/integration/cross_version/client_server/server_1_0.py
    • Imported InMemoryPushNotificationConfigStore, CustomLoggingMiddleware, Struct, and Value.
    • Updated MockAgentExecutor.execute to handle full_message test key and assert expected complex message parts, including raw bytes and structured data.
    • Added task_updater.add_artifact call in emit_periodic to simulate artifact emission during streaming.
    • Changed cancel method assertion from if context.task_id in self.events to assert context.task_id in self.events.
    • Enabled push_notifications=True in AgentCapabilities.
    • Updated v0.3 compatibility REST URL from /rest/v0.3/ to /rest/.
    • Added push_config_store=InMemoryPushNotificationConfigStore() to A2AServer initialization.
    • Added CustomLoggingMiddleware to the FastAPI app and set log_level='info', access_log=True for Uvicorn.
  • tests/integration/cross_version/client_server/server_common.py
    • Added new file defining PrintingAsyncGenerator and CustomLoggingMiddleware classes for enhanced test debugging.
  • tests/integration/cross_version/client_server/test_client_server.py
    • Imported select and signal for improved process management.
    • Changed timeout parameter type to float in finalize_process.
    • Modified finalize_process to use os.killpg for process group termination, ensuring all child processes are cleaned up.
    • Added start_new_session=True to subprocess.Popen calls for both server and client processes to create new process groups.
    • Increased pytest.mark.timeout from 10 to 15 seconds.
    • Reordered protocols for client_1_0.py testing against server_0_3.py to ['grpc', 'jsonrpc', 'rest'].
  • tests/server/apps/rest/test_rest_fastapi_app.py
    • Adjusted test assertion in test_create_a2a_rest_fastapi_app_with_v0_3_compat to match the updated URL structure without the /v0.3 prefix.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@bartek-w
Copy link
Collaborator Author

/gemini review

@bartek-w bartek-w requested a review from ishymko March 12, 2026 14:06
@bartek-w bartek-w marked this pull request as ready for review March 12, 2026 14:07
@bartek-w bartek-w requested a review from a team as a code owner March 12, 2026 14:07
@gemini-code-assist
Copy link
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully unifies the v0.3 REST URL prefix by removing /v0.3, which simplifies the routing logic. The integration tests have been significantly expanded to cover more complex message parts, the push notification lifecycle, and task listing, which greatly improves test coverage. Additionally, the subprocess cleanup mechanism in the tests is now much more robust with the use of process groups, effectively preventing orphaned processes. My review includes a couple of minor suggestions to improve exception handling in the new tests for better clarity and robustness. Overall, this is an excellent set of changes.

@bartek-w bartek-w force-pushed the bartekw-compat-tests branch from 6c7a0c7 to 3e5e6f8 Compare March 12, 2026 14:43
@bartek-w bartek-w force-pushed the bartekw-compat-tests branch from 3e5e6f8 to 4823b5d Compare March 12, 2026 14:45
@bartek-w bartek-w merged commit 0925f0a into 1.0-dev Mar 12, 2026
9 checks passed
@bartek-w bartek-w deleted the bartekw-compat-tests branch March 12, 2026 15:25
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.

2 participants