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 migrate to v2 #235

Merged
merged 1 commit into from
Oct 15, 2024
Merged

buf migrate to v2 #235

merged 1 commit into from
Oct 15, 2024

Conversation

kmrmt
Copy link
Contributor

@kmrmt kmrmt commented Oct 11, 2024

SSIA

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration file, buf.yaml, with versioning and module specifications.
    • Added linting rules and dependencies in buf.yaml.
  • Improvements

    • Updated buf.gen.yaml to version v2 with a new method for plugin referencing.
    • Removed unnecessary configuration references from the Makefile.
  • Bug Fixes

    • Corrected indentation for the NODE_ROOT variable in the Makefile.
  • Chores

    • Deleted the obsolete buf.work.yaml file to streamline configuration management.

@kmrmt kmrmt requested review from vankichi and hlts2 October 11, 2024 07:44
@CLAassistant
Copy link

CLAassistant commented Oct 11, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

coderabbitai bot commented Oct 15, 2024

Caution

Review failed

The head commit changed during the review from c14f5d5 to 392c8cd.

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request involve modifications to several configuration files related to the build and generation processes. The Makefile has had the BUF_CONFIGS variable removed, along with its usage, while the NODE_ROOT variable's indentation was corrected. The buf.gen.yaml file was updated to version v2, with changes in the plugin reference and options. A new buf.yaml configuration file was created, defining a module and linting rules, while the buf.work.yaml file was deleted, removing its versioning and directory configurations.

Changes

File Change Summary
Makefile Removed BUF_CONFIGS variable and its usage; corrected indentation of NODE_ROOT.
buf.gen.yaml Updated version from v1 to v2; changed plugin to remote; added generate_dependencies option.
buf.yaml Created new file with version v2, added module vald, defined linting rules and dependencies.
buf.work.yaml Deleted the file, removing versioning and directory configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant buf.gen.yaml
    participant buf.yaml

    User->>Makefile: Trigger build
    Makefile->>buf.gen.yaml: Read configuration
    buf.gen.yaml->>Makefile: Provide updated plugin reference
    Makefile->>buf.yaml: Read module and linting rules
    buf.yaml->>Makefile: Provide linting rules
    Makefile->>User: Build complete
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>, 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.

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

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

'buf' Command Not Found

The generate_dependencies option requires the buf tool to be installed and properly configured. Please ensure that buf is added as a project dependency and installed in your development environment.

🔗 Analysis chain

Line range hint 7-17: Approve new 'generate_dependencies' option, verify its impact.

The addition of the generate_dependencies option is approved. This option likely instructs the plugin to generate code for dependencies as well, which can be beneficial for a more complete code generation process.

To understand the full impact of this new option, please:

  1. Check the documentation of the buf.build/community/timostamm-protobuf-ts plugin for the generate_dependencies option.
  2. After running the code generation, verify the output:

Ensure that the generated code meets your project's requirements and doesn't introduce any unexpected side effects.


The buf command is not found, which is required to utilize the generate_dependencies option effectively. Please ensure that buf is installed and properly configured in your development environment.

To proceed, you can add the following script to verify the presence and version of buf:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of generate_dependencies option
buf generate
# List generated files to see if dependencies are included
find src -type f -name "*.ts" | sort

Length of output: 1294


Script:

# 
#!/bin/bash
# Check if buf is installed
if command -v buf >/dev/null 2>&1; then
    echo "buf is installed. Version:"
    buf --version
else
    echo "buf is not installed."
fi

Length of output: 69

buf.yaml (1)

17-19: Dependencies look good, but consider version pinning.

The external dependencies are correctly declared and use official Protocol Buffer repositories:

  1. buf.build/bufbuild/protovalidate (likely for message validation)
  2. buf.build/googleapis/googleapis (common for Google API-related protobuf definitions)

However, the versions of these dependencies are not specified. To ensure reproducibility and avoid unexpected changes, consider pinning specific versions for each dependency.

Example of version pinning:

deps:
  - buf.build/bufbuild/protovalidate:v0.1.7
  - buf.build/googleapis/googleapis:75e9812f2f0d

Replace the version numbers with the appropriate ones for your project.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8878323 and d38cd7a.

⛔ Files ignored due to path filters (1)
  • buf.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Makefile (0 hunks)
  • buf.gen.yaml (1 hunks)
  • buf.work.yaml (0 hunks)
  • buf.yaml (1 hunks)
💤 Files with no reviewable changes (2)
  • Makefile
  • buf.work.yaml
🧰 Additional context used
🔇 Additional comments (6)
buf.gen.yaml (3)

Line range hint 1-17: Overall approval: buf.gen.yaml updated to v2 with appropriate changes.

The changes in this file consistently reflect an upgrade to buf v2:

  1. Version updated to v2
  2. Plugin reference syntax updated to use remote
  3. New generate_dependencies option added

These changes appear well-structured and in line with buf v2 specifications. Ensure to test the new configuration thoroughly to verify that code generation works as expected with these updates.


1-1: Approve version update to v2, but verify compatibility.

The update to version 2 of the buf configuration is a good practice to stay current. However, ensure that all other configurations and dependencies in your project are compatible with this new version.

To verify the compatibility, please run the following command and check for any warnings or errors:


5-5: Approve plugin reference change, verify v2 specification compliance.

The change from plugin to remote for referencing the protobuf-ts plugin aligns with modern remote plugin fetching practices. This change is likely part of the v2 specification.

To ensure this change complies with the v2 specification, please check the buf documentation or run the following command:

buf.yaml (3)

1-1: LGTM: Version declaration is correct.

The version declaration for buf.yaml is correct and up-to-date, using the latest stable version (v2) of the buf tool.


2-16: Module configuration looks good, but verify exclusions.

The module configuration for "vald" is well-structured and includes both linting and breaking change rules. However, please confirm that the following exclusions are intentional and necessary for your project:

Linting exclusions:

  • FIELD_NOT_REQUIRED
  • PACKAGE_NO_IMPORT_CYCLE

Breaking change exclusions:

  • EXTENSION_NO_DELETE
  • FIELD_SAME_DEFAULT

These exclusions may impact the strictness of your Protocol Buffer definitions and breaking change detection.


1-19: Overall, the buf.yaml configuration looks good.

The configuration file is well-structured and follows buf.yaml conventions. It correctly sets up the buf tool for version v2, configures the "vald" module with appropriate linting and breaking change rules, and declares necessary dependencies.

To further improve the configuration:

  1. Verify that the linting and breaking change rule exclusions are necessary for your project.
  2. Consider pinning specific versions for the external dependencies to ensure reproducibility.

These improvements will enhance the maintainability and stability of your Protocol Buffer definitions.

Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: vankichi <[email protected]>
@vankichi vankichi merged commit 156a010 into main Oct 15, 2024
6 checks passed
@vankichi vankichi deleted the feature/buf/migrate-to-v2 branch October 15, 2024 07:16
vankichi pushed a commit that referenced this pull request Oct 15, 2024
Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: vankichi <[email protected]>
kmrmt added a commit that referenced this pull request Oct 15, 2024
…migrate-to-v2

Backport: buf migrate to v2 (#235)
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