Move module_ctx.watch to after lockfile repin#3932
Merged
UebelAndre merged 2 commits intobazelbuild:mainfrom Apr 7, 2026
Merged
Move module_ctx.watch to after lockfile repin#3932UebelAndre merged 2 commits intobazelbuild:mainfrom
UebelAndre merged 2 commits intobazelbuild:mainfrom
Conversation
illicitonion
approved these changes
Mar 29, 2026
Collaborator
illicitonion
left a comment
There was a problem hiding this comment.
Seems reasonable - thanks!
Contributor
Author
|
@illicitonion what's going on with the failed build? Is that normal? |
Collaborator
|
The failure is: https://buildkite.com/bazel/rules-rust-rustlang/builds/16817/steps/canvas?sid=019d5359-0ec6-441f-a3ff-269f49377957&tab=output I'm not familiar with this test. @illicitonion can you take a look? |
Collaborator
|
@patrickmscott does this diff fix the issue? --- a/crate_universe/extensions.bzl
+++ b/crate_universe/extensions.bzl
@@ -1114,12 +1114,12 @@
for cfg in mod.tags.from_cargo + mod.tags.from_specs:
- # Preload all external repositories. Calling `module_ctx.watch` will cause restarts of the implementation
- # function of the module extension when the file has changed.
+ # Watch inputs not modified by the generator. Calling `module_ctx.watch` will cause restarts of
+ # the implementation function of the module extension when the file has changed.
if cfg.cargo_lockfile:
module_ctx.watch(cfg.cargo_lockfile)
- if cfg.lockfile:
- module_ctx.watch(cfg.lockfile)
if cfg.cargo_config:
module_ctx.watch(cfg.cargo_config)
if hasattr(cfg, "manifests"):
@@ -1181,6 +1179,12 @@
strip_internal_dependencies_from_cargo_lockfile = cfg.strip_internal_dependencies_from_cargo_lockfile,
)
+ # Watch cfg.lockfile AFTER generation. The generator may modify it during
+ # repin, and in Bazel 9 module_ctx.read verifies digests for files already
+ # read, which would crash if the lockfile changed between watch and read.
+ if cfg.lockfile:
+ module_ctx.watch(cfg.lockfile)
+
metadata_kwargs = {}
if bazel_features.external_deps.extension_metadata_has_reproducible:
metadata_kwargs["reproducible"] = reproducible
|
auto-merge was automatically disabled
April 7, 2026 14:52
Head branch was pushed to by a user without write access
f71b876 to
5de61b9
Compare
In bazel 9, module_ctx.read verifies digests for files already read. If repin is requested, the content of the lockfile may change and cause bazel to hard crash.
93735fa to
406260b
Compare
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.
In bazel 9, module_ctx.read verifies digests for files already read. If repin is requested, the content of the lockfile may change and cause bazel to hard crash.
relates to: bazelbuild/bazel#29114