Skip to content

chore: bump olean header version and merge olean formats - #16214

Draft
nomeata wants to merge 3 commits into
masterfrom
joachim/olean-version-bump
Draft

nomeata wants to merge 3 commits into
masterfrom
joachim/olean-version-bump

Conversation

@nomeata

@nomeata nomeata commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

This PR bumps the .olean header version to 4 and merges the plain and the closures-capable formats into one, because #16107 changed the Expr hash function, whose results are stored in .olean files. External tools such as leantar reconstruct these hashes and key their behavior on the header version (see digama0/leangz#20).

CompactedRegion.save now always writes the same format, and allowClosures only decides whether a closure is an error. A file without closures is laid out as [header][data_size][root][objects][8 zero bytes], where data_size covers the root and the objects.

Since stage0 still writes version 2, this PR is tested with stage2 and updates stage0 on merge.

This needs a leantar release that accepts version 4 and a corresponding bump of LEANTAR_VERSION in CMakeLists.txt.

🤖 Generated with Claude Code

This PR bumps the `.olean` header version (to 4 for the plain format and 5 for the closures format) because #16107 changed the `Expr` hash function, whose results are stored in `.olean` files. External tools such as `leantar` reconstruct these hashes and key their behavior on the header version (see digama0/leangz#20).

The reader still accepts versions 2 and 3, which the current stage0 compiler writes; that can be dropped after the next stage0 update.

🤖 Built with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nomeata nomeata added the changelog-no Do not include this PR in the release changelog label Nov 3, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 3, 2026
This merges the plain and the closures-capable `.olean` formats into a single format with header version 4, which `CompactedRegion.save` writes regardless of `allowClosures`; that flag now only decides whether a closure is an error. A file without closures differs from the old plain format by a `data_size` slot before the data and an 8-byte trailer of zeros, so tools such as `leantar` can read it with little effort.

The trailer is now reserved in the compactor buffer in one call. `alloc` rounds up to 8 bytes, so the separate reservations would have reserved 16 bytes for 8 bytes of file content, and part base addresses could have disagreed with the addresses derived from file lengths.

The reader still accepts version 2, which the current stage0 compiler writes; that can be dropped after the next stage0 update.

🤖 Built with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nomeata nomeata changed the title chore: bump olean header version chore: bump olean header version and merge olean formats Nov 5, 2026
@nomeata
nomeata marked this pull request as ready for review November 5, 2026 18:01
This removes reading of version 2 `.olean` files. Stage1's library is written by the stage0 compiler in version 2, so stage1 can no longer load it; the stage0 `stdlib_flags.h` box is ticked so CI builds and tests stage2 instead, and `update-stage0` runs on merge.

🤖 Built with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nomeata
nomeata marked this pull request as draft November 6, 2026 11:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-no Do not include this PR in the release changelog toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant