Repository navigation
fix: mathlib4 breakage from the batteries on_goal change - #130
Merged
Merged
Conversation
[batteries#1990](leanprover-community/batteries#1990) lets `on_goal` act on several goals at once: it adds `syntax goalNum := "-"? num` and replaces `elab "on_goal " reverse:"-"? n:num " => " seq:tacticSeq` with `elab "on_goal " ns:goalNum+ " => " seq:tacticSeq`, and `pick_goal` likewise. That breaks Mathlib twice. `Mathlib.Tactic.ClickSuggestions.Util` quotes `on_goal` in both pattern and term position, so `$n₁` is now a `TSyntax goalNum` where a `NumLit` is wanted and vice versa. Fixed as the author's own adaptation [mathlib4#44446](leanprover-community/mathlib4#44446) does, by annotating the three antiquotations `:num`. The `-` also used to be an atom of the tactic syntax and is now part of `goalNum`, so the generated syntax node kinds are renamed: `Batteries.Tactic.«tacticOn_goal-_=>_»` to `Batteries.Tactic.«tacticOn_goal_=>_»`, and `Batteries.Tactic.«tacticPick_goal-_»` to `Batteries.Tactic.tacticPick_goal_`. Mathlib's `multiGoal` and `unusedTactic` linters keep those kinds in exclusion lists written out by name, so after the rename every `on_goal` in Mathlib warns that it leaves goals untouched, and `--wfail` makes that a build failure. Renamed in both lists. 44446 does not carry this half, upstream Mathlib still building against the pre-#1990 batteries. Verified on 4cfce6c + nightly-2026-10-04: `lake build Mathlib Archive Counterexamples Wanted cache --wfail` (18352 jobs, no warnings), `lake test --iofail` (18868 jobs), `lake lint` all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
Author
Build report for fix: mathlib4 breakage from the batteries
|
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| mathlib4 | ✅ | ✅ in 19m 13s | ✅ in 51s | ✅ in 1m 30s |
| repl | ✅ in 0s | ✅ in 49s | ⏭️ |
Stayed red
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| cslib | 🟥 in 35s | ⏭️ | ⏭️ | |
| verso-slides | 🟥 in 26s | ⏭️ | ⏭️ |
Stayed green
| Repo | Critical | Build | Test | Lint |
|---|---|---|---|---|
| aesop | ✅ | ✅ in 0s | ✅ in 5s | ⏭️ |
| batteries | ✅ | ✅ in 0s | ✅ in 4s | ✅ in 2s |
| 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 1m 16s | ⏭️ | ⏭️ |
| BibtexQuery | ✅ in 3s | ⏭️ | ⏭️ | |
| comparator | ✅ in 2s | ⏭️ | ⏭️ | |
| doc-gen4 | ✅ in 7s | ⏭️ | ⏭️ | |
| illuminate | ✅ in 1s | ✅ in 10s | ⏭️ | |
| lean4-unicode-basic | ✅ in 0s | ⏭️ | ⏭️ | |
| lean4export | ✅ in 0s | ✅ in 7s | ⏭️ | |
| LeanSearchClient | ✅ in 0s | ✅ in 0s | ⏭️ | |
| leansqlite | ✅ in 7s | ✅ in 16s | ⏭️ | |
| nerodia | ✅ in 1s | ✅ in 21s | ⏭️ | |
| verso | ✅ in 1m 20s | ✅ in 2m 50s | ⏭️ | |
| verso-web-components | ✅ in 30s | ⏭️ | ⏭️ |
Member
|
@JovanGerb fyi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run 37207955571
on
nightly-2026-10-04went red inmathlib4(critical) andrepl, withcslibskipped behind
mathlib4. The cause is not the nightly — it is thedownstream: update repo batteriesmerge 4cfce6c, which brought inbatteries#1990.
mathlib4
batteries#1990 lets
on_goalact on several goals at once. It introducessyntax goalNum := "-"? numand replaces
elab "on_goal " reverse:"-"? n:num " => " seq:tacticSeqwithelab "on_goal " ns:goalNum+ " => " seq:tacticSeq, andpick_goallikewise.That breaks Mathlib in two independent ways.
1. The
on_goalquotations inMathlib.Tactic.ClickSuggestions.Util—$n₁is nowa
TSyntax goalNumwhere the code wants aNumLit, and the term-position quotationwants a
goalNumwhereSyntax.mkNatLitgives aNumLit. This is the only error CIreported. The fix is the author's own adaptation,
mathlib4#44446, applied
verbatim: annotate the three antiquotations
:num.2. The syntax node kinds were renamed. The
-used to be an atom of the tacticsyntax itself and is now part of
goalNum, so the generated kinds change:Batteries.Tactic.«tacticOn_goal-_=>_»Batteries.Tactic.«tacticOn_goal_=>_»Batteries.Tactic.«tacticPick_goal-_»Batteries.Tactic.tacticPick_goal_Mathlib's
multiGoalandunusedTacticlinters keep those kinds in exclusion lists,written out by name, so after the rename neither linter recognises
on_goalorpick_goalas focusing the goal any more and every use in Mathlib starts warning —--wfailturns that into a build failure. Renamed inMathlib/Tactic/Linter/Multigoal.lean(both entries) andMathlib/Tactic/Linter/UnusedTacticExtension.lean.44446 does not carry this half, because upstream Mathlib still builds against the
pre-#1990 batteries, where the old kinds exist and the exclusions work. Upstream will
need it at its next batteries bump.
(
Mathlib/Tactic/Linter/FlexibleLinter.lean:299holds a third such entry, under thepre-Batteries name
Std.Tactic.«tacticOn_goal-_=>_». It has been dead since therename to batteries and is left alone here — reviving it would change that linter's
output, which is not this breakage.)
Verified locally on 4cfce6c +
nightly-2026-10-04:lake build Mathlib Archive Counterexamples Wanted cache --wfail— 18352 jobs, nowarnings
lake test --iofail— 18868 jobslake lint—Linting passed for Mathlib.repl, whosetestphase failed on the very same module, needs no change of its own:lake buildandlake testpass here, including thetest/Mathlibbuild and theon_goalcase of thetest/*.insuite.Not fixed here
cslibandverso-slidesare the two repos this run left red that are already coveredby open PRs, and no second fix is opened for them:
cslib— #129, theSet.Finite.measure_lt_top_of_sigmaFiniteclash. It was skipped in this run behindmathlib4, so CI has not run it sincenightly-2026-10-03. Re-verified here on top ofthis commit, with fix: cslib breakage from mathlib gaining
Set.Finite.measure_lt_top_of_sigmaFinite#129 applied:lake build --wfail --iofail(6646 jobs),lake test --wfail --iofail(18601 jobs) andlake lintall pass.verso-slides— #126, theSubVerso.Examplesre-export. Re-verified with fix: verso breakage from the SubVerso examples-mechanism removal #126 applied:lake build(749 jobs)and
lake test -- --no-playwrightpass.Nothing was left unfinished: every phase of every repo in this run's red set passes
locally, given those two PRs.