Fix external tests on Bazel 9.2: patch rules_go duplicate constraints - #810
Merged
fmeum merged 1 commit intoAug 3, 2026
Merged
Conversation
Bazel 9.2.0 (picked up via USE_BAZEL_VERSION=latest) rejects duplicate constraint values in target_compatible_with at analysis time. rules_go's tests/core/cgo:binary_with_rpath lists both @platforms//os:linux and @platforms//os:macos (OR was intended, AND was written), so analyzing @io_bazel_rules_go//tests/core/cgo:all now fails with: Duplicate constraint values detected: constraint_setting @@platforms//os:os has [@@platforms//os:linux, @@platforms//os:osx] Under Bazel <= 9.1 the target was silently skipped as incompatible everywhere. Patch it via single_version_override to the canonical OR idiom (select with @platforms//:incompatible default) until fixed in rules_go. The patch applies cleanly to rules_go 0.61.1, 0.62.0 and current master, and the target now actually builds on linux/macos. Also fix the generate_imported_dylib.sh invocation in run_external_tests.sh, which always failed with 'cc: fatal error: no input files' (masked by '|| echo') because IMPORTED_C_PATH is never set; default to the imported.c next to the script and output into the cgo package directory.
helly25
requested review from
dzbarsky,
fmeum,
jsharpe and
rrbutani
as code owners
August 3, 2026 18:36
Member
|
Do you happen to know which Bazel commit broke this? This shouldn't happen in a Bazel minor release. |
fmeum
approved these changes
Aug 3, 2026
fmeum
enabled auto-merge (squash)
August 3, 2026 18:44
Collaborator
Author
I sent you the full details on slack. |
helly25
added a commit
that referenced
this pull request
Aug 4, 2026
## Summary Collects all outstanding renovate dependency upgrades, which were previously blocked by the Bazel 9.2 / rules_go analysis error fixed in #810. Each commit is the corresponding renovate PR cherry-picked onto current master: | PR | Dependency | Version | |----|------------|---------| | #804 | rules_java (WORKSPACE) | 9.6.1 → 9.7.0 | | #805 | aspect_bazel_lib (WORKSPACE) | 3.5.0 → 3.7.1 | | #806 | bazel_skylib (MODULE + toolchain/deps.bzl) | 1.9.0 → 1.9.2 | | #776 | boringssl (MODULE + WORKSPACE) | 0.20260526.0 → 0.20260803.0 | | #787 | rules_rust (MODULE) | 0.70.0 → 0.73.0 | | #807 | io_bazel_rules_go (WORKSPACE) | 0.61.1 → 0.62.0 | | #808 | rules_go (MODULE) | 0.61.1 → 0.62.0 | Those PRs can be closed once this merges (renovate should detect the versions are present). ## Verification (local, macOS arm64, Bazel 9.2.0, bzlmod) - `@io_bazel_rules_go//tests/core/cgo:all`, `@rules_rust//test/unit/{interleaved_cc_info,native_deps}:all`, `@boringssl//...` and `//foreign:pcre` all analyze cleanly (106 targets) — confirming the #810 rules_go patch applies to 0.62.0 and the boringssl patch applies to 0.20260803.0. - The test targets excluded in `run_external_tests.sh` all still exist under rules_rust 0.73.0 / rules_go 0.62.0, so target-pattern expansion stays valid. Note: rules_go 0.62.0 has a known Bazel 9 issue with duplicate mingw constraints in its windows cgo platforms (bazel-contrib/rules_go#4665); it should not trigger here since nothing targets Windows, but flagging it in case CI says otherwise. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All
external_test (…, latest, true, …)CI jobs have been failing since bazelisklatestmoved from Bazel 9.1.1 to 9.2.0 (~2026-07-14). This is what is breaking the currently open renovate PRs #804–#808 — in the failing runs 122 of 123 tests pass; the job fails only on an analysis error.Bazel 9.2 makes duplicate constraint values in
target_compatible_witha hard analysis-time error. rules_go'stests/core/cgo:binary_with_rpathlists both@platforms//os:linuxand@platforms//os:macos(OR was intended, AND was written), so analyzing@io_bazel_rules_go//tests/core/cgo:allfails with:Under Bazel <= 9.1 the target was silently skipped as incompatible-everywhere, which is why this only surfaced now. The target is still broken on rules_go master, so upgrading rules_go (#807/#808) does not help.
Changes
tests/rules_go-fix-binary_with_rpath-constraints.patch, rewriting the attribute to the canonical OR idiom (selectwith@platforms//:incompatibledefault), applied viasingle_version_overrideintests/MODULE.bazel. No version pin, so renovate bumps keep working; the patch applies cleanly to rules_go 0.61.1, 0.62.0 and current master. No test is disabled — on the contrary,binary_with_rpathnow actually builds on linux/macos for the first time.generate_imported_dylib.shinvocation inrun_external_tests.sh: it has always failed withcc: fatal error: no input files(masked by|| echo) becauseIMPORTED_C_PATHis never set anywhere. Default to theimported.cnext to the script and output into the cgo package directory. This was never the CI blocker (dylib_testis taggedmanualand never runs), but the ERROR line in every log was a red herring while debugging this.Follow-up: the proper fix belongs in bazel-contrib/rules_go (
tests/core/cgo/BUILD.bazel); the local patch can be dropped once a fixed rules_go release is available.Test plan
Verified locally on macOS arm64 with Bazel 9.2.0:
@io_bazel_rules_go//tests/core/cgo:allanalyze cleanly, andbinary_with_rpathbuilds successfully with the LLVM toolchain.libimported.dylib/libversioned.*as intended.