Repository navigation
Conversation
When a crate universe belongs to a non-root module and ships a lockfile, use the lockfile as-is and skip the digest check (repin = False). The digest covers the cargo-bazel, cargo and rustc versions and the canonical manifest labels, which differ between the module that produced the lockfile and the consumer. Dependencies that ship a lockfile generated for rules_rust >= 0.71.1 consumers (for example eclipse-opensovd/mbedtls-rs) therefore fail on 0.68.x with "Digests do not match", and the lockfile lives in the read-only module cache, so it cannot be repinned from the consumer. This is a partial backport of upstream bazelbuild#4109 (commit 2f69054, released in 0.71.1). Upstream also fails hard for non-root universes without a lockfile. That part is left out on purpose: such universes keep repinning, so existing consumers are not broken. Upstream: bazelbuild#4109 Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
4 tasks done
alexmohr
marked this pull request as ready for review
November 28, 2026 21:58
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
Partial backport of bazelbuild#4109 (commit 2f690546, released in 0.71.1): when a crate universe belongs to a non-root module and ships a
lockfile,crate_universe/extensions.bzluses that lockfile as-is and skips the digest check (repin = False).The
cargo-bazel-lock.jsondigest covers the cargo-bazel, cargo and rustc versions and the canonical manifest labels. These differ between the module that produced the lockfile and the consumer, and between a root and a non-root manifest label. A dependency that ships a lockfile generated with rules_rust >= 0.71.1 (for exampleeclipse-opensovd/mbedtls-rs) therefore fails on 0.68.x withDigests do not match. The consumer cannot repin it either, because the lockfile lives in the read-only module cache.reference_integrationcurrently carries this change aspatches/rules_rust/002-crate-universe-trust-non-root-lockfile.patchso it can use dependencies that ship lockfiles, such asmbedtls-rs. It can drop that patch once a release with this change is tagged (for example0.68.3-score).Checklist
Related
link_depscrate_universe annotation bazelbuild/rules_rust#4109, commit 2f69054 (released in 0.71.1).Notes for Reviewers
Scope of the backport:
fail()for a non-root universe without a lockfile. That is left out on purpose, so such universes keep repinning as before and no existing consumer breaks.determine_repin.link_depsannotation PR. Only the lockfile handling is taken here.Verification:
pre-commit run --files crate_universe/extensions.bzl: buildifier format and lint, and typos, pass.local_path_overrideofrules_rustto this branch, runningbazel build --nobuild @mbedtls-rs//...:score_main(2098bd5)cargo-bazel-lock.jsonDigests do not matchindetermine_repincargo-bazel-lock.jsonlockfileNo test is added: the behaviour depends on
module_ctxand onis_rootof a second module, which needs a multi-module bzlmod integration setup that the fork does not have. Upstream did not add a test for it either.Alexander Mohr alexander.m.mohr@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH
Provider Information