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

Buf CLI migrate to v2 #2691

Merged
merged 4 commits into from
Oct 11, 2024
Merged

Buf CLI migrate to v2 #2691

merged 4 commits into from
Oct 11, 2024

Conversation

kmrmt
Copy link
Contributor

@kmrmt kmrmt commented Oct 10, 2024

Description

migrate to buf v2 and regenerate proto files.

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.2
  • Rust Version: v1.81.0
  • Docker Version: v27.3.1
  • Kubernetes Version: v1.31.1
  • Helm Version: v3.16.1
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • New Features
    • Updated configuration files to version v2, enhancing clarity and structure.
    • Introduced new search methods in the gRPC service, including search_by_id, stream_search_by_id, and multi_search_by_id.
  • Bug Fixes
    • Removed unnecessary comments across various modules for a cleaner codebase.
  • Chores
    • Removed the buf.work.yaml file as part of the configuration cleanup.

Signed-off-by: Kosuke Morimoto <[email protected]>
Copy link
Contributor

coderabbitai bot commented Oct 10, 2024

📝 Walkthrough

Walkthrough

The pull request includes significant updates to several configuration and Rust source files. The buf.gen.yaml file has been modified to version 2, with changes to plugin specifications and a restructuring of the managed section. The buf.work.yaml file has been removed entirely. The buf.yaml file has also been updated to version 2, introducing a new modules section and updating lint configurations. Documentation comments have been removed from various Rust files, particularly in the filter and meta modules, while new methods have been added in the vald module.

Changes

File Change Summary
buf.gen.yaml Updated version to v2, restructured managed section, changed plugin declarations to remote.
buf.work.yaml File removed.
buf.yaml Updated version to v2, added modules section, updated lint options and breaking configurations.
rust/libs/proto/src/filter.egress.v1.tonic.rs Removed documentation comments for FilterClient and FilterServer, no functional changes.
rust/libs/proto/src/filter.ingress.v1.tonic.rs Removed documentation comments for FilterClient and FilterServer, no functional changes.
rust/libs/proto/src/meta.v1.tonic.rs Removed documentation comments for MetaClient and Meta methods, no functional changes.
rust/libs/proto/src/vald.v1.tonic.rs Added methods in Search trait, removed comments from various methods, expanded gRPC capabilities.

Possibly related PRs

Suggested labels

area/internal, size/XXL, actions/e2e-deploy, actions/fossa, actions/e2e-chaos, actions/e2e-profiling, actions/e2e-max-dim, actions/backport/release/v1.7

Suggested reviewers

  • hlts2
  • vankichi

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

Signed-off-by: Kosuke Morimoto <[email protected]>
Copy link

cloudflare-workers-and-pages bot commented Oct 10, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: aef781d
Status: ✅  Deploy successful!
Preview URL: https://1d6b93ea.vald.pages.dev
Branch Preview URL: https://feature-buf-migrate-to-v2.vald.pages.dev

View logs

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

🧹 Outside diff range and nitpick comments (3)
buf.yaml (2)

16-21: LGTM! Version update and module configuration look good.

The update to Buf v2 and the addition of the 'modules' section align well with the PR objectives. The dependencies on protovalidate and googleapis are appropriate for most Protocol Buffer projects.

Consider adding a brief comment above the deps section to explain why these specific dependencies are needed for your project. This can help future maintainers understand the purpose of these dependencies.


16-34: Overall, the migration to Buf v2 looks good, but some clarifications are needed.

The update to Buf v2 and the new configurations align well with best practices for Protocol Buffer projects. The use of standard lint rules and stricter breaking change detection will likely improve code quality and maintain better backward compatibility.

However, the introduced exceptions in both the lint and breaking change sections need further explanation. While they may be necessary for your specific use case, it's important to ensure they don't inadvertently introduce risks or reduce the effectiveness of the Buf tool.

Consider documenting the reasons for these exceptions in a comment within the buf.yaml file or in a separate documentation file. This will help future maintainers understand the rationale behind these configuration choices and make it easier to reassess them as the project evolves.

buf.gen.yaml (1)

16-47: Summary: Successful migration to Buf v2 with expanded functionality

The changes in this file successfully migrate the Buf configuration to version 2, aligning perfectly with the PR objective. Key improvements include:

  1. Updated version declaration
  2. Refined package management configuration
  3. Modernized plugin declarations for Go, documentation, and Rust
  4. Addition of Rust support via Prost and Tonic plugins

These changes should lead to improved maintainability and expanded functionality. The migration appears to be comprehensive and well-executed.

As the project now supports multiple languages (Go and Rust), consider implementing a CI step to ensure that generated code for all supported languages remains in sync with the proto definitions. This could help catch any cross-language inconsistencies early in the development process.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d59ed9f and df2f67f.

