MODULE.bazel: bazel_compatibility constraint breaks when a module dep has invalid syntax for current bazel
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the bug:
Given a module like
https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/aspect_rules_lint/2.0.0-rc0/MODULE.bazel#L5
which has a `bazel_compatibility`, Bazel doesn't check that first before parsing all dependency modules.
### Which category does this issue belong to?
_No response_
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
just use an earlier Bazel like so:
`MODULE.bazel`
```
bazel_dep(name = "aspect_rules_lint", version = "2.0.0-rc0")
```
`.bazelversion`
```
7.2.1
```
Instead of an error like "a module you depend on requires a newer version of Bazel" the error is
```
ERROR: Traceback (most recent call last):
File "https://bcr.bazel.build/modules/aspect_rules_lint/2.0.0-rc0/MODULE.bazel", line 14, column 10, in
Error in bazel_dep: in call to bazel_dep(), parameter 'repo_name' got value of type 'NoneType', want 'string'
ERROR: Error computing the main repository mapping: in module dependency chain -> aspect_rules_lint@2.0.0-rc0: error executing MODULE.bazel file for aspect_rules_lint@2.0.0-rc0
```
which leads users to believe that MODULE.bazel has a bug.
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
_No response_
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.