Using `@@` to refer to root module from external `MODULE.bazel` no longer works in 7.1.0
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
In Bazel 7.0.2 we patch a third-party module and add our own extension. We load this from the root workspace by using:
```
our_extension = use_extension("@@//path/to:our_extenstion.bzl", "our_extension")
```
In Bazel 7.1.0 we now see this error when we attempt this:
```
Error computing the main repository mapping: invalid label for module extension found at @@third_party_module~//:MODULE.bazel:8:22: no repo visible as '@' here
```
I [asked on Bazel Slack](https://bazelbuild.slack.com/archives/C014RARENH0/p1710782864184759) and was told to open a new issue here.
### Which category does this issue belong to?
Core
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
See above. Just using `@@` in an external `MODULE.bazel` will repro.
### Which operating system are you running Bazel on?
Ubuntu 22.04.3 LTS
### What is the output of `bazel info release`?
release 7.0.2 is where it works. release 7.1.0 is where it no longer works
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
N/A
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
This is in an internal repo.
```
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I haven't bisected it but it is a regression.
### Have you found anything relevant by searching the web?
No.
### Any other information, logs, or outputs that you want to share?
N/A
Contributor guide
Research direction
Start with the external MODULE.bazel case that calls use_extension("@@//path/to:our_extenstion.bzl", "our_extension") and reproduce it on Bazel 7.0.2 and 7.1.0. Trace the main repository mapping error and compare the handling of @@ root-module labels; done means the external MODULE.bazel can resolve the root extension again without the reported error.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100