Fast import parser misreads module names starting with “all”, causing missed Lake rebuilds
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Read src/Lean/Elab/ParseImportsFast.lean around the keywordCore "all" call and matcher, then compare its behavior with the import grammar in src/Lean/Parser/Module/Syntax.lean. Reproduce with import allValues and the Lake build steps in the issue. Done when dependency discovery treats allValues as one module and changing it invalidates and recompiles the importer.
索引モデルが issue の本文から書いたものです。
説明
Description
The fast import parser reads import allValues as an import of module Values with the all modifier, rather than an import of the single module allValues.
Lake uses this result to discover dependencies, so the actual allValues dependency is omitted from the importer’s build dependencies. With previously built artifacts present, changing allValues can leave the importer incorrectly considered up to date, and lake --no-cache build ReproCheck reports success without recompiling it. This still occurs after explicitly rebuilding the changed dependency.
Context
This was found by comparing Lean’s normal import-header parser with the fast parser used for dependency discovery, then reproducing the discrepancy in a fresh project created with lake init.
- Normal import grammar: parses an optional
allkeyword followed by
the module identifier. - Fast import parser: calls
keywordCore "all"before parsing the
module identifier. - Fast keyword matcher: succeeds once the keyword characters
match, without checking for an identifier boundary. Consequently, it consumes theallprefix ofallValuesas a modifier.
Steps to Reproduce
-
Create a fresh project with an imported module and a valid proof:
elan toolchain install leanprover/lean4:nightly-2026-10-27 export PATH="$(elan run leanprover/lean4:nightly-2026-10-27 lean --print-prefix)/bin:$PATH" unset LEAN_PATH LEAN_SRC_PATH lean --version repro_dir=$(mktemp -d) cd "$repro_dir" lake init repro_check lib.toml cat >> lakefile.toml <<'EOF' [[lean_lib]] name = "allValues" EOF cat > allValues.lean <<'EOF' module /-! Dependency for the import-parser reproduction. -/ public abbrev reproValue : Nat := 7 EOF cat > ReproCheck.lean <<'EOF' module import allValues /-! This proof must be rechecked when the dependency changes. -/ example : reproValue = 7 := rfl EOF lake --no-cache build allValues lake --no-cache build ReproCheck
Both builds should succeed.
2. Change only the dependency from 7 to 8, leaving ReproCheck.lean and the existing build artifacts untouched:
cat > allValues.lean <<'EOF'
module
/-! Dependency for the import-parser reproduction. -/
public abbrev reproValue : Nat := 8
EOF
lake --no-cache build ReproCheck
Lake incorrectly reports success without rebuilding the changed dependency or rechecking the importer.
3. Explicitly rebuild the dependency, then compare Lake's incremental build with direct compilation:
lake --no-cache build allValues
lake --no-cache build ReproCheck
lake env lean ReproCheck.lean
The dependency build succeeds, compiling the value 8. The subsequent importer build still incorrectly reports success. However, direct compilation rejects the unchanged proof with a type mismatch: rfl cannot prove reproValue = 7. The final command is expected to exit with an error.
Expected behavior: Changing allValues.lean should invalidate ReproCheck's build. Building ReproCheck should rebuild the dependency, recompile the importer, and fail because its proof is no longer valid.
Actual behavior: Lake reports a successful incremental build using the stale importer artifact, even after the changed dependency has been explicitly rebuilt. Direct compilation correctly rejects the importer.
Versions
Lean (version 4.37.0-nightly-2026-10-27, x86_64-unknown-linux-gnu, commit 67bc4fe8130f9b5e1a073c73ed5cda09de6c63fe, Release)
OS: Ubuntu 24.04.5 LTS, x86_64.
Kernel: Linux 6.8.0-142-generic.
Additional Information
Originally reported by @clairew from Trail of Bits during the Patch the Planet drive.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
- 主要言語
- Lean
- スター
- 10.3k
- フォーク
- 1.1k
- 平均マージ
- 19時間 8分
- マージ済み PR(30日)
- 421
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
leanprover/lean4 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
leanprover/lean4#16681 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
leanprover/lean4#16305 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
leanprover/lean4#16299 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
leanprover/lean4#16257 ·
メンテナーはふだん 1 日以内に返信
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
leanprover/lean4#15683 ·
メンテナーはふだん 1 日以内に返信
leanprover/lean4 の issue をすべて見る
似ている issue
-
sync cache dist/imgオープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
oleeskild/digitalgarden#435 ·
-
iyi test: parallel builds race fetching a module into a cold cache (Directory not empty)対応中かも @sdogruyol が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Tarektouati/made#186 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
fluentmigrator/fluentmigrator#2463 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信