Skip to content

Conversation

@feeblefakie
Copy link
Contributor

This is an automated backport of the following:

Please merge this PR after all checks have passed.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @feeblefakie, 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 backports a significant feature that enables the creation of namespaces within the system. It involves a full-stack implementation, from new RPC definitions and client-side service methods to robust server-side logic for managing namespace persistence and validation. The changes ensure that users can programmatically define and utilize isolated environments for their data and contracts, enhancing the system's multi-tenancy and organizational capabilities.

Highlights

  • Namespace Creation Feature: This pull request introduces the ability to create namespaces within the system, enabling better organization and isolation of data and contracts.
  • API and Client-Side Integration: New RPC methods for createNamespace have been added to LedgerPrivileged, AuditorPrivileged, and GatewayPrivileged services, along with corresponding client-side service methods and handlers to facilitate namespace creation requests.
  • Server-Side Logic and Persistence: A new NamespaceManager and NamespaceRegistry have been implemented, backed by ScalarDB, to handle the creation and persistence of namespaces, including the dynamic creation of necessary tables for each new namespace.
  • Error Handling and Validation: Several new error codes and status codes related to namespace operations (e.g., INVALID_NAMESPACE_NAME, NAMESPACE_ALREADY_EXISTS) have been introduced, and validation logic ensures proper namespace naming conventions.
  • Modular Database Table Management: A TableMetadataProvider interface and its implementations were added to allow different database components (e.g., ScalarTransactionManager, ScalarCertificateRegistry) to declare their required table schemas, which are then used by the NamespaceRegistry to create tables for new namespaces.
  • Comprehensive Testing: Extensive unit and integration tests have been added for the new namespace creation functionality, covering various scenarios including valid and invalid inputs, existing namespaces, and retry mechanisms for database operations.
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
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 backports the namespace creation feature. The changes are extensive, touching client, server, and common components, and appear to be well-structured. The introduction of TableMetadataProvider and the use of Guice's Multibinder for dynamic table creation is a solid design. The code is clean and includes new tests for the added functionality. I have one suggestion to improve the robustness of the new NamespaceManager.

Comment on lines +38 to +43
public void create(@Nonnull String namespace) {
if (!isValidNamespaceName(namespace)) {
throw new LedgerException(CommonError.INVALID_NAMESPACE_NAME, namespace);
}
registry.create(namespace);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The create method is a public API and should validate its arguments. While the @Nonnull annotation is present, it doesn't provide a runtime guarantee. A null value for namespace would cause a NullPointerException in isValidNamespaceName when matcher(namespace) is called. It's a good practice to add a checkNotNull(namespace) at the beginning of the method to ensure robustness, especially since checkNotNull is already used in the constructor of this class.

For example:

  public void create(@Nonnull String namespace) {
    checkNotNull(namespace);
    if (!isValidNamespaceName(namespace)) {
      throw new LedgerException(CommonError.INVALID_NAMESPACE_NAME, namespace);
    }
    registry.create(namespace);
  }

@jnmt jnmt merged commit 269efb5 into 3 Dec 3, 2025
11 checks passed
@jnmt jnmt deleted the 3-pull-322 branch December 3, 2025 08:20
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