Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] IndexInfo API moved from Agent Client to Vald Client #302

Merged
merged 5 commits into from
Jul 25, 2024
Merged

Conversation

hlts2
Copy link
Collaborator

@hlts2 hlts2 commented Jul 25, 2024

As titled

Summary by CodeRabbit

  • New Features

    • Introduced a new GitHub Actions workflow for automating project synchronization.
    • Added gRPC methods for enhanced index management, including IndexInfo and IndexDetail.
    • Implemented a new method, GetTimestamp, for retrieving vector metadata.
    • Updated API endpoints to allow dynamic parameterization for index creation.
  • Bug Fixes

    • Removed deprecated gRPC methods to streamline the service interface.
  • Tests

    • Added a new test class to validate the IndexInfo operation in the gRPC service.

Copy link

coderabbitai bot commented Jul 25, 2024

Warning

Rate limit exceeded

@hlts2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 40 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between bcb6195 and 50fad2f.

Walkthrough

Walkthrough

The changes introduce a new GitHub Actions workflow for automating the synchronization of the Vald project, enhancing CI processes. Significant modifications to the gRPC API include the removal of two methods in AgentGrpc, new endpoints for indexing operations in ValdAgent, and the introduction of new classes and methods for managing index data and timestamps. Additionally, test coverage is expanded with new tests for the IndexGrpc service.

Changes

Files Grouped Together Change Summary
.github/workflows/tmp-sync.yaml Introduces a GitHub Actions workflow for CI, automating repository sync, dependency installation, and code updates.
src/main/java/org/vdaas/vald/api/v1/agent/core/*.java Removes indexInfo and getTimestamp methods from AgentGrpc, impacting gRPC service functionality. Updates ValdAgent API methods to include path parameters for indexing operations.
src/main/java/org/vdaas/vald/api/v1/payload/*.java Introduces new interfaces and classes for detailed indexing structures, enhances Info and Object payloads by renaming and restructuring request classes for clarity.
src/main/java/org/vdaas/vald/api/v1/vald/*.java Adds new IndexGrpc service for index management and ValdIndex for protocol buffer registration. Introduces a new GetTimestamp method in ObjectGrpc to fetch timestamp metadata.
src/test/kotlin/org/vdaas/vald/client/E2ETests.kt Adds a new nested test class IndexTests for IndexInfo operation validation, adjusts order of existing tests for proper execution sequence.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHubActions
    participant ValdRepo
    participant CI
    participant ValdAgent
    participant IndexService

    User->>GitHubActions: Trigger Pull Request
    GitHubActions->>ValdRepo: Checkout Code
    GitHubActions->>CI: Install Dependencies
    GitHubActions->>CI: Build Project
    CI->>ValdAgent: Update Indices
    CI->>IndexService: Sync Index Info
    IndexService->>CI: Return Updated Index Info
    CI->>GitHubActions: Push Changes
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Outside diff range, codebase verification and nitpick comments (6)
src/main/java/org/vdaas/vald/api/v1/vald/IndexGrpc.java (1)

1-409: Integration Missing: IndexGrpc class and methods.

The IndexGrpc class and its methods (IndexInfo and IndexDetail) are not currently integrated or utilized in the codebase. Ensure that these methods are correctly referenced and used where necessary.

  • Verify that IndexGrpc and its methods are invoked in the appropriate parts of the codebase.
Analysis chain

New Addition: IndexGrpc class for index management.

The IndexGrpc class provides gRPC methods for index management, including IndexInfo and IndexDetail. The class follows the gRPC protocol and includes method descriptors, stubs, and service definitions.

However, ensure that the new class and its methods are correctly integrated and utilized in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `IndexGrpc` class and its methods in the codebase.

# Test: Search for the class and method usage. Expect: Correct integration and utilization.
rg --type java -A 5 $'IndexGrpc'

Length of output: 4227


Script:

#!/bin/bash
# Description: Verify the usage of the `IndexGrpc` class and its methods in the codebase.

# Test: Search for the usage of the `IndexGrpc` class and its methods.
rg --type java 'IndexGrpc'

Length of output: 1341

src/main/java/org/vdaas/vald/api/v1/agent/core/AgentGrpc.java (1)

Issues Found: Removal of indexInfo and getTimestamp Methods

The indexInfo and getTimestamp methods are still being referenced in other parts of the codebase, specifically in ObjectGrpc.java and IndexGrpc.java. Removing these methods from AgentGrpc without proper refactoring or updates can lead to broken functionality.

  • File: src/main/java/org/vdaas/vald/api/v1/vald/ObjectGrpc.java
  • File: src/main/java/org/vdaas/vald/api/v1/vald/IndexGrpc.java

Please ensure that the removal of these methods does not negatively impact the codebase and that any dependencies are updated accordingly.

Analysis chain

Line range hint 1-409:
Streamlining: Removal of indexInfo and getTimestamp methods.

The removal of the indexInfo and getTimestamp methods streamlines the AgentGrpc class by eliminating unused or unnecessary methods. This change may impact clients relying on these methods.

However, ensure that the removal does not negatively impact the codebase and that any dependencies are updated accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the removal of `indexInfo` and `getTimestamp` methods in the codebase.

# Test: Search for the method usage. Expect: No remaining dependencies or correct updates.
rg --type java -A 5 $'indexInfo|getTimestamp'

Length of output: 42673


Script:

#!/bin/bash
# Description: Verify if the removed methods `indexInfo` and `getTimestamp` from `AgentGrpc` are defined or used elsewhere in the codebase.

# Search for the definition and usage of `indexInfo` and `getTimestamp` in the context of `AgentGrpc`.
rg --type java -A 5 'AgentGrpc.*indexInfo|AgentGrpc.*getTimestamp'

Length of output: 68


Script:

#!/bin/bash
# Description: Verify if there are any remaining references to `indexInfo` and `getTimestamp` methods in the entire codebase.

# Search for any references to `indexInfo` and `getTimestamp` methods.
rg --type java -A 5 'indexInfo|getTimestamp'

Length of output: 42673

src/main/java/org/vdaas/vald/api/v1/payload/Info.java (4)

871-873: Ensure proper documentation for the new interface.

The interface DetailOrBuilder should have a brief description explaining its purpose.

/**
 * Interface for accessing detailed information about index counts and agent states.
 */
