Skip to content

fix: batteries breakage from lean4#16557 — #do command must build Do.Context.controlInfoCache - #271

Merged
Rob23oba merged 1 commit into
masterfrom
push-skmqvywqttos
Nov 21, 2026
Merged

Rob23oba merged 1 commit into
masterfrom
push-skmqvywqttos

Conversation

@downstream-lean4

Copy link
Copy Markdown
Contributor

Run 44844350878 on nightly-2026-11-20. This fixes the run's new breakage, batteries (critical), which took aesop, mathlib4 and cslib down with it as skips. The rest of the red set is carried by PRs that are already open — reference-manual by #268, and mathlib4 + repl by #270 (approved) — so this PR's own CI stays red on reference-manual until those merge.

batteries — Do.Context gained a field, and #do builds one by hand

lean4#16557 ("perf: memoize the control information of do sequences", @sgraf812, in nightly-2026-11-20) added a field with no default to Lean.Elab.Do.Context:

  /-- The `ControlInfo` of the `doSeq` nodes of this `do` block inferred so far. -/
  controlInfoCache : ControlInfoCache

The downstream: update repo batteries merge at the head of this run then brought in batteries#1962 ("feat: #do command", @Rob23oba), whose elabDoCommandCore assembles a Do.Context itself rather than going through Do.mkContext. That file was written against batteries main, which still pins v4.37.0-rc1, so on the nightly it fails:

error: Batteries/Tactic/DoCommand.lean:213:15: Fields missing: `controlInfoCache`

Batteries.Tactic.DoCommand is reachable from the Batteries root module, so this is a critical-repo build failure, and aesop, mathlib4 and cslib were all skipped behind it.

The fix

One field, a fresh cache, exactly what core's own Do.mkContext writes:

      controlInfoCache := ← ControlInfoCache.new

A ControlInfoCache memoizes the inferred ControlInfo of the doSeq nodes within one do block; #do elaborates one doSeq per invocation, so there is nothing to carry across calls and no reason to park a cache in DoCommandExtensionState next to the local context and the mut variables.

Upstream batteries cannot see this yet: nightly-testing is on nightly-2026-11-20 and carries the same unadapted file (byte-identical), and there is no batteries PR open that mentions controlInfoCache or lean4#16557 — so the same fix is wanted there.

Verified

  • batteries: lake build --wfail (531 jobs), lake test (including the new BatteriesTest.do_command) and lake lint.
  • aesop: lake build --wfail and lake test, the two phases CI skipped (no lint driver).
  • mathlib4: lake build Mathlib Archive Counterexamples Wanted cache --wfail (18647 jobs), lake test --iofail (19211 jobs) and lake lint, with fix: mathlib4 breakage from importGraph#193 — #import_diff reserved the all token #270's import-graph fix applied locally, since mathlib4 does not parse without it.

repl was not rebuilt: it is noncritical, and the sites it failed at are #270's. cslib is left to mathlib-nightly-testing as before.

…Do.Context.controlInfoCache`

lean4#16557 ("perf: memoize the control information of `do` sequences",
nightly-2026-11-20) added a `controlInfoCache : ControlInfoCache` field, with no
default, to `Lean.Elab.Do.Context`. The `downstream: update repo batteries` merge
then brought in batteries#1962 ("feat: `#do` command"), whose `elabDoCommandCore`
assembles a `Do.Context` by hand. That file was written against batteries `main`,
which still pins `v4.37.0-rc1`, so `Batteries.Tactic.DoCommand` now fails with
Fields missing: `controlInfoCache`.

Pass a fresh cache at that site, as core itself does in `Do.mkContext`
(`controlInfoCache := ← ControlInfoCache.new`). The `#do` command elaborates one
`doSeq` per invocation, so there is nothing to share between calls.

Verified: batteries `lake build --wfail`, `lake test` (including the new
`BatteriesTest.do_command`) and `lake lint` all green.
@downstream-lean4
downstream-lean4 Bot requested a review from sgraf812 November 21, 2026 00:58
@downstream-lean4

Copy link
Copy Markdown
Contributor Author

Build report for fix: batteries breakage from lean4#16557 — #do command must build Do.Context.controlInfoCache

Turned green:

Repo Critical Build Test Lint
aesop ✅ ✅ in 0s ✅ in 3s ⏭️
batteries ✅ ✅ in 1s ✅ in 3s ✅ in 1s
Stayed red
Repo Critical Build Test Lint
mathlib4 ✅ 🟥 in 3s ⏭️ ⏭️
reference-manual ✅ 🟥 in 5s ⏭️ ⏭️
cslib 🛑 by mathlib4 ⏭️ ⏭️
repl ✅ in 0s 🟥 in 17s ⏭️
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 0s ✅ in 0s ⏭️
quote4 ✅ ✅ in 0s ✅ in 0s ⏭️
BibtexQuery ✅ in 1s ⏭️ ⏭️
doc-gen4 ✅ in 1s ⏭️ ⏭️
illuminate ✅ in 0s ✅ in 9s ⏭️
lean4-unicode-basic ✅ in 0s ⏭️ ⏭️
lean4export ✅ in 0s ✅ in 5s ⏭️
LeanSearchClient ✅ in 0s ✅ in 0s ⏭️
leansqlite ✅ in 2s ✅ in 19s ⏭️
nerodia ✅ in 0s ✅ in 22s ⏭️
verso ✅ in 17s ✅ in 3m 34s ⏭️
verso-slides ✅ in 4s ✅ in 8s ⏭️
verso-web-components ✅ in 0s ⏭️ ⏭️

View run

@Rob23oba

Copy link
Copy Markdown
Contributor

LGTM so I'll merge this as trivial

@Rob23oba
Rob23oba merged commit 1f60d99 into master Nov 21, 2026
18 of 23 checks passed
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