Skip to content

[9.1.0] Bzlmod: Make compatibility_level and max_compatibility_level noops#28616

Merged
iancha1992 merged 1 commit intorelease-9.1.0from
wyv-910-compat
Feb 10, 2026
Merged

[9.1.0] Bzlmod: Make compatibility_level and max_compatibility_level noops#28616
iancha1992 merged 1 commit intorelease-9.1.0from
wyv-910-compat

Conversation

@Wyverald
Copy link
Copy Markdown
Member

Increasing compatibility_level leads to version conflicts that are difficult for end users to resolve. Therefore, we are making compatibility_level and max_compatibility_level no-ops. This will be effective from Bazel 8.6.0 and 9.1.0.

Module maintainers introducing major breaking changes should ensure that build failures provide clear error messages and actionable migration paths.

Fixes #22972

RELNOTES: The compatibility_level and max_compatibility_level attributes of module in MODULE.bazel are now no-ops. Module maintainers should stop specifying those attributes and provide clear build time error messages and actionable migration paths when making major breaking changes.

Closes #28600.

PiperOrigin-RevId: 868151978
Change-Id: I217e7f0c02e729f7c89ebab140d8bbd754db13be

…noops

Increasing `compatibility_level` leads to version conflicts that are difficult
for end users to resolve. Therefore, we are making `compatibility_level` and `max_compatibility_level` no-ops. This will be effective from Bazel 8.6.0 and 9.1.0.

Module maintainers introducing major breaking changes should ensure that build
failures provide clear error messages and actionable migration paths.

Fixes #22972

RELNOTES: The `compatibility_level` and `max_compatibility_level` attributes of `module` in MODULE.bazel are now no-ops. Module maintainers should stop specifying those attributes and provide clear build time error messages and actionable migration paths when making major breaking changes.

Closes #28600.

PiperOrigin-RevId: 868151978
Change-Id: I217e7f0c02e729f7c89ebab140d8bbd754db13be
@Wyverald Wyverald requested a review from a team as a code owner February 10, 2026 18:26
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Documentation Documentation improvements that cannot be directly linked to other team labels awaiting-review PR is awaiting review from an assigned reviewer labels Feb 10, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively makes the compatibility_level and max_compatibility_level attributes in Bzlmod no-ops. The changes include updating documentation to reflect this deprecation, modifying the implementation to ignore these attributes, and adding warnings to guide users toward removing them from their MODULE.bazel files. The implementation is solid, but I've identified an improvement opportunity to broaden the scope of the new deprecation warnings.

Comment on lines +160 to +161
if (compatibilityLevel.toInt("compatibility_level") != -1
&& context.getModuleBuilder().getKey().equals(ModuleKey.ROOT)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The warning for using the deprecated compatibility_level attribute is only issued for the root module. This check is too restrictive, as it won't warn users who are using a non-registry override (e.g., local_path_override) and have specified this attribute in the overridden module's MODULE.bazel file. Since developers can edit these files, they should also be warned about the deprecation.

A similar issue exists for the max_compatibility_level warning on lines 291-292.

To address this, you could consider passing information about whether a module is from a non-registry override into the ModuleThreadContext and using that in this condition.

@iancha1992 iancha1992 enabled auto-merge February 10, 2026 18:31
@iancha1992 iancha1992 added this pull request to the merge queue Feb 10, 2026
Merged via the queue into release-9.1.0 with commit f46dfcb Feb 10, 2026
49 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Documentation Documentation improvements that cannot be directly linked to other team labels team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants