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 #132

Merged
merged 8 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 new gRPC client methods for retrieving index and object metadata.
    • Enhanced module functionality by adding v1_payload to the exported default object.
  • Improvements

    • Streamlined API by removing deprecated methods from the IAgentClient interface.
    • Updated HTTP routing paths and input/output types for service methods.
  • Bug Fixes

    • Resolved issues related to method availability in the client interfaces.
  • Tests

    • Added a new test suite for index operations to ensure functionality and reliability.

@hlts2 hlts2 self-assigned this Jul 25, 2024
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 7 minutes and 32 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 dffdb3f and e5a6ff9.

Walkthrough

Walkthrough

The recent changes introduce various enhancements and refactorings, primarily focusing on the vald service implementations. Key updates include the addition of new methods and interfaces for handling index operations, while some existing methods have been removed to streamline the API. Changes in the export structures across TypeScript and JavaScript files improve module accessibility and clarity. Additionally, a new testing suite has been established to ensure the functionality of index operations.

Changes

File(s) Change Summary
index.d.ts, index.js Added v1_payload to the exports, enhancing module accessibility; other exports updated for clarity.
src/.../agent/core/agent_pb.grpc-client.d.ts, src/.../agent/core/agent_pb.grpc-client.js Removed indexInfo and getTimestamp methods, simplifying the IAgentClient and AgentClient APIs.
src/.../agent/core/agent_pb.js Updated HTTP paths and input/output types for CreateIndex and CreateAndSaveIndex, enhancing service functionality.
src/.../payload/payload_pb.d.ts, src/.../payload/payload_pb.js Renamed Object_GetTimestampRequest to Object_TimestampRequest and added Info_Index_Detail class/interface for improved clarity.
src/.../vald/index_pb.d.ts, src/.../vald/index_pb.grpc-client.d.ts, src/.../vald/index_pb.grpc-client.js, src/.../vald/index_pb.js Introduced new types and methods for the Index service, including indexInfo and indexDetail.
src/.../vald/object_pb.grpc-client.d.ts, src/.../vald/object_pb.grpc-client.js, src/.../vald/object_pb.js Added getTimestamp method to the IObjectClient and ObjectClient for retrieving vector metadata.
tests/e2e.test.ts Introduced a new testing suite for index operations, importing IndexClient for testing purposes.

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 377fdac and c926112.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (16)
  • VALD_SHA (1 hunks)
  • index.d.ts (1 hunks)
  • index.js (1 hunks)
  • src/vald/v1/agent/core/agent_pb.grpc-client.d.ts (3 hunks)
  • src/vald/v1/agent/core/agent_pb.grpc-client.js (1 hunks)
  • src/vald/v1/agent/core/agent_pb.js (1 hunks)
  • src/vald/v1/payload/payload_pb.d.ts (4 hunks)
  • src/vald/v1/payload/payload_pb.js (4 hunks)
  • src/vald/v1/vald/index_pb.d.ts (1 hunks)
  • src/vald/v1/vald/index_pb.grpc-client.d.ts (1 hunks)
  • src/vald/v1/vald/index_pb.grpc-client.js (1 hunks)
  • src/vald/v1/vald/index_pb.js (1 hunks)
  • src/vald/v1/vald/object_pb.grpc-client.d.ts (3 hunks)
  • src/vald/v1/vald/object_pb.grpc-client.js (1 hunks)
  • src/vald/v1/vald/object_pb.js (1 hunks)
  • tests/e2e.test.ts (3 hunks)
Files skipped from review due to trivial changes (3)
  • VALD_SHA
  • index.js
  • src/vald/v1/vald/index_pb.d.ts
Additional context used
Biome
src/vald/v1/vald/index_pb.js

[error] 22-23: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

src/vald/v1/vald/index_pb.grpc-client.js

[error] 22-23: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

Additional comments not posted (42)
index.d.ts (2)

2-2: Import statement for v1_payload is correct.

The import statement is consistent with the existing import pattern.


6-6: Export statement for v1_payload is correct.

The export statement is consistent with the existing export pattern.

src/vald/v1/agent/core/agent_pb.js (2)

55-55: Verify the correctness of CreateIndex service method changes.

The HTTP path has been updated to include {pool_size} and the input type has been changed to payload_pb_2.Control_CreateIndexRequest. Ensure that the new path and input type are correctly implemented and consistent with the service definitions.


57-57: Verify the correctness of CreateAndSaveIndex service method changes.

The HTTP path has been updated to include {pool_size} and the input type has been changed to payload_pb_2.Control_CreateIndexRequest. Ensure that the new path and input type are correctly implemented and consistent with the service definitions.

