RFC: `lake shake` over the roots of two or more executables in one call
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- tooling
Research direction
Read Lake/CLI/Shake.lean for lake shake root handling and Lean/Environment.lean around ImportState.markAllExported; the proposal identifies both as change locations. The linked branch includes a test, so inspect it for the expected behavior and run the relevant Lake shake tests. Done means multiple executable roots are handled together, including grouped imports, with suggestions or --fix applied only after every group succeeds.
Written by the indexing model from the issue text.
Description
Proposal
lake shake refuses the roots of two or more executables in one call: each declares main, and loading them into one environment fails in finalizeImport:
error: import B failed, environment already contains 'main' from A
A project with two or more executables runs one lake shake per root, each loading its whole import closure again. Each call sees only the modules under its own roots, and on a project of ours, applying the suggestions of separate calls for two of its modules alone left five others unbuildable.
The proposal is to accept such roots in one call:
- Before
finalizeImport, everymainpast the first, with the declarations its own module names under it, gets a name of its own,<module>._shake_main, in its module and the modules importing it. - When the roots' modules don't load together, each root joins the first group whose modules, with its own, do, the groups checked within one process, each analysing the modules under all of the call's roots, so an edit in one group reaches the modules of a later group.
- With two groups or more, suggestions are printed, and
--fixwrites files, only once every group has succeeded;--add-downstreamis refused when the roots are split into groups.
User experience: one call checks all of a project's executables together, and when a module's re-export is removed, its dependents in other executables are told to import what they use.
Beneficiaries: projects with two or more executables. On a project of ours (not public) of 120 modules and 45 executables, one patched call over every module took 5.36 s of wall time, against 15.99 s for one unpatched call per module, 25 at a time.
Maintainability: the change adds to Lean/Environment.lean a structure and five functions on ImportState, documented as intended for shake only, beside ImportState.markAllExported, and the grouping to Lake/CLI/Shake.lean. A branch with the change and a test is ready. It was compiled and tested on the Lean nightly nightly-2026-11-16, whose Environment.lean and Shake.lean are those of the commit it is based on, and measured on v4.36.0-rc2.
Community Feedback
An issue search for shake found none about two or more executables in one call.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
gh-sync ship audits cards before writing station done, so every ship reports false STATUS findingsOpenharness
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mruangutai/harness#2455 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
zmkfirmware/zmk#3571 ·
Maintainers usually reply within 10 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Tarektouati/made#191 ·
Maintainers usually reply within 1 day
-
Extend .gitignoreOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
vitruv-tools/Vitruv-DSLs#736 ·
Maintainers usually reply within 1 day