⛔ Files ignored due to path filters (20)
  • apis/grpc/v1/agent/core/agent.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/proto/buf.lock is excluded by !**/*.lock
  • buf.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • buf.gen.yaml (1 hunks)
  • buf.work.yaml (0 hunks)
  • buf.yaml (1 hunks)
  • rust/libs/proto/src/filter.egress.v1.tonic.rs (0 hunks)
  • rust/libs/proto/src/filter.ingress.v1.tonic.rs (0 hunks)
  • rust/libs/proto/src/meta.v1.tonic.rs (0 hunks)
  • rust/libs/proto/src/vald.v1.tonic.rs (0 hunks)
💤 Files with no reviewable changes (5)
  • buf.work.yaml
  • rust/libs/proto/src/filter.egress.v1.tonic.rs
  • rust/libs/proto/src/filter.ingress.v1.tonic.rs
  • rust/libs/proto/src/meta.v1.tonic.rs
  • rust/libs/proto/src/vald.v1.tonic.rs
🧰 Additional context used
🔇 Additional comments (5)
buf.yaml (2)

29-34: Breaking change configuration looks reasonable, but please clarify the exceptions.

The continued use of 'FILE' for breaking change detection is a good practice. However, I have a question about the exceptions:

Could you please explain why the exceptions for 'EXTENSION_NO_DELETE' and 'FIELD_SAME_DEFAULT' are necessary? These rules often help maintain backward compatibility, so it would be helpful to understand the reasoning behind disabling them.

To verify the impact of these exceptions, let's run the following script:

#!/bin/bash
# Description: Check for potential issues related to the disabled breaking change rules

# Check for extensions in proto files
echo "Checking for extensions in proto files:"
rg --type proto "extend" apis/proto

# Check for fields with default values
echo "Checking for fields with default values:"
rg --type proto "default =" apis/proto

This script will help us understand the usage of extensions and default field values in the proto files, which might justify the exceptions.


22-28: Lint configuration looks good, but please clarify the exceptions.

The update to 'STANDARD' lint rules and disallowing comment ignores are excellent practices for maintaining code quality. However, I have a question about the exceptions:

Could you please explain why the exceptions for 'FIELD_NOT_REQUIRED' and 'PACKAGE_NO_IMPORT_CYCLE' are necessary? These rules often catch important issues, so it would be helpful to understand the reasoning behind disabling them.

To verify the impact of these exceptions, let's run the following script:

This script will help us understand the prevalence of optional fields and import statements in the proto files, which might justify the exceptions.

buf.gen.yaml (3)

18-23: Approved: Refined package management configuration

The restructuring of the managed section provides more precise control over package management. The disable option for 'go_package' and the override for 'go_package_prefix' should lead to more consistent and controllable package naming across the project.

To ensure these changes don't negatively impact existing imports, please run:

#!/bin/bash
# Check for any import issues after package management changes
go mod tidy
go build ./...

36-47: Approved: Updated configurations for documentation and Rust plugins

The plugin configurations for documentation (Markdown and OpenAPI) and Rust (Prost and Tonic) have been successfully updated to the new format. The addition of Rust plugins is a significant enhancement, expanding the project's language support.

To ensure the Rust-related changes are working as expected, please run:

#!/bin/bash
# Verify Rust code generation
buf generate
find rust/libs/proto/src -type f -name "*.rs" | sort

16-16: Approved: Version update to v2

The update to version 2 of the Buf configuration is in line with the PR objective. This change is crucial for leveraging the latest features and improvements in Buf.

To ensure all parts of the project are compatible with Buf v2, please run the following verification:

buf.gen.yaml Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 10, 2024
kpango
kpango previously approved these changes Oct 10, 2024
@kmrmt kmrmt dismissed stale reviews from kpango and coderabbitai[bot] via aef781d October 11, 2024 00:16
@kpango kpango requested review from a team, kpango and hlts2 and removed request for a team October 11, 2024 00:21
Copy link
Contributor

@hlts2 hlts2 left a comment

Choose a reason for hiding this comment

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

LGTM!

@kpango kpango merged commit 3f18ac7 into main Oct 11, 2024
192 checks passed
@kpango kpango deleted the feature/buf/migrate-to-v2 branch October 11, 2024 01:07
vdaas-ci pushed a commit that referenced this pull request Oct 11, 2024
* migrate to v2

Signed-off-by: Kosuke Morimoto <[email protected]>

* replace

Signed-off-by: Kosuke Morimoto <[email protected]>

* format

---------

Signed-off-by: Kosuke Morimoto <[email protected]>
Co-authored-by: Yusuke Kato <[email protected]>
kpango added a commit that referenced this pull request Oct 11, 2024
* migrate to v2



* replace



* format

---------

Signed-off-by: Kosuke Morimoto <[email protected]>
Co-authored-by: Kosuke Morimoto <[email protected]>
Co-authored-by: Yusuke Kato <[email protected]>
@kpango kpango mentioned this pull request Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment