Skip to content

feat: Add ITK test suite#868

Open
kdziedzic70 wants to merge 1 commit into1.0-devfrom
itk-fresh-setup
Open

feat: Add ITK test suite#868
kdziedzic70 wants to merge 1 commit into1.0-devfrom
itk-fresh-setup

Conversation

@kdziedzic70
Copy link

@kdziedzic70 kdziedzic70 commented Mar 19, 2026

Description

The PR adds:

  • implementation of itk testing agent for "current" branch
  • deployment of itk system
  • execution of compatibility tests with stable sdks (python-v10, python-v03, go-v10, go-v03)
  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@kdziedzic70 kdziedzic70 requested a review from a team as a code owner March 19, 2026 11:51
@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 introduces a comprehensive test suite for the Instruction-to-Knowledge (ITK) system. It establishes a new ITK agent written in Python, configures its dependencies, and provides a robust script to automate its deployment and execution. The primary goal is to ensure backward and forward compatibility of the current Python SDK with various stable SDK versions by running a series of predefined compatibility tests, thereby validating the system's interoperability across different protocols.

Highlights

  • ITK Testing Agent Implementation: Implemented an ITK (Instruction-to-Knowledge) testing agent for the 'current' branch, capable of processing instructions, calling other agents, and managing task states.
  • ITK System Deployment: Introduced a mechanism for deploying the ITK system, including Docker image creation and container orchestration.
  • Compatibility Test Execution: Enabled the execution of compatibility tests against stable SDKs, specifically python-v10, python-v03, go-v10, and go-v03, across JSONRPC, gRPC, and HTTP_JSON protocols.
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.

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.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

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

The pull request introduces an ITK (Interoperability Test Kit) test suite, including an agent implementation, deployment script, and project configuration. The Python agent handles A2A messages, extracts instructions, and interacts with other agents via various transports. The deployment script automates the setup of the test environment using Docker and runs compatibility tests. Overall, the changes provide a good foundation for testing the A2A protocol's interoperability. Several areas for improvement have been identified, primarily concerning error handling, configuration flexibility, and script robustness.

itk/run_itk.sh Outdated
fi
cd a2a-samples
git fetch origin
git checkout implement-itk-service
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The script hardcodes the branch name implement-itk-service. This makes the script less reusable. Consider making this a variable that can be passed as an argument to the script, allowing it to test different branches or versions of a2a-samples.

Suggested change
git checkout implement-itk-service
git checkout "${A2A_SAMPLES_BRANCH:-implement-itk-service}"

raw = base64.b64decode(part.text)
inst = instruction_pb2.Instruction()
inst.ParseFromString(raw)
except Exception: # noqa: BLE001
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the previous comment, catching a generic Exception can obscure specific errors. Consider narrowing down the exception types to base64.binascii.Error and google.protobuf.message.DecodeError for more precise error handling.

Comment on lines +70 to +86
-H "Content-Type: application/json" \
-d '{
"tests": [
{
"name": "Star Topology (Full) - JSONRPC & GRPC",
"sdks": ["current", "python_v10", "python_v03", "go_v10", "go_v03"],
"traversal": "euler",
"edges": ["0->1", "0->2", "0->3", "0->4", "1->0", "2->0", "3->0", "4->0"],
"protocols": ["jsonrpc", "grpc"]
},
{
"name": "Star Topology (No Go v03) - HTTP_JSON",
"sdks": ["current", "python_v10", "python_v03", "go_v10"],
"traversal": "euler",
"edges": ["0->1", "0->2", "0->3", "1->0", "2->0", "3->0"],
"protocols": ["http_json"]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The JSON payload for the curl request is hardcoded within the script. For a comprehensive test suite, it would be more flexible to externalize these test configurations (e.g., into a JSON file) and have the script read and pass them. This allows for easier modification and expansion of test cases without altering the script logic.

# Some clients might send it as base64 in text part
raw = base64.b64decode(part.text)
inst.ParseFromString(raw)
except Exception: # noqa: BLE001
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Catching a broad Exception can hide unexpected issues and make debugging harder. It's generally better to catch more specific exceptions that you anticipate, such as google.protobuf.message.DecodeError for protobuf parsing failures, or base64.binascii.Error for base64 decoding issues. This helps in understanding the root cause of failures more quickly.

if message:
results.extend(part.text for part in message.parts if part.text)

except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

A broad except Exception as e can hide specific issues. Consider catching more specific exceptions that might occur during client communication, such as httpx.RequestError, grpc.aio.AioRpcError, or custom A2A client exceptions, to provide more targeted error handling and logging.

Comment on lines +248 to +277
url=f'127.0.0.1:{grpc_port}',
protocol_version='1.0',
),
AgentInterface(
protocol_binding=TransportProtocol.GRPC,
url=f'127.0.0.1:{grpc_port}',
protocol_version='0.3',
),
]

