Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 23, 2025

This PR replaces clang-format with buf format for protobuf file formatting across the Kuma repository, addressing the pain points with clang-format while providing better protobuf-native tooling.

Changes Made

Tool Configuration:

  • Added buf.yaml configuration file with standard formatting and linting rules
  • Updated mise.toml to install buf (v1.57.2) using the buf plugin directly instead of clang-format (13.0.0)
  • Updated mk/dev.mk to use BUF variable instead of CLANG_FORMAT

Build System:

  • Modified mk/check.mk to use buf format -w without CI conditionals, since buf should always be available
  • Integrated buf formatting with existing make check workflow instead of standalone GitHub Actions step

GitHub Actions:

  • Removed clang-format from MISE_DISABLE_TOOLS across all 6 workflow files
  • Removed standalone buf format check from build-test-distribute.yaml since formatting is now handled by make check

Formatting:

  • Applied buf formatting to all 47 protobuf files across api/, pkg/, and test/ directories
  • All files now follow buf's standard formatting conventions for consistent code style
  • Regenerated all 53 corresponding .pb.go files using make generate/protos to ensure consistency with the formatted proto files

Benefits

  • Simplified dependencies: Eliminates the need for clang-format installation and configuration
  • Native protobuf tooling: buf is purpose-built for protobuf workflows and provides better integration
  • Consistent formatting: Standard buf formatting rules ensure uniform proto file styling
  • Streamlined workflow: Formatting is now fully integrated with make check without separate CI steps
  • Faster installation: Uses buf plugin directly for quicker setup

The migration preserves all existing developer workflows while providing a more robust and protobuf-focused formatting solution that's fully integrated with the existing build system.

Fixes #14537.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

Reviewer Checklist

🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
If something doesn't apply please check the box and add a justification if the reason is non obvious.

  • Is the PR title satisfactory? Is this part of a larger feature and should be grouped using > Changelog?
  • PR description is clear and complete. It Links to relevant issue as well as docs and UI issues
  • This will not break child repos: it doesn't hardcode values (.e.g "kumahq" as an image registry)
  • IPv6 is taken into account (.e.g: no string concatenation of host port)
  • Tests (Unit test, E2E tests, manual test on universal and k8s)
    • Don't forget ci/ labels to run additional/fewer tests
  • Does this contain a change that needs to be notified to users? In this case, UPGRADE.md should be updated.
  • Does it need to be backported according to the backporting policy? (this GH action will add "backport" label based on these file globs, if you want to prevent it from adding the "backport" label use no-backport-autolabel label)

@Copilot Copilot AI changed the title [WIP] replace clang-format by buf format Replace clang-format with buf format for protobuf formatting Sep 23, 2025
Copilot finished work on behalf of lahabana September 23, 2025 20:14
@Copilot Copilot AI requested a review from lahabana September 23, 2025 20:14
@lahabana
Copy link
Contributor

@copilot please update your PR taking into account my review

Copy link
Contributor Author

Copilot AI commented Sep 23, 2025

@copilot please update your PR taking into account my review

Updated the PR addressing all your review feedback:

  • Removed standalone buf format check from GitHub Actions (now handled by make check)
  • Removed CI conditional from fmt/proto target
  • Switched to direct buf plugin installation
    All changes are in commit 1950f37.

@Copilot Copilot AI requested a review from lahabana September 23, 2025 20:30
Copilot finished work on behalf of lahabana September 23, 2025 20:30
@lahabana lahabana marked this pull request as ready for review September 23, 2025 20:31
@lahabana lahabana requested a review from a team as a code owner September 23, 2025 20:31
@lahabana
Copy link
Contributor

@copilot can you rereun make generate/protos I think the change in format of the base proto files impacted the generated proto

Copy link
Contributor Author

Copilot AI commented Sep 24, 2025

@copilot can you rereun make generate/protos I think the change in format of the base proto files impacted the generated proto

Ran make generate/protos and regenerated all 53 affected .pb.go files after the buf formatting changes. The changes were mainly protoc version updates in generated headers. (commit 1b8ca61)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@lahabana lahabana changed the title Replace clang-format with buf format for protobuf formatting ci(lint): clang-format with buf format for protobuf formatting Sep 24, 2025
Copilot finished work on behalf of lahabana September 24, 2025 07:33
@Automaat
Copy link
Contributor

I think we also need to update renovate config:

kuma/renovate.json

Lines 79 to 87 in 2ea5f29

{
"description": [
" Disable updates for 'clang-format' and 'protoc'. We intentionally stick to legacy",
" versions, as protobuf usage in Kuma is deprecated, so upgrading would add churn without",
" practical benefit"
],
"matchDepNames": ["clang-format", "protoc"],
"enabled": false
},

@Automaat
Copy link
Contributor

should we run full-matrix build? Since we are updating protoc by three major version

@lahabana
Copy link
Contributor

should we run full-matrix build? Since we are updating protoc by three major version

Why? protoc generates the go files. You can see the go files are unchanged (except the version comments) what else do you expect?

Co-authored-by: Marcin Skalski <[email protected]>
Signed-off-by: Charly Molter <[email protected]>

fix renovate ocnfig

Signed-off-by: Charly Molter <[email protected]>
@lahabana lahabana merged commit efb80db into master Sep 24, 2025
13 checks passed
@lahabana lahabana deleted the copilot/fix-14537 branch September 24, 2025 14:20
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.

replace clang-format by buf format
3 participants