chore(deps): Bazel 9.1.1 toolchain + module updates - #185
Merged
Conversation
Bump Bazel 7.2.1 -> 9.1.1 and update the BCR/dev module dependencies to their latest compatible versions. Bazel 9 stops autoloading the legacy native `sh_*` rules. helly25_bashtest still defines its targets with native `sh_library`, so re-enable autoload for the shell rules from @rules_shell via `--incompatible_autoload_externally` in .bazelrc. abseil-cpp is held at the 20250814 series (20250814.2): newer Abseil (20260107+) deprecates the `absl::MutexLock(Mutex*)` constructor that re2 2025-11-05 still uses, which breaks under `--cxxopt=-Werror`. Verified with `bazel test //mbo/...` on Bazel 9.1.1: all unit tests pass in the default (fastbuild) config.
…r segfault LLVM 17.0.4's bundled linker segfaults against the macOS 26 SDK when linking tools in the exec configuration (e.g. //mbo/diff:diff, which _diff_test builds with cfg=exec), which broke all diff tests locally. LLVM 20.1.7 links cleanly and compiles the tree under -Werror with no new warnings. Also migrate the _diff_test is_windows select off the deprecated @bazel_tools//src/conditions:host_windows to @platforms//os:windows.
…workaround bashtest 0.3.0 loads sh_library/sh_test from @rules_shell directly, so the --incompatible_autoload_externally=+sh_library,+sh_binary,+sh_test workaround in .bazelrc is no longer needed under Bazel 9. Pin to the 0.3.0 tag commit via git_override for now; swap to a plain bazel_dep 0.3.0 once it is in the BCR.
Remove the `module_version: [0.10.0]` matrix dimension, the
`module_version`/`module_default` workflow inputs and the conditional
`cp bazelmod/MODULE.${module_version}.bazel MODULE.bazel` step, and
delete the now-unused `bazelmod/MODULE.0.10.0.bazel` shim. We no longer
test against the 0.10.0 module layout.
Switch the dev-only compile-commands extractor from inactive upstream hedronvision to the actively-maintained helly25 fork, pinned at cc0277ab4 (PR #21), which fixes a macOS BrokenProcessPool: the worker pool is pinned to the `fork` start method so spawned workers no longer re-import and re-enter main(). Add a `repo_name` alias and point compile_commands-update.sh at it. Verified: `./compile_commands-update.sh` -> OK, 2153 entries on macOS.
Replace the ancient 16.0.4 / 17.0.4 / 19.1.6 clang versions with a 20.1.8 / 21.1.8 / 22.1.7 ladder and move CI from the macos-15 runner to macos-26 (Apple clang 21 + the macOS 26 SDK, i.e. what we actually run, and the SDK where the LLVM>=20 linker fix matters). Default/blocking toolchain stays on 20.1.8 -- the newest clang that builds mbo cleanly. clang 21 tightened constexpr evaluation and currently breaks our struct_names_clang.h field-name reflection (__builtin_dump_struct in a consteval context), so 21.1.8 (the macOS native match) and 22.1.7 ride along as non-blocking, opt-only rungs in the continue-on-error test-clang job until that port lands; then promote the default pin to 21.x. Drop the orphaned bazelmod/llvm.20.1.0.MODULE.bazel. Also stop letting our global -Werror be tripped by third-party code: - external_include_paths makes external repo headers -isystem, so their warnings are ignored even in our first-party TUs (clang 21's -Wcharacter-conversion in googletest's gtest-printers.h); - per_file_copt on external/* sources downgrades -Werror when compiling a dependency's own .cc / internal headers (clang 21's -Wthread-safety-analysis in google_benchmark). First-party code keeps full -Werror. Verified locally on macOS 26: bazel test --config=clang //mbo/... -> 74/74 pass with the 20.1.8 default.
0.3.0 is now in the Bazel Central Registry, so drop the temporary git_override (added to get the sh_* autoload removal early) and bump the bazel_dep to the released version.
- bazelmod/llvm.MODULE.bazel: switch default llvm_version 20.1.8 → 21.1.8. - decompose_count: mark the overload-set structured bindings as [[maybe_unused]] (clang 21 warns on the decltype-only `auto&& [a1, ...]` names). Update the .mope template and regenerate the golden header. - ci(main.yml): temporarily pin the llvm matrix to 20.1.8 (TODO: restore 21.1.8 / 22.1.7 once the port is green).
…ses breakages on macOS due to tightened constexpr evaluation. Once 21.1.8 is the default pin, we can update to it and remove 20.1.8 from the workflow.
test.yml: - Split the runner into Setup / Show compiler / Build and Test. Resolve the C++ toolchain and Bazel flags exactly once in Setup and export them via $GITHUB_ENV so the later steps share one source of truth. - Assert the actually-selected compiler and the launched Bazel version match what the matrix asked for, so a silent toolchain/version fallback fails CI loudly instead of going green on the wrong toolchain. - Add a `bazel_version` input that pins `.bazelversion`, and neutralize any inherited `USE_BAZEL_VERSION` (exported empty -> bazelisk treats it as unset) so `.bazelversion` stays authoritative. - Drop the old `unset CC/CXX`: only the gcc branch exports them and the new `Clang:` assertion verifies the result, a stronger guarantee. - Make the cache key Bazel-version-aware so different Bazel versions don't clobber each other's cache. main.yml: - Give test-bcr a Bazel-version axis: 7.2.1 (earliest 7.x that works -- 7.1.x lacks `include()` and depend_on_what_you_use@0.16.0 needs >=7.2.1), 8.7.0 (latest 8.x), 9.0.2 (latest 9.0.x), and the checked-in default 9.1.1.
clang 21 tightened constexpr evaluation to forbid modifying a const-qualified object -- even through const_cast -- which broke placement `std::construct_at` into const storage. This surfaces on the macos-26 `native` build (Apple clang 21), which we can't disable. - struct_names_clang.h: make `Uninitialized storage_` non-const; the two const_casts in the Storage ctor are then no-ops and are dropped. - limited_vector.h: store `std::remove_const_t<T>` in the union `Data` and retarget the construct_at const_casts to `std::remove_const_t<T>*`, so `LimitedVector<const int>` constructs in a constant expression. Constness is reintroduced through the public accessors. Verified: struct_names_test and limited_vector_test pass under native clang 21. Note: limited_ordered.h / no_destruct.h carry the same const_cast + construct_at pattern but are never instantiated with a const value type, so they still compile under clang 21 and are left unchanged.
The clang-21 fix (ab8a27e) left two `construct_at(...)` lines over the column limit. clang-format wraps them; keeps the pre-commit clang-format hook green.
`koalaman/shellcheck-precommit` runs shellcheck via docker, which fails where docker is not installed (e.g. local dev). Switch to `shellcheck-py/shellcheck-py` v0.10.0.1 -- the same shellcheck 0.10.0 binary, pip-installed -- so the hook runs without docker locally and in CI. No new lint findings vs. the previous 0.10.0.
…std::filesystem) The native Apple-clang build passed no `-mmacosx-version-min`, so libc++'s availability annotations gated off `std::filesystem`, failing ~278 sites with "'path' is unavailable: introduced in macOS 10.15" across mbo/file, mbo/diff, mbo/mope and mbo/testing. We target Apple Silicon only, so 11.0 (Big Sur) is the earliest reachable macOS and clears the 10.15 gate. Set on compile and link, target and exec configs (the //mbo/diff:diff tool builds for exec), in the `common:macos` block (auto-applied via --enable_platform_specific_config). The hermetic --config=clang build is unaffected. Full `bazel test //...` is green under native Apple clang 21 (74/74).
Default pin and blocking test-bcr stay on 20.1.8; 21.1.8 runs opt only, 22.1.7 runs asan/cpp23/opt.
helly25
enabled auto-merge (squash)
June 8, 2026 23:03
Fab-Cat
approved these changes
Jun 9, 2026
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
Updates the toolchain and module dependencies for Bazel 9.1.1, ports the source to clang 21 (Apple clang on macOS 26 / Apple Silicon), and hardens CI.
Dependency bumps
bazel_skylib1.9.0,platforms1.1.0,rules_cc0.2.19,rules_shell0.8.0,re22025-11-05.bcr.1,googletest1.17.0.bcr.2,google_benchmark1.9.5,toolchains_llvm1.7.0,depend_on_what_you_use0.16.0,abseil-cpp20250814.2,helly25_bashtest0.3.0 (now published in the BCR — earliergit_overrideremoved),hedron_compile_commandspin.macOS 26 / clang 21
//mbo/diff:diff); 20.1.x links cleanly under--config=clang -Werror.std::construct_atinto const storage. Fixed by storing the non-const value type instruct_names_clang.handlimited_vector.h(limited_ordered.halready did this)..bazelrc, clearing libc++'sstd::filesystem"introduced in macOS 10.15" availability gate on the native Apple-clang build._diff_testis_windowsselect off the deprecated@bazel_tools//src/conditions:host_windows→@platforms//os:windows.CI
$GITHUB_ENV; the run asserts the actually-selected compiler and launched Bazel version (fails loudly on a silent fallback); cache key is Bazel-version-aware.test-bcrBazel-version matrix: 7.2.1 (earliest that parsesinclude()and satisfiesdepend_on_what_you_use >=7.2.1), 8.7.0, 9.0.2, 9.1.1.test-clanghermetic LLVM ladder: 20.1.8 default (blocking viatest-bcr); 21.1.8 / 22.1.7 ride along as non-blocking rungs.shellcheck-pyhook (no docker dependency).doneaggregating gate for branch protection.Test plan
bazel test //...— green under native Apple clang 21 on macOS 26 (74/74).bazel test --config=clang //...— green under hermetic LLVM 20.1.8 with-Werror.bazel test //mbo/diff/...— diff tests pass (were failing to build on LLVM 17.0.4).