public interface DetailOrBuilder extends

882-883: Consider renaming getCountsCount for clarity.

The method name getCountsCount can be confusing. Consider renaming it to getCountOfCounts or getTotalCounts.

int getTotalCounts();

890-891: Clarify the containsCounts method.

The method containsCounts should have a clear description explaining its functionality.

/**
 * Checks if the counts map contains the specified key.
 * @param key the key to check for
 * @return true if the key exists, false otherwise
 */
boolean containsCounts(java.lang.String key);

956-958: Ensure proper documentation for the new class.

The class Detail should have a brief description explaining its purpose.

/**
 * Class representing detailed information about index counts and agent states.
 */
public static final class Detail extends
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7eda60c and bcb6195.

Files selected for processing (12)
  • .github/workflows/tmp-sync.yaml (1 hunks)
  • VALD_SHA (1 hunks)
  • src/main/java/org/vdaas/vald/api/v1/agent/core/AgentGrpc.java (8 hunks)
  • src/main/java/org/vdaas/vald/api/v1/agent/core/ValdAgent.java (1 hunks)
  • src/main/java/org/vdaas/vald/api/v1/payload/Info.java (1 hunks)
  • src/main/java/org/vdaas/vald/api/v1/payload/Object.java (10 hunks)
  • src/main/java/org/vdaas/vald/api/v1/payload/ValdPayload.java (6 hunks)
  • src/main/java/org/vdaas/vald/api/v1/vald/IndexGrpc.java (1 hunks)
  • src/main/java/org/vdaas/vald/api/v1/vald/ObjectGrpc.java (8 hunks)
  • src/main/java/org/vdaas/vald/api/v1/vald/ValdIndex.java (1 hunks)
  • src/main/java/org/vdaas/vald/api/v1/vald/ValdObject.java (2 hunks)
  • src/test/kotlin/org/vdaas/vald/client/E2ETests.kt (10 hunks)
Files skipped from review due to trivial changes (1)
  • VALD_SHA
Additional comments not posted (33)
src/main/java/org/vdaas/vald/api/v1/vald/ValdIndex.java (1)

1-53: File is correctly generated.

This file is generated by the protocol buffer compiler. No manual changes are needed.

src/main/java/org/vdaas/vald/api/v1/agent/core/ValdAgent.java (1)

29-37: Changes approved.

The modifications to include the {pool_size} parameter in the CreateIndex and CreateAndSaveIndex methods enhance the flexibility and configurability of the API.

.github/workflows/tmp-sync.yaml (1)

1-78: Workflow is well-defined.

The GitHub Actions workflow for synchronizing the Vald project is well-defined and covers all necessary steps. Ensure that the secrets used in the workflow are correctly configured in the repository settings.

src/main/java/org/vdaas/vald/api/v1/vald/ValdObject.java (1)

39-41: Enhancement: Addition of GetTimestamp method.

The GetTimestamp method enhances the functionality by allowing retrieval of timestamps associated with an object.

However, ensure that the new method is correctly integrated and utilized in the codebase.

Verification successful

Verified: Correct integration and utilization of GetTimestamp method.

The GetTimestamp method is correctly integrated and utilized within the ObjectGrpc class, ensuring it is available for gRPC calls.

  • ObjectGrpc.java: Method descriptors, stubs, and server call implementations for GetTimestamp.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `GetTimestamp` method in the codebase.

# Test: Search for the method usage. Expect: Correct integration and utilization.
rg --type java -A 5 $'GetTimestamp'

Length of output: 7777

src/main/java/org/vdaas/vald/api/v1/vald/ObjectGrpc.java (5)

145-147: LGTM!

The declaration of the method descriptor for GetTimestamp looks correct.


148-174: LGTM!

The method descriptor for GetTimestamp is correctly defined with a synchronized block to ensure thread safety.


