Skip to content

build(proto): use prebuilt protoc toolchain instead of compiling from source#165

Merged
albertywu merged 1 commit into
mainfrom
wua/fix-logging-noise
May 29, 2026
Merged

build(proto): use prebuilt protoc toolchain instead of compiling from source#165
albertywu merged 1 commit into
mainfrom
wua/fix-logging-noise

Conversation

@albertywu
Copy link
Copy Markdown
Contributor

@albertywu albertywu commented May 29, 2026

Summary

Updates bazel such that the proto rules resolve a downloaded protoc binary instead of building @protobuf//:protoc (and its abseil/upb C++ deps) from source on every cold build.

Before this code change, 30k lines of noise was being dumped to terminal on make test, because the proto rules were compiling protoc and abseil from source which caused issues depending on host clang version (mine was newer than that was required which led to hundreds of deprecation warnings).

After this code change, we no longer build protoc and abseil from source and no longer see deprecation warnings. It's also faster since we don't need to build protoc from scratch.

Cold make test (after bazel clean):

Metric Before After
make test output 30,868 69
abseil deprecation warnings 802 0
protobuf/abseil [for tool] compiles ~250+ 0
external/ lines 9,741 1
tests passing 35 35
cold wall time ~84s ~11s

Test Plan

make test && make fmt && make lint
bazel clean && make test produces clean output without compile warnings

Issues

Stack

  1. feat(gateway): add Status RPC to look up request status by sqid #164
  2. @ build(proto): use prebuilt protoc toolchain instead of compiling from source #165

@albertywu albertywu marked this pull request as ready for review May 29, 2026 04:30
@albertywu albertywu requested review from a team, behinddwalls and sbalabanov as code owners May 29, 2026 04:30
@albertywu albertywu force-pushed the wua/add-request-status-api branch from bddbe79 to 05c63ce Compare May 29, 2026 13:40
@albertywu albertywu force-pushed the wua/fix-logging-noise branch from a6edf89 to 3378fc8 Compare May 29, 2026 13:40
@github-actions github-actions Bot force-pushed the wua/fix-logging-noise branch from 3378fc8 to 135a8bb Compare May 29, 2026 13:47
@github-actions github-actions Bot changed the base branch from wua/add-request-status-api to main May 29, 2026 13:47
… source

Registers toolchains_protoc and enables proto toolchain resolution so the
proto rules resolve a downloaded protoc binary instead of building
@protobuf//:protoc (and its abseil/upb C++ deps) from source on every cold build.

Why the noise existed (and why it's gone): the proto rules compiled protoc +
abseil from source using the host's Clang, which is newer than the pinned abseil
and flagged a deprecated builtin ~800x as build-action stderr; with a prebuilt
protoc binary no C++ is compiled, so those warnings are never produced.

Cold `make test` (after `bazel clean`):

| Metric                              | Before  | After |
|-------------------------------------|---------|-------|
| make test output                    | 30,868  | 69    |
| abseil deprecation warnings         | 802     | 0     |
| protobuf/abseil `[for tool]` compiles | ~250+ | 0     |
| `external/` lines                   | 9,741   | 1     |
| tests passing                       | 35      | 35    |
| cold wall time                      | ~84s    | ~11s  |

Changes:
- MODULE.bazel: add toolchains_protoc (listed first to win toolchain
  resolution over the transitive protobuf module) and register its toolchain
- .bazelrc: --incompatible_enable_proto_toolchain_resolution

No generated *.pb.go changes; rules_go needs no BUILD changes. Validated with
bazel clean + make test (35/35 pass), bazel build //..., bazel mod tidy, gazelle.

Co-authored-by: Cursor <cursoragent@cursor.com>
@albertywu albertywu enabled auto-merge May 29, 2026 13:50
@albertywu albertywu force-pushed the wua/fix-logging-noise branch from 135a8bb to 21a814f Compare May 29, 2026 13:57
@albertywu albertywu added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit 5b94eef May 29, 2026
13 checks passed
@github-actions github-actions Bot deleted the wua/fix-logging-noise branch May 29, 2026 14:03
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.

2 participants