Repository navigation
Read globs = [] as no glob, and finish the lean_lib refusal tests - #519
Merged
Merged
Conversation
Lake replaces a lean_lib's default of one glob per root with the globs array as written, so `globs = []` builds no module. lean_libraries stored it as () like a missing key, and builds, project_modules and library generate then fell back to the roots. LeanLibrary.globs is now None for a missing key and () for an empty array. When the impact probe loads a module whose source is captured but that no library builds, the refusal names that source instead of saying there is none. Review notes on #500: pin the strict module map for a nested library, the import-closure listing of a name declared in a file no library builds, the glob refusals under strict ownership, and builds against Lake's isBuildableModule rule. Review notes on #505: refuse-test a number, a mixed array, a nameless target after a named one and a non-string name; say "has no string name"; pin the ", written [[lean_lib]]" advice; and correct the CHANGELOG, since main skipped the bad entries of a mixed array.
Deicyde
marked this pull request as ready for review
October 31, 2026 04:53
Contributor
Author
|
Review at ccbef4a: merge. Nothing blocks merge, and there are no notes.
Checks
Posted by Claude Code (session jackmccarthy-eb). |
Deicyde
added a commit
that referenced
this pull request
Nov 1, 2026
Since #519, LeanLibrary.globs is None when a lean_lib sets no globs, and the scan iterated it directly.
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.
Follow-ups to #500 and #505 from their review notes (jackmccarthy-da on #500, jackmccarthy-63 on #505). One behavior fix, one reworded refusal, and tests.
Change
globs = []builds no module. Lake's TOML loader keeps an explicitglobsarray as written and only fills in its default, one glob per root, when the key is missing (decodeRootsinLake/Load/Toml.lean, v4.35.0). With no glob,isBuildableModuleis false for every module.lean_librariesstored[]as(), like a missing key, andbuilds,project_modulesandlibrary generatethen fell back to the roots, so they claimed or indexed modules Lake does not build.LeanLibrary.globsis nowNonefor a missing key and()for an empty array; aglobsvalue that is neither a string nor an array of strings is read as missing, as before.buildsandproject_modulesuse the roots only forNone._glob_directoriesreadsglobs or ().library generatetreats a library withglobs = []like any library with globs: a file under its roots that no glob selects is refused with the existing "no indexed library builds it" message. Without the key it still indexes the roots' directories and leaves the rest to the freshness check.lean_librariessees the change:skeleton,library generate,work impactandwork import-impact..olean, or alean_exeroot), the error was "loaded Foo without a captured root-project source". It is now "loaded Foo from Foo.lean, which no lean_lib builds". A module with no captured source keeps the old message. Exit status is 2 in both cases, as before.name = 1has a name. The CHANGELOG entry now says main also skipped the bad entries of a mixed array, not only crashed or read the default library.work impactreaches these refusals too, through_load_impact_evidence; Refuse a lean_lib that is not an array of named tables, and tidy lean_probe #505's description left it out.tests/test_lean_probe.py: the refusal matrix gainslean_lib = 3,[{name = "A"}, 1], a nameless target after a named one andname = 1, and both patterns now match the whole message, including ", written [[lean_lib]]". New:test_a_library_with_an_empty_globs_array_builds_no_module, andtest_builds_follows_lakes_buildable_module_rule, 14 cases coveringM,M.*,M.+, whole components, the root clause, a missing key and an empty array.tests/test_impact.py: the nested-library test also asserts the strict module map; new tests forglobs = []inproject_modules, for the import-closure listing of a name declared in a file no library builds (Claim a source file in import-impact only for a module Lake can build #500's change, which no test pinned), and the glob refusals now also run under strict ownership.test_lean_libraries_read_one_glob_or_an_arrayreadsNone,()and the odd[1].tests/test_library_generate.py:globs = []refuses every file under the root._librarytest helper passesNonewhen given no globs, so existing tests keep their meaning.globs." entry under Fixed, and the Refuse a lean_lib that is not an array of named tables, and tidy lean_probe #505 correction.Verification
checkpasses onautoform_cliand the changed tests.tests/test_lean_probe.py103 passed, 3 skipped (real Lean);tests/test_library_generate.py90 passed, 13 skipped;tests/test_impact.py147 passed, 8 skipped, 1 failed:test_unselected_source_with_a_quoted_module_name_stays_local, which fails the same way on main under Python 3.14.globs = []tests (probe, impact, generate), the()case of thebuildsmatrix, the updatedlean_librariestest and the reworded CLI refusal fail; everything else passes. With_module_source_pathsreverted to Claim a source file in import-impact only for a module Lake can build #500's predecessor rule (a root prefix alone claims the file), the new import-closure test fails.Overlap
LeanLibrary.globs.Not in this PR
library generatedecides what a library with globs builds from the globs alone, which matches whatlake build <lib>builds, not Lake'sisBuildableModule; that difference predates this PR and is deliberate there.globsvalue of the wrong type is still read as missing, where Lake refuses it.