Skip to content

Cleanup of expression-based version selectors with explicit prerelease control - #911

Merged
helly25 merged 11 commits into
bazel-contrib:masterfrom
helly25:redo/version-selectors
Oct 20, 2026
Merged

helly25 merged 11 commits into
bazel-contrib:masterfrom
helly25:redo/version-selectors

Conversation

@helly25

@helly25 helly25 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Cleanup of expression-based LLVM and linker version selectors using bzl 0.8.0, with independent llvm_version_allow_prereleases and linker_version_allow_prereleases controls. This clean redo supersedes the closed #909.

Mainly we are using the advanced/generalized bzl 0.8.0 functionality.

NOTE: The two *_allow_prereleases are incompatible changes. They replace the old magic allowance by referencing in requirements.

AG;DR

  • Share requirement parsing, SemVer comparisons, projection constants, filtering, and first/latest selection through bzl. Restrict candidates to compatible artifacts before selecting and preserve the chosen artifact alongside its version.
  • Both public prerelease flags default to false. Requirements always apply; exact pins remain authoritative. The generic allow_prereleases parameter exists only in internal resolver code and tests.
  • Use the same environment selector expansion for LLVM and catalogued linkers, including mold. Feature overrides inherit the flags independently; linker-only changes preserve LLVM archive sharing.
  • Replace _version_string with bzl normalize_string; existing distribution goldens remain unchanged.
  • Resolve bzl 0.8.0 directly from BCR in all four module roots, with no temporary overrides. Both WORKSPACE declarations use the published release archive. mboworks_bzl@0.8.0 bazelbuild/bazel-central-registry#11173 is merged; the release dependency is satisfied.
  • Validation at synchronized head c71ba5c: all 45 toolchain tests passed in Bzlmod (Bazel 9.3.0) and all 45 passed in WORKSPACE mode (Bazel 8.8.1). All 14 Python wrapper tests and 11 distribution-script tests passed; Trunk buildifier/prettier checks passed. The three integration module graphs were previously validated at 1e1ea62 and were not rerun for this sync.
  • Remove the redundant distribution-version wrapper; both production callers use the existing parser directly.
  • Move all three LLVM distribution golden-output writers and their fixtures into llvm_distributions_test.bzl. Production code exposes one internal-only testing struct with eight helper references; existing test targets and golden files are unchanged.
  • Tests cover selector parity, prerelease pins, platform compatibility, environment fallbacks and errors, and independent feature-override policies. The complete bzl 0.8.0 dependency upgrade merged into master via Update dependency mboworks_bzl to v0.8.0 #912 (including Update Bzlmod dependency to mboworks_bzl 0.8.0 #913). This branch is synchronized with upstream master 6ceed3a, including the dylib-linked tool wrapper fix (Fix remote execution of dylib-linked LLVM tools #914) and LLVM 23.1.4 catalogue update (Update LLVM distributions to 23.1.4 #915). The prerelease golden conflict was resolved by preserving all expanded selector cases and updating only the catalogue-driven expectations to 23.1.4; synthetic fixtures are unchanged. Its diff against master contains only the selector functionality, tests, and documentation, plus removal of an obsolete dependency comment.

Use bzl collection pickers and predicates for LLVM and linker selection. Preserve host filtering and exact pins. Pin merged bzl commit 9c6560c until its next release.

Validation: Bazel 7.2.1 test //... passes all 43 tests without local overrides; trunk fmt/check and diff checks pass. Bazel 9.0.0 mod graph passes in all three integration roots.
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25 added a commit that referenced this pull request Oct 18, 2026
Update the Bzlmod dependency to mboworks_bzl 0.8.0, matching the
WORKSPACE archives updated by #912. Together these changes align every
bzl version reference with the published release.

## AG;DR

- One-line change: root MODULE.bazel moves mboworks_bzl from 0.5.1 to
0.8.0, resolved directly from BCR without overrides.
- Stacked on #912 (`renovate/mboworks_bzl-0.x`), which already updates
WORKSPACE and toolchain/deps.bzl. Merge #912 first, then this PR;
synchronize #911 afterward so its diff contains the functionality
changes.
- No selector, prerelease-policy, normalization, or test-refactoring
changes are included here.
- Validation: full Bzlmod `bazel test //...` with Bazel 7.2.1, all three
integration module graphs with Bazel 9.0.0, and Trunk lint passed. CI
for this PR is pending and must be rechecked after its base retargets to
master.

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25 added a commit that referenced this pull request Oct 18, 2026
Update all mboworks_bzl dependency declarations to the published 0.8.0
release. This isolates the dependency upgrade from the version-selector
functionality in #911.

