Create universe MODULE.bazel input causes churn
Referring to MODULE.bazel in a module_ctx when an extension is non-reproducible means the MODULE.bazel hash appears in the MODULE.bazel.lock. This is major churn, with any unrelated MODULE.bazel change triggering the rules rust extension and diff in the MODULE.bazel.lock file.
This needs to be updated to use some other mechanism to find the root. https://github.com/bazelbuild/rules_rust/blob/61f41867d5cada90aa7c415c8c3e550d51e8debe/crate_universe/extensions.bzl#L649
Any plans to address this?
This kinda fell off my radar but I did notice that this doesn't appear to be an issue in Bazel 8 as module_ctx.path doesn't watch files by default. If there's a simple fix for this that we can apply for Bazel 7 users then I'd be happy to do so but was unable to quickly come up with a solution last I thought about it.
This being difficult to fix in Bazel 7 was exactly the motivation for the change in Bazel 8 that doesn't watch all Labels passed to module_ctx.path.
You could add a repo rule that uses this to get the path and exports it as a constant in .bzl file that your module extension then loads. That repo rule needs to be instantiated in a different module extension for this to work. The repo rule will rerun each time, but that should be relatively cheap.
@fmeum would you happen to have a link to this change? And do you know if repository_ctx.path no longer watches as well?
https://github.com/bazelbuild/bazel/commit/50196979346cb57bc2e239d8bcd5342d4000292e added the incompatible flag and yes, it also applies to the repo rule context.