src/vald/v1/vald/index_pb.js (2)

56-56: Verify the correctness of IndexInfo service method.

The IndexInfo service method has been added with the HTTP path /index/info. Ensure that the new service method is correctly implemented and consistent with the service definitions.


57-57: Verify the correctness of IndexDetail service method.

The IndexDetail service method has been added with the HTTP path /index/detail. Ensure that the new service method is correctly implemented and consistent with the service definitions.

src/vald/v1/vald/object_pb.js (6)

54-55: LGTM! Approved import changes.

The new payload types are imported correctly and will be used in the updated methods.


61-61: LGTM! Approved method Exists changes.

The method Exists uses the new payload type payload_pb_8.Object_ID correctly.


62-62: LGTM! Approved method GetObject changes.

The method GetObject uses the new payload types payload_pb_7.Object_VectorRequest and payload_pb_6.Object_Vector correctly.


63-63: LGTM! Approved method StreamGetObject changes.

The method StreamGetObject uses the new payload types payload_pb_7.Object_VectorRequest and payload_pb_5.Object_StreamVector correctly.


64-64: LGTM! Approved method StreamListObject changes.

The method StreamListObject uses the new payload types payload_pb_4.Object_List_Request and payload_pb_3.Object_List_Response correctly.


65-65: LGTM! Approved method GetTimestamp addition.

The new method GetTimestamp is added correctly and uses the appropriate payload types.

src/vald/v1/vald/index_pb.grpc-client.js (2)

65-68: LGTM! Approved method indexInfo implementation.

The method indexInfo is implemented correctly to get index information.


74-77: LGTM! Approved method indexDetail implementation.

The method indexDetail is implemented correctly to get detailed index information.

src/vald/v1/agent/core/agent_pb.grpc-client.js (2)

Line range hint 1-79: LGTM! Approved removal of method indexInfo.

The removal of the method indexInfo from the AgentClient class is consistent with the PR objectives.


Line range hint 1-79: LGTM! Approved removal of method getTimestamp.

The removal of the method getTimestamp from the AgentClient class is consistent with the PR objectives.

src/vald/v1/vald/index_pb.grpc-client.d.ts (5)

1-29: File header and imports look good.

The licensing information is correct and all necessary imports are included.


30-53: IIndexClient interface looks good.

The methods are correctly declared and aligned with the protobuf definitions.


59-61: IndexClient class constructor looks good.

The constructor is correctly implemented and follows best practices.


62-67: IndexClient.indexInfo method looks good.

The method is correctly implemented and handles all parameter combinations.


68-73: IndexClient.indexDetail method looks good.

The method is correctly implemented and handles all parameter combinations.

src/vald/v1/vald/object_pb.grpc-client.js (4)

Line range hint 1-29: File header and imports look good.

The licensing information is correct and all necessary imports are included.


Line range hint 30-35: ObjectClient class constructor looks good.

The constructor is correctly implemented and follows best practices.


Line range hint 36-95: Existing methods in ObjectClient class look good.

The methods are correctly implemented and follow best practices.


96-104: ObjectClient.getTimestamp method looks good.

The method is correctly implemented and follows best practices.

src/vald/v1/agent/core/agent_pb.grpc-client.d.ts (4)

Line range hint 1-16: File header and imports look good.

The licensing information is correct and all necessary imports are included.


Line range hint 17-33: IAgentClient interface looks good.

The remaining methods are correctly declared and aligned with the protobuf definitions. The removal of indexInfo and getTimestamp methods aligns with the PR objectives.


Line range hint 34-36: AgentClient class constructor looks good.

The constructor is correctly implemented and follows best practices.


Line range hint 37-66: Remaining methods in AgentClient class look good.

The methods are correctly implemented and follow best practices. The removal of indexInfo and getTimestamp methods aligns with the PR objectives.

src/vald/v1/vald/object_pb.grpc-client.d.ts (3)

25-26: Imports are necessary for the new method.

The import statements for Object_Timestamp and Object_TimestampRequest are necessary for the new getTimestamp method.


72-80: New method overloads enhance client interface functionality.

The addition of the getTimestamp method with multiple overloads in the IObjectClient interface provides flexibility for different combinations of parameters, enhancing the functionality of the client interface.


114-119: New method overloads enhance client class functionality.

The addition of the getTimestamp method with multiple overloads in the ObjectClient class provides flexibility for different combinations of parameters, enhancing the functionality of the client class.

tests/e2e.test.ts (2)

19-19: Import is necessary for the new testing suite.

The import statement for IndexClient from the index_pb.grpc-client module is necessary for the new testing suite for index operations.


207-226: New testing suite enhances testing capabilities.

The new testing suite for index operations, including setup and teardown procedures for the IndexClient, enhances the testing capabilities related to index operations.

src/vald/v1/payload/payload_pb.d.ts (6)

923-923: Renamed Object_GetTimestampRequest to Object_TimestampRequest.

The renaming improves clarity and aligns with the purpose of the interface.


2112-2116: Renamed Object_GetTimestampRequest$Type to Object_TimestampRequest$Type.

The renaming maintains consistency with the interface name change.


2119-2121: Renamed Object_GetTimestampRequest constant to Object_TimestampRequest.

The renaming maintains consistency with the interface and class name changes.


1260-1286: Added Info_Index_Detail interface.

The new interface provides a clear and organized way to handle detailed index counts for agents.


2312-2318: Added Info_Index_Detail$Type class.

The new class provides necessary serialization and deserialization functionality for the Info_Index_Detail interface.


2319-2322: Added Info_Index_Detail constant.

The new constant aligns with the interface and class additions, ensuring consistency.

src/vald/v1/payload/payload_pb.js (2)

2463-2465: Renaming is consistent.

The class Object_GetTimestampRequest has been renamed to Object_TimestampRequest and the associated exports have been updated. Ensure that all references to this class in the codebase are updated accordingly.

Verification successful

Renaming is consistent.

The class Object_GetTimestampRequest has been successfully renamed to Object_TimestampRequest and the associated references have been updated throughout the codebase.

  • src/vald/v1/vald/object_pb.js
  • src/vald/v1/payload/payload_pb.js
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to `Object_GetTimestampRequest` have been updated to `Object_TimestampRequest`.

# Test: Search for the old class name. Expect: No occurrences of the old class name.
rg --type js 'Object_GetTimestampRequest'

Length of output: 41


Script:

#!/bin/bash
# Description: Verify that the new class name `Object_TimestampRequest` is used correctly throughout the codebase.

# Test: Search for the new class name. Expect: Occurrences of the new class name.
rg --type js 'Object_TimestampRequest'

Length of output: 2793


3410-3491: New class Info_Index_Detail is well-defined.

The new class Info_Index_Detail has been added with properties counts, replica, and live_agents. The class is well-defined and follows best practices.

Ensure that the new class is correctly integrated and used within the codebase.

Verification successful

New class Info_Index_Detail is well-defined and properly integrated.

The new class Info_Index_Detail is referenced and used across multiple files, including index_pb.js, index_pb.grpc-client.d.ts, and payload_pb.d.ts. This indicates proper integration and usage within the codebase.

  • src/vald/v1/vald/index_pb.js
  • src/vald/v1/vald/index_pb.grpc-client.d.ts
  • src/vald/v1/payload/payload_pb.d.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and integration of the new class `Info_Index_Detail`.

# Test: Search for the usage of the new class. Expect: Proper integration and usage.
rg --type js 'Info_Index_Detail'

Length of output: 2743


Script:

#!/bin/bash
# Description: Verify the usage and integration of the new class `Info_Index_Detail` in index_pb.js.

# Test: Search for the usage of the new class within index_pb.js. Expect: Proper integration and usage.
rg 'Info_Index_Detail' src/vald/v1/vald/index_pb.js -A 10

Length of output: 205


Script:

#!/bin/bash
# Description: Verify the usage and integration of the new class `Info_Index_Detail` across the repository.

# Test: Search for any additional references to the new class within the repository. Expect: Proper integration and usage.
rg 'Info_Index_Detail'

Length of output: 4758

src/vald/v1/vald/index_pb.js Show resolved Hide resolved
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c926112 and dffdb3f.

Files selected for processing (2)
  • src/vald/v1/vald/index.d.ts (2 hunks)
  • src/vald/v1/vald/index.js (1 hunks)
Additional comments not posted (3)
src/vald/v1/vald/index.js (1)

7-8: New exports added for index and index_grpc.

The new exports follow the same pattern as the existing ones, ensuring consistency in the module's structure.

src/vald/v1/vald/index.d.ts (2)

7-8: New imports added for index and index_grpc.

The new imports follow the same pattern as the existing ones, ensuring consistency in the module's structure.


24-25: New exports added for index and index_grpc.

The new exports follow the same pattern as the existing ones, ensuring consistency in the module's structure.

@hlts2 hlts2 requested a review from kpango July 25, 2024 10:05
@hlts2 hlts2 requested review from kmrmt and datelier July 25, 2024 12:23
@kpango kpango merged commit bcfd01e into main Jul 25, 2024
7 checks passed
@kpango kpango deleted the fix/e2e branch July 25, 2024 12:56
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