feat: add lake build --summary flag#13454
Open
kim-em wants to merge 1 commit intoleanprover:masterfrom
Open
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
8d1fa40 to
d4bec36
Compare
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 19, 2026
This PR adds a standalone Python script that wraps `lake build`, captures its output, and for each failed module reports how many modules in the selected `lean_lib`s transitively import it. The count is an upper bound on how many downstream modules were blocked by the failure in the workspace. The script enumerates modules via `lake query <lib>:modules`, builds the forward import graph using batched `lake query +M:imports --json` calls, and inverts it locally. A batched query that fails (e.g. because one module has an unparsable header) is bisected down to singletons so one bad file doesn't drop the whole report. This is a follow-up to leanprover#13454 (which added `lake build --summary`). The original issue leanprover#13316 asked for blocked-downstream counts inside Lake itself; moving that computation to a standalone script keeps Lake's build-reporting path minimal and avoids re-parsing every workspace module from within the build runner. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This PR adds a `--summary` flag to `lake build` that prints a build summary table at the end, showing the number of jobs that succeeded, succeeded with warnings, and failed, along with a list of failed job captions. Closes leanprover#13316 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d4bec36 to
ea393b3
Compare
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Apr 21, 2026
This PR adds a standalone Python script that wraps `lake build`, captures its output, and for each failed module reports how many modules in the selected `lean_lib`s transitively import it. The count is an upper bound on how many downstream modules were blocked by the failure in the workspace. The script enumerates modules via `lake query <lib>:modules`, builds the forward import graph using batched `lake query +M:imports --json` calls, and inverts it locally. A batched query that fails (e.g. because one module has an unparsable header) is bisected down to singletons so one bad file doesn't drop the whole report. This is a follow-up to leanprover#13454 (which added `lake build --summary`). The original issue leanprover#13316 asked for blocked-downstream counts inside Lake itself; moving that computation to a standalone script keeps Lake's build-reporting path minimal and avoids re-parsing every workspace module from within the build runner. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tydeu
reviewed
Apr 21, 2026
Member
tydeu
left a comment
There was a problem hiding this comment.
Looking good! One big design question I have about this is how do you see this interacting with --wfail and --iofail? Currently, I believe these will all be bucket as failures with no granularity. Is that acceptable?
For my two cents, I would suggest bucketing the jobs independent of their success (i.e., without the !failed qualifier) and then determine whether to print "succeeded with" or "failed with" in the report based on the failLv. Would that be more helpful for the use cases you have in mind?
| if failed && !optional then | ||
| modify fun s => {s with failures := s.failures.push caption} | ||
| if !failed && !optional && action ≥ .fetch then | ||
| if log.entries.any (·.level ≥ .warning) then |
Member
There was a problem hiding this comment.
Suggested change
| if log.entries.any (·.level ≥ .warning) then | |
| if maxLv ≥ .warning then |
This is what maxLv is tracking.
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.
This PR adds a
--summaryflag tolake buildthat prints a build summary table at the end, showing counts of succeeded / succeeded-with-warnings / failed jobs plus a list of failed job captions:Counts only include jobs that performed actual build work (
action > .unknown), so infrastructure wrapper tasks are excluded. Warning classification useslog.entries.any (·.level ≥ .warning).For the "downstream blocked count" part of #13316, a separate follow-up PR will add
script/count-blocked-by-build-errorrather than building that reverse-import pass into Lake itself — see the Zulip thread. That keeps Lake's reporting path minimal and keeps the workspace-wide import-graph computation out of the build runner.Closes #13316
🤖 Prepared with Claude Code