Repository navigation
fix: validate stage0 version matches release version - #12700
Conversation
This PR adds a check to both `release_checklist.py` and CI to verify that `stage0/src/CMakeLists.txt` has the same LEAN_VERSION_MAJOR and LEAN_VERSION_MINOR as the release tag. The stage0 pre-built compiler stamps .olean headers with its baked-in version, so a mismatch causes the release tarball to contain .olean files with the wrong version. This happened in v4.29.0-rc2 (#12681) because the 'begin development cycle for v4.30.0' commit bumped stage0 to 4.30.0 before the release was cut. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Mathlib CI status (docs):
|
|
Reference manual CI status:
|
|
I don't think this is the right fix. We already set |
@Kha, the problem was that I unwittingly pulled in a stage0 update from master (which was using MINOR=30) to the releases/v4.29.0 branch. Our existing validation doesn't guard against this. |
|
I understand the repo state that led to this but I don't understand why the logic I described above did not lead to the stage0/ content being irrelevant here |
The version variables (LEAN_VERSION_MAJOR, MINOR, PATCH, IS_RELEASE) were declared with plain `set()`, which creates normal variables that shadow cache variables set by `-D` flags on the command line. This made the `-DLEAN_VERSION_*` flags passed by CI (and forwarded to stage0 via STAGE0_ARGS) completely ineffective — the `set()` always won. Change them to `set(... CACHE STRING "")` to match the existing pattern used by LEAN_SPECIAL_VERSION_DESC. With CACHE STRING (no FORCE), the value in CMakeLists.txt is the default, but `-D` flags take precedence. Also update release_checklist.py parsing to handle the new format. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
You're right — the Contrast with I've pushed a fix that changes the version |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Thanks! |
project(LEAN CXX C) implicitly creates empty LEAN_VERSION_{MAJOR,MINOR,PATCH}
normal variables (CMake sets <PROJECT>_VERSION_* for the project name). These
shadow the CACHE STRING values, making ${VAR} resolve to empty instead of
falling through to the cache. unset() them after the cache declarations.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Kha
left a comment
There was a problem hiding this comment.
Wait, why does the unnecessary validation code still exist then?
Belt and suspenders? I like defense in depth for CI/release stuff, having been burnt so many times. Happy to remove if you prefer. |
The CACHE STRING fix (with unset workaround) makes -DLEAN_VERSION_* overrides work correctly, so stage0's hardcoded version is always overridden by CI. The validation is no longer needed. Co-Authored-By: Claude Opus 4.6 <[email protected]>
I've now removed the extra validation, and will merge. |
This PR fixes a parsing bug in \`release_checklist.py\` introduced by #12700, which reformatted \`src/CMakeLists.txt\` to use \`CACHE STRING \"\"\`: \`\`\`cmake set(LEAN_VERSION_MINOR 30 CACHE STRING "") \`\`\` The old code used \`split()[-1].rstrip(")")\` to extract the version number, which now yields \`""\` (the empty string argument) instead of the minor version. Use a regex to extract the digit directly. 🤖 Prepared with Claude Code Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This PR switches normal and nightly releases to use stage2 binaries instead of stage1, meaning that we no longer ship oleans built by stage0. Because of this, we no longer need to override stage0's version number and special description since they no longer end up in the resulting binaries, effectively reverting leanprover#12700 and simplifying our build setup. Non-release builds continue to use the original stage1 setup for resource/performance reasons. This change may also help with caching around stage0, and during development since the version numbers are no longer "sticky" (i.e. stuck to the values that the build directory was originally created with).
This PR fixes a CMake scoping bug that made
-DLEAN_VERSION_*overrides ineffective.The version variables (
LEAN_VERSION_MAJOR,MINOR,PATCH,IS_RELEASE) were declared with plainset(), which creates normal variables that shadow cache variables set by-Don the command line. The fix changes them toCACHE STRING ""to match the existingLEAN_SPECIAL_VERSION_DESCpattern.However,
CACHE STRING ""alone isn't sufficient becauseproject(LEAN CXX C)implicitly creates emptyLEAN_VERSION_{MAJOR,MINOR,PATCH}normal variables (CMake sets<PROJECT>_VERSION_*for the project name). These shadow the cache values, so weunset()them after the cache declarations to let${VAR}fall through to the cache.Closes #12681
🤖 Prepared with Claude Code