Skip to content

fix: batteries breakage from the upstream shake import minimization - #137

Merged
Kha merged 1 commit into
masterfrom
fix-batteries-shake-import
Oct 6, 2026
Merged

Kha merged 1 commit into
masterfrom
fix-batteries-shake-import

Conversation

@Kha

@Kha Kha commented Oct 6, 2026

Copy link
Copy Markdown
Member

Split out of #134: this is its batteries commit on its own, unchanged (b3bd4b838), so it can land independently of the cslib half.

master is red in run 37404438445 on nightly-2026-10-05: batteries fails to build, and aesop, mathlib4 and cslib are skipped behind it.

batteries — Trie.asNode is in Lean.Meta.DiscrTree.Util, not .Types

downstream: update repo batteries merged batteries' main into nightly-testing and so brought in chore: shake (batteries#2005), a repo-wide import minimization computed on the v4.35.0-rc3 toolchain. It replaced public import Lean.Meta.DiscrTree by public import Lean.Meta.DiscrTree.Types in Batteries/Lean/Meta/DiscrTree.lean. That is correct on main, where Trie.mergePreservingDuplicates pattern-matches the node constructor directly. It is not correct on nightly-testing, which carries the adaptation to lean4#14805's new Trie.chain constructor and therefore goes through Trie.asNode / Trie.mkNode — and those live in Lean.Meta.DiscrTree.Util. The merge combined main's import line with nightly-testing's body, so the module fails with

Invalid field `asNode`: The environment does not contain `Lean.Meta.DiscrTree.Trie.asNode`
Unknown constant `Lean.Meta.DiscrTree.Trie.mkNode`

Fixed by importing Lean.Meta.DiscrTree.Util, which publicly imports .Basic and hence .Types, so Key, Trie and DiscrTree stay in scope.

Not covered here

With batteries building again, CI reaches cslib, which then fails on the removal of PMF.uniformOfFinset / PMF.uniformOfFintype (mathlib4#42909). That fix stays in #134, so this PR alone is not expected to turn master fully green.

Verification

Not re-run for this split: the commit is byte-identical to the one in #134 and sits on the same master parent (7768fa695). There it was verified on nightly-2026-10-05 with lake build --wfail, lake test and lake lint in batteries.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XyR8dP17VkvXwNSrqLMRcq

`downstream: update repo batteries` merged batteries `main` into
`nightly-testing` and so brought in `chore: shake` (batteries#2005), a
repo-wide import minimization computed on the `v4.35.0-rc3` toolchain. It
narrowed `Batteries/Lean/Meta/DiscrTree.lean` to `public import
Lean.Meta.DiscrTree.Types`, which is correct on `main`, where
`Trie.mergePreservingDuplicates` matches the `node` constructor directly,
but not on `nightly-testing`, which carries the adaptation to lean4#14805
and its new `Trie.chain` constructor and therefore goes through
`Trie.asNode` / `Trie.mkNode`. Those live in `Lean.Meta.DiscrTree.Util`,
so the module failed with

    Invalid field `asNode`: The environment does not contain
    `Lean.Meta.DiscrTree.Trie.asNode`
    Unknown constant `Lean.Meta.DiscrTree.Trie.mkNode`

Import `Lean.Meta.DiscrTree.Util` instead; it publicly imports `.Basic`
and hence `.Types`, so `Key`, `Trie` and `DiscrTree` stay in scope.

Verified with `lake build --wfail`, `lake test` and `lake lint`.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Kha
Kha enabled auto-merge (squash) October 6, 2026 08:17
@Kha
Kha disabled auto-merge October 6, 2026 08:17
@Kha
Kha merged commit db0c600 into master Oct 6, 2026
1 check passed
@downstream-lean4

Copy link
Copy Markdown
Contributor

Build report for fix: batteries breakage from the upstream shake import minimization

Turned green:

Repo Critical Build Test Lint
aesop ✅ ✅ in 16s ✅ in 5s ⏭️
batteries ✅ ✅ in 1s ✅ in 4s ✅ in 2s
mathlib4 ✅ ✅ in 18m 21s ✅ in 48s ✅ in 1m 31s
repl ✅ in 0s ✅ in 52s ⏭️
Stayed red
Repo Critical Build Test Lint
cslib 🟥 in 31s ⏭️ ⏭️
Stayed green
Repo Critical Build Test Lint
import-graph ✅ ✅ in 2s ✅ in 4s ⏭️
lean4-cli ✅ ✅ in 0s ✅ in 0s ⏭️
plausible ✅ ✅ in 0s ✅ in 2s ⏭️
ProofWidgets4 ✅ ✅ in 1s ✅ in 1s ⏭️
quote4 ✅ ✅ in 0s ✅ in 1s ⏭️
reference-manual ✅ ✅ in 11s ⏭️ ⏭️
BibtexQuery ✅ in 1s ⏭️ ⏭️
comparator ✅ in 2s ⏭️ ⏭️
doc-gen4 ✅ in 1s ⏭️ ⏭️
illuminate ✅ in 1s ✅ in 10s ⏭️
lean4-unicode-basic ✅ in 0s ⏭️ ⏭️
lean4export ✅ in 0s ✅ in 7s ⏭️
LeanSearchClient ✅ in 0s ✅ in 0s ⏭️
leansqlite ✅ in 3s ✅ in 16s ⏭️
nerodia ✅ in 1s ✅ in 21s ⏭️
verso ✅ in 15s ✅ in 2m 54s ⏭️
verso-slides ✅ in 29s ✅ in 8s ⏭️
verso-web-components ✅ in 24s ⏭️ ⏭️

View run

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant