fix(build): make the native_addons package load (dedup all_binaries + rcgen dep) (#3425) #3473

Merged
mfreeman451 merged 1 commit from feat/native-addon-build-fixes into staging 2026-05-31 19:43:20 +00:00
Owner

What

Two latent duplicate-label errors left the //build/native_addons package unbuildable — a duplicate label in a filegroup/deps is a hard package-load error, so every target in the package (and its rust dep) fails at analysis. This is why CI never actually built the add-on bundles and the gap went unnoticed; it's the prerequisite for the native-addon signing/publish lane (and for building any bundle at all).

Discovered while starting the build-signing work — bazel build //build/native_addons:sample_addon_bundle failed at load.

Fixes

  • build/native_addons/defs.bzl — a language: "rust" bundle reuses a single binary label across every declared platform (rules_rust has no go_cross_binary analogue), but the platform loop appended that label to binary_outputs once per platform. The all_binaries filegroup then had a duplicate srcs entry. Dedup before aggregating (mirrors the existing srcs dedup). Affected rust_sample_addon_bundle and netprobe_addon_bundle (both 2-platform rust bundles).
  • rust/addon-sdk/BUILD.bazeladdon_sdk_handshake_mtls_test re-added rcgen via crate_deps([...]) even though it is already in ADDON_SDK_DEPS, duplicating the dep label and putting the whole package in error (which in turn broke the rust-sample/netprobe bundles that depend on it). Dropped the duplicate; the test-only crates (tempfile, tower, hyper-util) remain.

Verification

  • Before: bazel query //build/native_addons:allERROR: Label '//rust/netprobe:netprobe' is duplicated in the 'srcs' attribute of rule 'all_binaries' (+ the rcgen dup).
  • After: bazel query //build/native_addons:all and //rust/addon-sdk:all both load clean, and all bundle targets (sample_addon_bundle, rust_sample_addon_bundle, netprobe_addon_bundle, …) enumerate. buildifier clean.
  • Local builds of the bundles need the linux CI runner (Go cross-compile to linux fails on a darwin host with an exec-toolchain error — environment, not code); this PR is load/analysis correctness.

🤖 Generated with Claude Code

## What Two latent **duplicate-label** errors left the `//build/native_addons` package **unbuildable** — a duplicate label in a `filegroup`/`deps` is a hard *package-load* error, so *every* target in the package (and its rust dep) fails at analysis. This is why CI never actually built the add-on bundles and the gap went unnoticed; it's the prerequisite for the native-addon signing/publish lane (and for building any bundle at all). Discovered while starting the build-signing work — `bazel build //build/native_addons:sample_addon_bundle` failed at load. ## Fixes - **`build/native_addons/defs.bzl`** — a `language: "rust"` bundle reuses a single binary label across every declared platform (rules_rust has no `go_cross_binary` analogue), but the platform loop appended that label to `binary_outputs` once *per platform*. The `all_binaries` filegroup then had a duplicate `srcs` entry. Dedup before aggregating (mirrors the existing `srcs` dedup). Affected `rust_sample_addon_bundle` and `netprobe_addon_bundle` (both 2-platform rust bundles). - **`rust/addon-sdk/BUILD.bazel`** — `addon_sdk_handshake_mtls_test` re-added `rcgen` via `crate_deps([...])` even though it is already in `ADDON_SDK_DEPS`, duplicating the dep label and putting the whole package in error (which in turn broke the rust-sample/netprobe bundles that depend on it). Dropped the duplicate; the test-only crates (`tempfile`, `tower`, `hyper-util`) remain. ## Verification - Before: `bazel query //build/native_addons:all` → `ERROR: Label '//rust/netprobe:netprobe' is duplicated in the 'srcs' attribute of rule 'all_binaries'` (+ the `rcgen` dup). - After: `bazel query //build/native_addons:all` and `//rust/addon-sdk:all` both **load clean**, and all bundle targets (`sample_addon_bundle`, `rust_sample_addon_bundle`, `netprobe_addon_bundle`, …) enumerate. `buildifier` clean. - Local *builds* of the bundles need the linux CI runner (Go cross-compile to linux fails on a darwin host with an exec-toolchain error — environment, not code); this PR is load/analysis correctness. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(build): make the native_addons package load (dedup all_binaries + rcgen dep) (#3425)
Some checks failed
lint / lint (push) Successful in 1m15s
Secret Scan / gitleaks (pull_request) Successful in 57s
lint / lint (pull_request) Successful in 2m2s
Rust Add-on Interop Test / interop (push) Successful in 2m40s
Golang Tests / test-go (push) Successful in 2m57s
CI / build (pull_request) Failing after 14m39s
1458231856
Two latent duplicate-label errors left the //build/native_addons package
unbuildable (any target fails at package load) — which is why CI never built the
bundles and the gap went unnoticed. Both are prerequisites for the native-addon
signing/publish lane (and any bundle build).

- build/native_addons/defs.bzl: a `rust` bundle reuses one binary label across
  every declared platform, but the loop appended it to `binary_outputs` once per
  platform, so the `all_binaries` filegroup got duplicate srcs (hard package-load
  error). Dedup before aggregating (mirrors the existing `srcs` dedup). Affected
  rust_sample + netprobe (both 2-platform rust bundles).
- rust/addon-sdk/BUILD.bazel: `addon_sdk_handshake_mtls_test` re-added `rcgen` via
  crate_deps although it is already in ADDON_SDK_DEPS, duplicating the dep label
  and putting the whole package in error. Dropped the duplicate (test-only crates
  remain).

Verified: `bazel query //build/native_addons:all` and `//rust/addon-sdk:all` both
load clean (previously errored); all bundle targets enumerate. buildifier clean.
(Local bundle builds need the linux CI runner for Go cross-compile; this fix is
load/analysis correctness.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mfreeman451 deleted branch feat/native-addon-build-fixes 2026-05-31 19:43:27 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!3473
No description provided.