Skip to content

fix: use UUIDv7 in type ID generators#102

Merged
yarolegovich merged 3 commits intomainfrom
yarolegovich/uuid-v7
Nov 13, 2025
Merged

fix: use UUIDv7 in type ID generators#102
yarolegovich merged 3 commits intomainfrom
yarolegovich/uuid-v7

Conversation

@yarolegovich
Copy link
Copy Markdown
Member

Index updates are generally more efficient if new entries have increasing IDs.
v7 has a time-based prefix and works much better than v4 in terms of the number of index rebalancing on insert.

re #101

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yarolegovich, 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 optimizing database index performance by transitioning key identifier generation mechanisms from UUIDv4 to UUIDv7. By leveraging the time-ordered nature of UUIDv7, the changes aim to reduce the overhead associated with index rebalancing during data insertions, leading to more efficient data storage and retrieval. It also includes a minor cleanup in UUID generation for JSON-RPC requests.

Highlights

  • Migration to UUIDv7 for Core IDs: Several identifier generation functions, including NewMessageID, NewTaskID, NewContextID, and NewArtifactID in a2a/core.go, as well as newID() in a2asrv/push/store.go, have been updated to generate UUIDv7 instead of UUIDv4.
  • Improved Index Performance: The primary motivation for adopting UUIDv7 is to enhance the efficiency of database index updates. UUIDv7's time-based prefix ensures that new IDs are generally increasing, which can significantly reduce index rebalancing operations on insertion compared to random UUIDv4s.
  • New Helper Function for UUIDv7: A new private helper function, newUUIDString(), has been introduced in a2a/core.go to centralize and encapsulate the logic for generating UUIDv7 strings.
  • Minor UUID Generation Refactor: In a2aclient/jsonrpc.go, the method for generating UUIDs for JSON-RPC request IDs was simplified from uuid.New().String() to uuid.NewString(). This change is a minor refactor and continues to use UUIDv4, not UUIDv7.
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.

Copy link
Copy Markdown
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 updates various ID generators to use UUIDv7 instead of UUIDv4, which is a good performance optimization for indexed database records. The changes are well-implemented. I've provided a couple of suggestions to improve maintainability by reducing code duplication and to update comments for accuracy. Specifically, I recommend creating a single exported helper function for UUIDv7 generation to be reused across packages.

@yarolegovich yarolegovich requested a review from ishymko November 13, 2025 12:58
@yarolegovich yarolegovich merged commit 3a809ea into main Nov 13, 2025
4 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/uuid-v7 branch November 13, 2025 13:30
yarolegovich pushed a commit that referenced this pull request Nov 13, 2025
🤖 I have created a release *beep* *boop*
---


## [0.3.1](v0.3.0...v0.3.1)
(2025-11-13)


### Bug Fixes

* nil meta becomes empty struct in send message conversion
([#105](#105))
([60d3fcb](60d3fcb))
* remove keep-alive messages
([#100](#100))
([493e497](493e497))
* use UUIDv7 in type ID generators
([#102](#102))
([3a809ea](3a809ea)),
closes [#101](#101)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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