interfaces.append(
AgentInterface(
protocol_binding=TransportProtocol.JSONRPC,
url=f'http://127.0.0.1:{http_port}/jsonrpc/',
)
)
interfaces.append(
AgentInterface(
protocol_binding=TransportProtocol.HTTP_JSON,
url=f'http://127.0.0.1:{http_port}/rest/',
protocol_version='1.0',
)
)
interfaces.append(
AgentInterface(
protocol_binding=TransportProtocol.HTTP_JSON,
url=f'http://127.0.0.1:{http_port}/rest/',
protocol_version='0.3',
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The AgentInterface definitions for gRPC and HTTP_JSON are duplicated for different protocol versions (1.0 and 0.3) but use the same url. While this might be intentional for compatibility testing, it could be made more explicit or potentially refactored if the URLs are always expected to be the same for different versions of the same protocol binding. For example, a loop could generate these if the pattern is consistent.

instruction.proto

# Fix imports in generated file
sed -i 's/^import instruction_pb2 as instruction__pb2/from . import instruction_pb2 as instruction__pb2/' pyproto/instruction_pb2_grpc.py
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The sed command is a common workaround for fixing imports in generated protobuf files. While functional, it's a brittle solution. If possible, investigate if there's a way to configure grpc_tools.protoc to generate correct relative imports directly, or consider a more robust post-processing step if this is a recurring issue across projects.


# 4. Build jit itk_service docker image from root of a2a-samples/itk
# We run docker build from the itk directory inside a2a-samples
docker build -t itk_service a2a-samples/itk
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The Docker image name itk_service is hardcoded. For a more flexible testing setup, especially in CI/CD environments or when running multiple test instances, it would be beneficial to make this configurable, perhaps by adding a parameter to the script or using a dynamically generated name.

docker run -d --name itk-service \
-v "$A2A_PYTHON_ROOT:/app/agents/repo" \
-v "$ITK_DIR:/app/agents/repo/itk" \
-p 8000:8000 \
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The port 8000 is hardcoded for the Docker container. Similar to the agent's HTTP and gRPC ports, this should be configurable to avoid port conflicts and allow for more flexible testing scenarios.

Comment on lines +120 to +121
if selected_transport is None:
raise ValueError(f'Unsupported transport: {call.transport}')
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The selected_transport will never be None here because transport_map.get provides a default value (TransportProtocol.JSONRPC). This if condition is therefore redundant and can be removed.

Suggested change
if selected_transport is None:
raise ValueError(f'Unsupported transport: {call.transport}')
if not selected_transport:
raise ValueError(f'Unsupported transport: {call.transport}')
References
  1. If a field in a data model (e.g., ServerCallContext.user) is non-optional, avoid adding redundant checks for its existence and rely on the data model's contract.

@kdziedzic70 kdziedzic70 changed the title [WIP] [feat] Add ITK test suite feat: Add ITK test suite Mar 19, 2026
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.

1 participant