[8.8.0] Add facts_version parameter to module_extension (https://github.c…#29667
Open
iancha1992 wants to merge 3 commits into
Open
[8.8.0] Add facts_version parameter to module_extension (https://github.c…#29667iancha1992 wants to merge 3 commits into
facts_version parameter to module_extension (https://github.c…#29667iancha1992 wants to merge 3 commits into
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
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.
…om//pull/29556)
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.
module_extension(...)gains a new named-onlyfacts_versionint parameter (default0, must be non-negative). A new parameter onmodule_extensionis necessary since the version has to be known before the extension is evaluated.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
Description
Motivation
Build API Changes
No
Checklist
Release Notes
RELNOTES: None
Commit 87f096a