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

Fix format of proto files #2778

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Fix format of proto files #2778

merged 2 commits into from
Dec 17, 2024

Conversation

vankichi
Copy link
Contributor

@vankichi vankichi commented Dec 13, 2024

Description

SSIA

Related Issue

Versions

  • Vald Version: v1.7.15
  • Go Version: v1.23.4
  • Rust Version: v1.83.0
  • Docker Version: v27.4.0
  • Kubernetes Version: v1.31.4
  • Helm Version: v3.16.3
  • NGT Version: v2.3.5
  • Faiss Version: v1.9.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • Documentation
    • Enhanced readability of comments and troubleshooting sections across various services, including Filter, Index, Insert, Object, Remove, Search, Update, and Upsert.
    • Added structured tables for error scenarios and resolutions in the Search, Insert, Upsert, and Remove services.
    • Included notices regarding gRPC message size limitations in multiple methods to guide users effectively.

Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

📝 Walkthrough

Walkthrough

The pull request introduces documentation improvements across multiple proto files in the apis/proto/v1/vald directory. Changes include formatting adjustments, whitespace additions, and enhanced troubleshooting sections for various RPC methods. These modifications aim to improve the clarity and readability of comments without altering the functionality or signatures of the methods. Specific attention was given to error handling documentation and gRPC message size limitations, ensuring that developers have clear guidance on potential issues.

Changes

File Path Change Summary
apis/proto/v1/vald/filter.proto Updated comments for MultiSearchObject, StreamInsertObject, MultiUpdateObject, and MultiUpsertObject with added whitespace and HTML notice tags.
apis/proto/v1/vald/index.proto Removed unnecessary blank lines between service method definitions in the Index service.
apis/proto/v1/vald/insert.proto Enhanced troubleshooting sections for Insert, StreamInsert, and MultiInsert methods; added notice about gRPC message size limitations.
apis/proto/v1/vald/object.proto Improved formatting of troubleshooting comments for Exists, GetObject, and StreamGetObject methods.
apis/proto/v1/vald/remove.proto Reformatted comments for Remove, RemoveByTimestamp, StreamRemove, and MultiRemove methods to clarify error handling and added notice about gRPC message size limitations.
apis/proto/v1/vald/search.proto Added structured troubleshooting sections for multiple RPC methods in the Search service, detailing common errors and resolutions.
apis/proto/v1/vald/update.proto Enhanced documentation for Update, StreamUpdate, MultiUpdate, and UpdateTimestamp methods, including notice about gRPC message size limitations.
apis/proto/v1/vald/upsert.proto Improved documentation for Upsert, StreamUpsert, and MultiUpsert methods with detailed troubleshooting sections.

Possibly related PRs

Suggested labels

type/refactoring, priority/low, size/S, area/index/job/correction, area/index/job/creation, area/index/job/save, area/index/job/readreplica

Suggested reviewers

  • kmrmt
  • hlts2

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (5)
apis/proto/v1/vald/update.proto (1)

Line range hint 138-146: TODO comments need to be addressed in UpdateTimestamp method.

The UpdateTimestamp method documentation contains TODO placeholders for Status Code and Troubleshooting sections.

Would you like me to help generate the missing documentation sections for UpdateTimestamp? I can analyze similar methods in the codebase to propose appropriate status codes and troubleshooting guidelines.

apis/proto/v1/vald/remove.proto (1)

89-89: Add missing period at the end of the table row.

For consistency with other table entries, add a period at the end of the INTERNAL error description.

-  // | INTERNAL          | Target Vald cluster or network route has some critical error.                                   | Check target Vald cluster first and check network route including ingress as second.
+  // | INTERNAL          | Target Vald cluster or network route has some critical error.                                   | Check target Vald cluster first and check network route including ingress as second.     |
apis/proto/v1/vald/search.proto (2)

Line range hint 153-157: Consider enhancing the gRPC size limitation notice

The warning about gRPC message size limitations is valuable, but could be more specific. Consider adding:

  • The default message size limit (4MB for gRPC)
  • How to configure custom message size limits
  • Guidelines for batching requests
 <div class="notice">
 gRPC has a message size limitation.<br>
-Please be careful that the size of the request exceeds the limit.
+Please ensure your request size does not exceed the gRPC message size limit (default: 4MB).<br>
+For larger requests, consider:<br>
+- Using streaming RPCs instead<br>
+- Configuring custom message size limits<br>
+- Batching your requests into smaller chunks
 </div>

Also applies to: 189-193


Line range hint 387-387: Fix comment formatting

There's an extra forward slash in the comment line which breaks the formatting consistency.

- // // ---
+ // ---
apis/proto/v1/vald/index.proto (1)

Line range hint 26-63: Consider proto design best practices

While the current implementation is functional, consider these proto design recommendations:

  1. Request/Response Naming:

    • Following standard proto conventions, consider renaming request/response types to be more specific (e.g., IndexDetailRequest/IndexDetailResponse)
    • This improves API clarity and follows buf's recommended naming patterns
  2. Empty Request Pattern:

    • The service uses Empty requests consistently across all methods
    • Consider whether some operations might benefit from parameterization in the future
    • If parameters might be needed later, defining specific request messages now could prevent breaking changes

Would you like assistance in implementing these recommendations? I can help generate the revised proto definitions.

🧰 Tools
🪛 buf (1.47.2)

34-36: "payload.v1.Empty" is used as the request or response type for multiple RPCs.

(RPC_REQUEST_RESPONSE_UNIQUE)


34-34: RPC request type "Empty" should be named "IndexInfoRequest" or "IndexIndexInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


34-34: RPC response type "Count" should be named "IndexInfoResponse" or "IndexIndexInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)


40-42: "payload.v1.Empty" is used as the request or response type for multiple RPCs.

(RPC_REQUEST_RESPONSE_UNIQUE)


40-40: RPC request type "Empty" should be named "IndexDetailRequest" or "IndexIndexDetailRequest".

(RPC_REQUEST_STANDARD_NAME)


40-40: RPC response type "Detail" should be named "IndexDetailResponse" or "IndexIndexDetailResponse".

(RPC_RESPONSE_STANDARD_NAME)


46-46: RPC request type "Empty" should be named "IndexStatisticsRequest" or "IndexIndexStatisticsRequest".

(RPC_REQUEST_STANDARD_NAME)


46-46: RPC response type "Statistics" should be named "IndexStatisticsResponse" or "IndexIndexStatisticsResponse".

(RPC_RESPONSE_STANDARD_NAME)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d74ef5 and 4227ec4.

📒 Files selected for processing (8)
  • apis/proto/v1/vald/filter.proto (5 hunks)
  • apis/proto/v1/vald/index.proto (1 hunks)
  • apis/proto/v1/vald/insert.proto (4 hunks)
  • apis/proto/v1/vald/object.proto (3 hunks)
  • apis/proto/v1/vald/remove.proto (7 hunks)
  • apis/proto/v1/vald/search.proto (16 hunks)
  • apis/proto/v1/vald/update.proto (4 hunks)
  • apis/proto/v1/vald/upsert.proto (4 hunks)
✅ Files skipped from review due to trivial changes (3)
  • apis/proto/v1/vald/object.proto
  • apis/proto/v1/vald/upsert.proto
  • apis/proto/v1/vald/filter.proto
🧰 Additional context used
🪛 buf (1.47.2)
apis/proto/v1/vald/index.proto

40-42: "payload.v1.Empty" is used as the request or response type for multiple RPCs.

(RPC_REQUEST_RESPONSE_UNIQUE)


40-40: RPC request type "Empty" should be named "IndexDetailRequest" or "IndexIndexDetailRequest".

(RPC_REQUEST_STANDARD_NAME)


40-40: RPC response type "Detail" should be named "IndexDetailResponse" or "IndexIndexDetailResponse".

(RPC_RESPONSE_STANDARD_NAME)

🔇 Additional comments (6)
apis/proto/v1/vald/insert.proto (1)

Line range hint 93-97: LGTM! Important notice about gRPC message size limitations.

The addition of the notice about gRPC message size limitations is valuable for preventing potential runtime issues.

apis/proto/v1/vald/remove.proto (1)

Line range hint 65-71: LGTM! Clear explanation of TimestampRequest behavior.

The added notice effectively explains the AND condition behavior for multiple timestamps and its use cases.

apis/proto/v1/vald/search.proto (2)

46-48: Documentation improvements look great!

The troubleshooting sections are consistently structured across all methods, with clear and actionable error resolutions. The documentation will help developers effectively handle error scenarios.

Also applies to: 78-80, 111-113, 139-141, 170-172, 206-208, 237-239, 270-272, 303-305, 331-333, 362-364, 398-400


Line range hint 1-413: Overall changes look excellent

The documentation improvements significantly enhance the proto file's usability by:

  • Adding comprehensive troubleshooting guides
  • Maintaining consistency across all methods
  • Including important warnings about message size limitations
  • Providing specific, actionable error resolutions

The changes align well with the PR's objective while going beyond simple formatting to add substantial value.

apis/proto/v1/vald/index.proto (2)

37-37: LGTM: Consistent whitespace formatting

The whitespace changes between service method definitions improve readability and maintain consistency throughout the proto file.

Also applies to: 43-43


Line range hint 1-63: Verify consistent formatting across all proto files

Since this PR aims to fix proto file formatting, let's ensure consistency across all proto files.

✅ Verification successful

Proto files show consistent formatting and documentation patterns

After analyzing the proto files across the codebase, I can confirm that:

  1. All service definitions follow consistent formatting with proper indentation
  2. RPC methods consistently have documentation comments with "Overview" and "Status Code" sections where applicable
  3. The spacing between RPC methods is uniform within each service
  4. The file under review (apis/proto/v1/vald/index.proto) follows the same formatting patterns as other proto files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check formatting consistency across proto files
# Look for inconsistent blank line patterns between service methods

# Find all proto files and check for inconsistent blank line patterns
fd -e proto -x awk '
  BEGIN { inconsistent=0 }
  /^service/ { in_service=1 }
  in_service && /^}/ { in_service=0 }
  in_service && /^$/ { blank_lines++ }
  in_service && /^  rpc/ {
    if (prev_blank != blank_lines && prev_blank != "") {
      print FILENAME ":" FNR ": Inconsistent blank lines before RPC method"
      inconsistent=1
    }
    prev_blank=blank_lines
    blank_lines=0
  }
  END { exit inconsistent }
'

Length of output: 422


Script:

#!/bin/bash
# Let's try a different approach to check proto formatting consistency
# First, let's see all proto files and their service definitions

# Find all proto files and show service blocks with their RPC methods
fd -e proto -x awk '
  /^service/ { 
    print "\nFile:", FILENAME;
    print "Line:", NR;
    in_service=1; 
    print $0
  }
  in_service && /^[[:space:]]*rpc/ { print $0 }
  in_service && /^}/ { 
    print $0;
    in_service=0 
  }
'

Length of output: 7156


Script:

#!/bin/bash
# Let's check the actual formatting and spacing in proto files
# We'll look at the content between service definitions and their methods

fd -e proto -x awk '
  # Print filename when we start processing a new file
  FNR==1 { if (FILENAME != prev_file) { print "\nFile:", FILENAME; prev_file=FILENAME } }
  
  # When we find a service definition, print next 10 lines to see formatting
  /^service/ {
    print "\nService definition at line", FNR;
    for(i=0; i<10; i++) {
      getline line;
      if (line ~ /^}/) break;  # Stop if we hit the end of service
      print line
    }
  }
'

Length of output: 6783

🧰 Tools
🪛 buf (1.47.2)

34-36: "payload.v1.Empty" is used as the request or response type for multiple RPCs.

(RPC_REQUEST_RESPONSE_UNIQUE)


34-34: RPC request type "Empty" should be named "IndexInfoRequest" or "IndexIndexInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


34-34: RPC response type "Count" should be named "IndexInfoResponse" or "IndexIndexInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)


40-42: "payload.v1.Empty" is used as the request or response type for multiple RPCs.

(RPC_REQUEST_RESPONSE_UNIQUE)


40-40: RPC request type "Empty" should be named "IndexDetailRequest" or "IndexIndexDetailRequest".

(RPC_REQUEST_STANDARD_NAME)


40-40: RPC response type "Detail" should be named "IndexDetailResponse" or "IndexIndexDetailResponse".

(RPC_RESPONSE_STANDARD_NAME)


46-46: RPC request type "Empty" should be named "IndexStatisticsRequest" or "IndexIndexStatisticsRequest".

(RPC_REQUEST_STANDARD_NAME)


46-46: RPC response type "Statistics" should be named "IndexStatisticsResponse" or "IndexIndexStatisticsResponse".

(RPC_RESPONSE_STANDARD_NAME)

Copy link

cloudflare-workers-and-pages bot commented Dec 13, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1ae76c0
Status: ✅  Deploy successful!
Preview URL: https://b2572f6e.vald.pages.dev
Branch Preview URL: https://refactor-apis-fix-api-proto.vald.pages.dev

View logs

@kpango kpango merged commit 515b8f3 into main Dec 17, 2024
176 checks passed
@kpango kpango deleted the refactor/apis/fix-api-proto-format branch December 17, 2024 05:40
vdaas-ci pushed a commit that referenced this pull request Dec 17, 2024
vankichi added a commit that referenced this pull request Dec 17, 2024
Signed-off-by: vankichi <[email protected]>
Co-authored-by: Kiichiro YUKAWA <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants