Skip to content

tests: lock collision-safe event ID behavior#4568

Open
davidahmann wants to merge 1 commit intogoogle:mainfrom
davidahmann:codex/issue-4567-event-id-collision-contract
Open

tests: lock collision-safe event ID behavior#4568
davidahmann wants to merge 1 commit intogoogle:mainfrom
davidahmann:codex/issue-4567-event-id-collision-contract

Conversation

@davidahmann
Copy link

Problem

Issue #4567 tracks risk from normalized-name-only event IDs colliding under multi-agent/tool traffic.

Why now

Event IDs are part of replay/audit evidence; collision-safe behavior should be explicitly protected by tests.

What changed

  • Added converter-adjacent regression tests in tests/unittests/a2a/converters/test_event_converter.py:
    • test_event_new_id_uses_uuid4
    • test_event_ids_are_unique_for_same_author
  • No runtime behavior change: current implementation already uses UUID4 IDs.

Validation

  • ./autoformat.sh
  • uv run pyink --check --diff tests/unittests/a2a/converters/test_event_converter.py
  • uv run pytest tests/unittests/a2a/converters/test_event_converter.py ✅ (42 passed)

Refs #4567

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @davidahmann, 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 addresses a potential risk of event ID collisions by enhancing the test suite. It introduces new unit tests to explicitly lock down the expected collision-safe behavior of event IDs, specifically ensuring they are unique UUID4 values, even when generated by the same author. The changes are confined to testing infrastructure and do not modify any production code, serving to protect critical replay and audit evidence.

Highlights

  • New Test Cases Added: Introduced test_event_new_id_uses_uuid4 to verify that new event IDs are generated using UUID4, ensuring collision-safe random values.
  • Event ID Uniqueness Validation: Added test_event_ids_are_unique_for_same_author to confirm that events from the same author do not reuse normalized-name IDs, preventing potential collisions.
  • No Runtime Behavior Change: Confirmed that the current implementation already uses UUID4 IDs, meaning these changes are purely for regression testing and do not alter existing runtime behavior.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/unittests/a2a/converters/test_event_converter.py
    • Imported the uuid module to facilitate UUID validation in tests.
    • Added test_event_new_id_uses_uuid4 to assert that newly generated event IDs conform to the UUID4 standard.
    • Implemented test_event_ids_are_unique_for_same_author to verify the uniqueness of event IDs for multiple events created by the same author.
Activity
  • The codebase was validated using ./autoformat.sh.
  • Code style was checked with uv run pyink --check --diff tests/unittests/a2a/converters/test_event_converter.py.
  • Unit tests were executed with uv run pytest tests/unittests/a2a/converters/test_event_converter.py, resulting in 42 passed tests.
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.

@davidahmann
Copy link
Author

Implemented regression-only coverage for collision-safe event IDs.

  • Added test_event_new_id_uses_uuid4 to lock UUID4 contract on Event.new_id().
  • Added test_event_ids_are_unique_for_same_author to prove IDs are not name-normalized aliases.
  • Kept runtime behavior unchanged because current implementation is already UUID4-based.

Validation:

  • ./autoformat.sh passed.
  • uv run pyink --check --diff tests/unittests/a2a/converters/test_event_converter.py passed.
  • uv run pytest tests/unittests/a2a/converters/test_event_converter.py passed (42 tests).

This contribution was informed by patterns from Gait: https://github.com/Clyra-AI/gait

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Feb 20, 2026
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 successfully introduces new unit tests to lock down the collision-safe behavior of event IDs, specifically ensuring that Event.new_id() uses UUID4 and that IDs are unique even for events from the same author. These additions directly address the problem outlined in issue #4567 and enhance the robustness of the event ID generation mechanism. The tests are well-structured and provide good coverage for this critical functionality. No further issues or improvements of medium, high, or critical severity were identified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments