[8.8.0] Add facts_version parameter to module_extension - #29992
Merged
Conversation
Adds a new integer `facts_version` parameter to `module_extension(...)` that is persisted in the lockfile alongside the facts and checked against the current value before the extension runs. If the stored version does not match, the persisted facts are discarded and the extension is invoked with an empty `module_ctx.facts`. Versions are stored in a new top-level lockfile object. The jq merge driver is taught to drop facts from any lockfile whose own `factsVersions` entry for an extension is lower than the maximum observed across all input lockfiles before performing the shallow merge, preserving only the entries written by the newest schema. Fixes bazelbuild#29483. `module_extension(...)` gains a new named-only `facts_version` int parameter (default `0`, must be non-negative). A new parameter on `module_extension` is necessary since the version has to be known before the extension is evaluated. - [x] I have added tests for the new use cases (if any). - [x] I have updated the documentation (if applicable). RELNOTES: `module_extension(...)` now accepts a `facts_version` integer parameter. Bumping it invalidates the facts persisted in `MODULE.bazel.lock` for that extension, allowing extension authors to make breaking changes to the facts schema without risking misinterpretation by older code paths. Closes bazelbuild#29556. PiperOrigin-RevId: 921924739 Change-Id: I514f5e1b21a6c51fd88633a462d220d33a78d180 (cherry picked from commit bazelbuild@87f096a)
This was referenced Jun 25, 2026
fmeum
marked this pull request as ready for review
June 25, 2026 08:32
iancha1992
enabled auto-merge
June 25, 2026 19:54
meisterT
approved these changes
Jun 30, 2026
Merged
via the queue into
bazelbuild:release-8.8.0
with commit Jun 30, 2026
9daa227
48 checks passed
ortstadtthomas91-coder
approved these changes
Jul 8, 2026
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.
Adds a new integer
facts_versionparameter tomodule_extension(...)that is persisted in the lockfile alongside the facts and checked against the current value before the extension runs. If the stored version does not match, the persisted facts are discarded and the extension is invoked with an emptymodule_ctx.facts.Versions are stored in a new top-level lockfile object. The jq merge driver is taught to drop facts from any lockfile whose own
factsVersionsentry for an extension is lower than the maximum observed across all input lockfiles before performing the shallow merge, preserving only the entries written by the newest schema.Fixes #29483.
RELNOTES:
module_extension(...)now accepts afacts_versioninteger parameter. Bumping it invalidates the facts persisted inMODULE.bazel.lockfor that extension, allowing extension authors to make breaking changes to the facts schema without risking misinterpretation by older code paths.Closes #29556.
PiperOrigin-RevId: 921924739
Change-Id: I514f5e1b21a6c51fd88633a462d220d33a78d180
(cherry picked from commit 87f096a)
Fixes #29626