267-275: LGTM!

The method getTimestamp is correctly defined in the AsyncService interface with a clear description of its purpose.


354-364: LGTM!

The method getTimestamp is correctly defined in the ObjectStub class to handle asynchronous unary calls.


417-425: LGTM!

The method getTimestamp is correctly defined in the ObjectBlockingStub class to handle blocking unary calls.

src/test/kotlin/org/vdaas/vald/client/E2ETests.kt (5)

33-33: LGTM!

The import statement for IndexGrpc is necessary and looks correct.


234-235: LGTM!

The nested test class IndexTests is correctly defined.


236-244: LGTM!

The setup method setUp is correctly defined to initialize the gRPC stubs.


246-249: LGTM!

The teardown method tearDown is correctly defined to clean up resources.


251-258: LGTM!

The test method indexInfo is correctly defined to test the indexInfo operation and includes assertions for expected values.

src/main/java/org/vdaas/vald/api/v1/payload/ValdPayload.java (6)

254-254: Descriptor name change looks good.

The descriptor name has been updated to a more general name, which improves clarity.


257-257: Field accessor table name change looks good.

The field accessor table name has been updated to match the new descriptor name, ensuring consistency.


353-354: Descriptor name change looks good.

The descriptor name has been updated to reflect a more detailed representation, which improves clarity.


356-357: Field accessor table name change looks good.

The field accessor table name has been updated to match the new descriptor name, ensuring consistency.


359-360: Descriptor name change looks good.

The descriptor name has been updated to reflect a more detailed representation, which improves clarity.


361-362: Field accessor table name change looks good.

The field accessor table name has been updated to match the new descriptor name, ensuring consistency.

src/main/java/org/vdaas/vald/api/v1/payload/Object.java (10)

4854-4855: Renaming Interface: TimestampRequestOrBuilder

The renaming of the interface from GetTimestampRequestOrBuilder to TimestampRequestOrBuilder is appropriate and aligns with the new naming convention.


4890-4901: Renaming Class: TimestampRequest

The renaming of the class from GetTimestampRequest to TimestampRequest is appropriate and aligns with the new naming convention. The constructor implementation is correct.


5003-5006: Updating equals Method

The equals method correctly compares instances of TimestampRequest after the renaming.


5033-5097: Updating parseFrom Methods

The parseFrom methods correctly parse instances of TimestampRequest after the renaming.


5110-5110: Updating newBuilder Methods

The newBuilder methods correctly create instances of TimestampRequest after the renaming.


5130-5149: Renaming Builder Class: TimestampRequest

The renaming of the Builder class from GetTimestampRequest to TimestampRequest is appropriate and aligns with the new naming convention. The implementation is correct.


5180-5205: Updating build and buildPartial Methods

The build and buildPartial methods correctly create instances of TimestampRequest after the renaming.


5251-5260: Updating mergeFrom Methods

The mergeFrom methods correctly merge instances of TimestampRequest after the renaming.


5483-5499: Updating DEFAULT_INSTANCE and PARSER

The DEFAULT_INSTANCE and PARSER are correctly implemented for TimestampRequest after the renaming.


5518-5528: Updating parser and getParserForType Methods

The parser and getParserForType methods correctly return the parser for TimestampRequest after the renaming.

src/main/java/org/vdaas/vald/api/v1/payload/Info.java (3)

895-897: Avoid using deprecated methods.

The method getCounts is marked as deprecated. Ensure that it is necessary and document the reason for its use.

/**
 * @deprecated Use {@link #getCountsMap()} instead.
 */
@java.lang.Deprecated
java.util.Map<java.lang.String, org.vdaas.vald.api.v1.payload.Info.Index.Count> getCounts();

914-918: Ensure nullable annotations are consistent.

The getCountsOrDefault method uses nullable annotations. Ensure that these annotations are consistent across the codebase.

/* nullable */
org.vdaas.vald.api.v1.payload.Info.Index.Count getCountsOrDefault(
    java.lang.String key,
    /* nullable */
    org.vdaas.vald.api.v1.payload.Info.Index.Count defaultValue);

1001-1010: Ensure proper initialization of default entry.

The CountsDefaultEntryHolder should ensure that the default entry is correctly initialized to avoid potential issues.

private static final class CountsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.String, org.vdaas.vald.api.v1.payload.Info.Index.Count> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.String, org.vdaas.vald.api.v1.payload.Info.Index.Count>newDefaultInstance(
                org.vdaas.vald.api.v1.payload.ValdPayload.internal_static_payload_v1_Info_Index_Detail_CountsEntry_descriptor,
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.MESSAGE,
                org.vdaas.vald.api.v1.payload.Info.Index.Count.getDefaultInstance());
}

@hlts2 hlts2 requested review from kmrmt, kpango and datelier July 25, 2024 12:23
@hlts2 hlts2 self-assigned this Jul 25, 2024
@kpango kpango merged commit 110fce4 into main Jul 25, 2024
5 checks passed
@kpango kpango deleted the fix/e2e branch July 25, 2024 12:53
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.

3 participants