## AG;DR

- Upgrade MODULE.bazel from 0.5.1 to 0.8.0 using BCR resolution.
- Upgrade WORKSPACE and toolchain/deps.bzl from the 0.7.0 archive to the
published 0.8.0 archive and checksum.
- The MODULE.bazel change was incorporated through #913. No temporary
Git or archive overrides are needed.
- Merge this PR into master before synchronizing #911. This PR contains
no selector functionality changes.
- All 100 GitHub checks passed on the combined head `7f852e4`, including
the required-check gate.

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [mboworks_bzl](https://redirect.github.com/mboworks/bzl) |
http_archive | minor | `0.7.0` → `0.8.0` |

---

### Release Notes

<details>
<summary>mboworks/bzl (mboworks_bzl)</summary>

###
[`v0.8.0`](https://redirect.github.com/mboworks/bzl/blob/HEAD/CHANGELOG.md#080)

[Compare
Source](https://redirect.github.com/mboworks/bzl/compare/0.7.0...0.8.0)

- Add `versions.normalize_tuple` and `versions.normalize_string` for
grouping
  interleaved version suffixes with configurable string separators.

- Add `runfiles.key(ctx, file)` for constructing runtime lookup keys
from Bazel files.

- Add stable version sorting, predicate filtering, earliest/latest
selection with data-preserving
  keys and caller-controlled prerelease filtering in every mode.

- Automate README installation-version preparation and reject stale
release references
  during validation and release publication.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/bazel-contrib/toolchains_llvm).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE2NC4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

---------

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marcus Boerger <marcus.boerger@gmail.com>
@helly25 helly25 changed the title Add expression version selectors with explicit prerelease control Cleanup of expression-based version selectors with explicit prerelease control Oct 19, 2026
Include bazel-contrib#914 and bazel-contrib#915. Preserve the expanded prerelease selector cases while updating catalogue-driven expectations to LLVM 23.1.4.
@helly25
helly25 merged commit 48f9c0e into bazel-contrib:master Oct 20, 2026
99 checks passed
@helly25
helly25 deleted the redo/version-selectors branch October 20, 2026 23:49
helly25 added a commit to mboworks/xff that referenced this pull request Oct 23, 2026
Follow stable LLVM 23 updates from the pinned toolchain catalogue automatically. Major LLVM and clang-tidy upgrades remain explicit configuration decisions, while ordinary catalogue updates can pick up LLVM 23 fixes without a second compiler-version edit.

Keep Linux CI working on Ubuntu 26.04 while retaining Ubuntu 24.04 support, including real FUSE mounts on both runtimes.

## AG;DR

Current implementation: `16c86d96586d7caf1624bb1b4538b4b7965c7237`, synchronized with main through #1012.

Linux CI failures involve a FUSE runtime-package mismatch, LLVM tool runtime dependencies, and a setup-bazel policy mismatch. The [initial failing run](https://github.com/mboworks/xff/actions/runs/39332590210) cannot install `libfuse3-3` on Ubuntu 26.04 and cannot load the older toolchain LLD's ICU dependency. The [MSan failure](https://github.com/mboworks/xff/actions/runs/39869171711/job/120140351498) separately requires `libxml2.so.2` for the fixed LLVM 22.1.8 compiler/runtime pair. This PR resolves the toolchain, FUSE and MSan host compatibility issues; PR 1013 carries the setup-bazel policy correction.

Implementation:

- Keep `latest:major==23`: select the newest stable LLVM 23 release available for the host in the pinned, checksummed toolchain catalogue. Catalogue updates can adopt LLVM 23 fixes; LLVM 24 and new major clang-tidy versions require an explicit selector change. No live upstream-release lookup is involved.
- Replace the superseded #909 development snapshot with actual upstream master commit `b63941bcc533a52e1b81c81af5fe77d5a2b382f8`, using the released `1.12.0` module baseline. The immutable snapshot includes merged [selector integration #911](bazel-contrib/toolchains_llvm#911), [LLVM 23.1.4 #915](bazel-contrib/toolchains_llvm#915), and [auxiliary-tool runtime-library fix #914](bazel-contrib/toolchains_llvm#914). Linux resolves LLVM 23.1.4. Release 1.12.0 predates the selector integration, so retain this source pin until a release contains it.
- Use the normal transitive Bazel Central Registry dependency on `mboworks_bzl` (now 0.8.0 upstream); no bzl version, archive or Git override remains.
- Preserve `LLVM_VERSION_MSAN` and the exact LLVM 22.1.8 compiler/instrumented-libc++ pairing. Ordinary ASan, TSan, coverage, fuzzing, release builds, build tools, clang-format and clang-tidy follow LLVM 23. Native Apple ld and bundled Linux LLD selection remain intact.
- Run the pinned LLVM 22.1.8 MSan toolchain on Ubuntu 24.04 and explicitly install `libxml2`, with a distinct `msan-ubuntu24` cache namespace. Its LLD requires `libxml2.so.2`, which Ubuntu 26.04 no longer packages (it supplies SONAME 16). Also install that dependency in the local Ubuntu 24.04 MSan Docker harness. LLVM 23 builds and the other sanitizer jobs remain on ubuntu-latest; no compiler/libc++ version mismatch or shared-library alias is introduced.
- Make the existing `--help` child-argument boundary test use a child shell's `printf` builtin. Ubuntu 26.04's uutils external `printf` handles `--help` itself even after a format operand, so the fixture previously tested the host utility's help behavior. The child still receives a literal `--help`, and both the child-output and no-xff-help assertions remain.
- Probe `libfuse3.so.4`, then `.so.3`, then the existing unversioned fallback. SONAME 4 still exposes the FUSE3 API. xff's used lowlevel-operations prefix, file-info fields and exported four-argument `fuse_session_new` compatibility entry point work with both runtimes; no new adapter or libfuse build dependency is needed.
- Install `fuse3` in Linux main/release CI and the local Docker harness; its dependencies choose the distribution's runtime package rather than hard-coding `libfuse3-3`.
- Add an Ubuntu 24.04 default test cell alongside `ubuntu-latest` and macOS. Both Linux default cells require real FUSE mounts via `--config=xff_fuse_tests_required`; latest Linux retains ASan. Give Ubuntu 24.04 a separate compiled-output cache namespace.
- Document stable-major compiler policy and the supported FUSE runtimes in CONTRIBUTING.md and the ABI/loader comments. Compiler-module changes still select every indexed translation unit for CI clang-tidy, and all extra-module tests run with core tests in one Bazel invocation.

Validation:

- `bazel build //tools:process_resources_native //xff:xff --config=clang_release --jobs=4` passes on Ubuntu 26.04 with LLVM 23.1.4, including sandboxed ThinLTO indexing/linking that previously failed on LLD's missing ICU 70 dependency (945 actions).
- All seven focused FUSE/CLI test targets pass natively on Ubuntu 26.04 with the required-mount config. The loader selects `libfuse3.so.4`; all kernel-path server cases run.
- The same compiled server/API/loader binaries pass in an Ubuntu 24.04 container with `fuse3`/`libfuse3-3` 3.14.0 and select `libfuse3.so.3`. All eight CLI full-extras cases also pass there with no skips, including actual archive mounts. This checks one binary across both supported runtimes.
- Completion audit: released bzl 0.8.0 passes all 182 Bazel tests and 46 Python tooling tests; regenerating its PEP 440 fixture with the pinned `packaging==26.0` reference reports no differences. Its [published version reference](https://mboworks.github.io/bzl/site/tag/0.8.0/docs/versions.html) documents all four functions and legacy/SemVer/PEP 440 modes. [Release-commit CI](https://github.com/mboworks/bzl/actions/runs/39135113495) passes on Linux, macOS and Windows; release and site publication also succeed. At the exact pinned upstream commit, all 45 focused toolchains_llvm selector/feature/distribution tests pass, including named constants, function expressions, wildcard/compatible operators and prerelease policy. All 99 upstream checks are completed without failures, including `required_checks_done`.
- In a clean Ubuntu 24.04 container, packaged `libxml2` 2.9.14 satisfies LLVM 22.1.8 LLD. A C++23 program using `std::vector` compiles, links with that LLD and the exact instrumented libc++ overlay, and executes successfully under MSan. The MSan host-only update leaves the previously tested C++ sources unchanged; focused pre-commit/actionlint/shell checks pass.
- A disposable conformance audit compared xff's declarations with upstream libfuse 3.14.0 and 3.18.2 headers: the used argument/entry/file-info offsets, complete implemented operations prefix and keep-cache/file-handle representation match. Upstream headers remain outside the product build.
- `bazel test //... $(tools/extras.py --wildcards) --config=xff_docs --config=clang --config=xff_fuse_tests_required --jobs=4 --test_output=errors`: all 297 core/extra-module targets pass on native Ubuntu 26.04 without a GNU printf PATH override. The portable fixture preserves the child-argument regression assertion; the same xff binary demonstrates that external uutils printf prints its own help while the shell builtin prints `child:--help`.
- Focused pre-commit checks, including actionlint, formatting, shell policy and the release-preparation policy suite, pass; `git diff --check` passes. The local clang-tidy hook skips without a compile database; final-head CI passes the complete indexed scan.

The repository ignores MODULE.bazel.lock; dependency resolution refreshes it locally. Final pushed head `16c86d96586d7caf1624bb1b4538b4b7965c7237` passes [the complete GitHub CI run](https://github.com/mboworks/xff/actions/runs/39876737875), including macOS, Ubuntu 24.04 and 26.04 release tests, ASan/TSan/MSan, coverage, fuzzing, benchmarks, and all 294 translation units in the complete clang-tidy scan. Required `done`, `pre-commit` and `trunk` checks pass; the PR is mergeable and up to date with main.
helly25 added a commit that referenced this pull request Nov 4, 2026
Prepare the documentation for **toolchains_llvm 1.13.0**. Documentation
and release-template changes only; no runtime changes, catalogue
updates, release tag, or publication.

## Changes

- Add the 1.13.0 changelog entry and backfill 1.12.0 and 1.11.3 from
their actual release contents. Keep LLVM 23.1.4 and the bzl 0.8.0
dependency upgrade under 1.12.0; attribute the new selector
functionality to 1.13.0.
- Centralize the #911 migration details in `docs/migration-1.13.0.md`,
with concise warnings and direct links from README, CHANGELOG, and
generated release notes. Keep the current configuration examples in
README and the agreed 1.13.0 release number without describing this
behavior change as backward-compatible.
- Separate prerelease eligibility from version constraints: the
independent LLVM/linker opt-ins allow ordinary ranges without naming an
RC. Show `latest:>23.0,<=23.1` for following RCs through the final
23.1.0 release, `<23.1` for excluding that final, and
`latest:major==23,minor==1` for following all 23.1.x patches. Exact pins
remain unchanged.
- Explain LLVM's current undotted `rcN` spelling and SemVer ordering for
both variants: `rc10 < rc2`, `rc.2 < rc.10`, and the mixed-spelling trap
`rc.10 < rc9`. `latest` follows SemVer precedence, not release
chronology; no normalization between spellings is performed.
- Record LLVM 23.1.5 from merged #932 in the 1.13.0 changelog: ten
xz/zstd archives across Linux ARM64/x86_64, macOS ARM64, and Windows
ARM64/x86_64. Update both installation examples to 23.1.5 with the
bundled linker and call out the absence of a macOS x86_64 archive.
- Include the WORKSPACE `aspect_bazel_lib` 3.8.0 test-dependency upgrade
from merged #931.
- Correct the bzl documentation links to 0.8.0, the
`getenv`/`--repo_env` explanation, the release-template pointer, and the
`.bazelrc` typo.

LLVM 23.1.5 is part of the upcoming 1.13.0 release. Its catalogue update
landed in #932; this PR documents it and updates the release
installation examples.

## Verification

- Bazel 9.3.0, Bzlmod: all 45 `//toolchain/...` tests passed with
`--nocache_test_results`.
- Bazel 8.8.2, WORKSPACE: all 45 `//toolchain/...` tests passed with
`--nocache_test_results`.
- Pinned bzl 0.8.0: all 24 `@mboworks_bzl//bzl/versions:versions_tests`
passed on Bazel 9.3.0 with `--nocache_test_results`. Its [existing
tests](https://github.com/mboworks/bzl/blob/0.8.0/bzl/versions/versions_test.bzl#L439-L486)
cover dotted numeric identifiers, undotted lexical identifiers, and
distinct mixed spellings.
- An isolated Starlark probe using our actual selector verified
exclusive/inclusive ranges, RC-to-final selection, exclusion of later
patches by `<=23.1`, the whole-23.1.x selector, explicit opt-in, stable
eligibility, prerelease-only filtering, both RC spellings, and `latest`
choosing `rc9` over `rc.10`. This is a local diagnostic, not a newly
committed regression test.
- Python: all 11 distribution-script tests and 14 wrapper tests passed.
- Trunk markdownlint, prettier, git-diff-check, and commit-time checks
passed.
- Ran the existing release preparation script in an isolated temporary
Git fixture, not the working checkout. Verified version/tag/commit
substitution, generated archive checksum and prefix, both LLVM 23.1.5
installation examples, catalogue availability across
Linux/macOS/Windows, migration text, the versioned migration-guide link,
and guide inclusion in the generated archive. This smoke check does not
publish a release or perform a new LLVM compile/link integration run.
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.

1 participant