Skip to content

fix: error on unknown package names in lake update - #14630

Merged
tydeu merged 5 commits into
leanprover:masterfrom
sankalpsthakur:fix-lake-update-unknown-pkg-12005
Aug 2, 2026
Merged

fix: error on unknown package names in lake update#14630
tydeu merged 5 commits into
leanprover:masterfrom
sankalpsthakur:fix-lake-update-unknown-pkg-12005

Conversation

@sankalpsthakur

@sankalpsthakur sankalpsthakur commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This PR makes lake update <pkg>... fail with a clear error when a specified package name is not known to the current dependency manifest. Previously, unknown or misspelled names (including case mismatches) were silently ignored, which was confusing.

Summary

Selective-update names are validated inside reuseManifest against the already loaded manifest, avoiding a duplicate manifest load. This preserves Lake's ability to update a package that remains recorded in the manifest after its direct require was removed, while rejecting names that are genuinely unknown. Matching is case-sensitive, following Lake's existing package-name semantics.

Unknown names produce a non-zero exit with:

error: unknown package `does-not-exist`

Successful paths are unchanged:

  • bare lake update (update all dependencies)
  • lake update <valid-dep> (selective update of a known dependency)
  • selective update of a package retained in the manifest after its require was removed

Changes

  • src/lake/Lake/Load/Resolve.lean: validate toUpdate names in reuseManifest using the manifest that function already loaded; the detailed contract docstring lives there
  • tests/lake/tests/updateUnknown/: focused CLI coverage for unknown names, case mismatches, mixed valid/invalid args, successful paths, and a retained manifest package

Validation

  • Confirmed stock Lake (v4.32.2) exits 0 with no error for lake update does-not-exist (repro of the bug)

  • Full Lean bootstrap / Lake rebuild was not run locally because Lean is unavailable in the execution environment

  • The focused test runs under the normal Lake test suite in CI:

    tests/lake/run_test.sh tests/updateUnknown
    

AI disclosure

AI tools assisted with locating the Lake update path, drafting the change, and preparing the PR. I reviewed the logic against reuseManifest, selective-update behavior, and Lake's existing unknown package error style.

Closes #12005
Closes #2772

This PR makes `lake update <pkg>...` fail with a clear error when any
specified name is not a direct dependency of the root package.
Previously, unknown or misspelled names (including case mismatches)
were silently ignored.

Closes leanprover#12005
@sankalpsthakur
sankalpsthakur requested a review from tydeu as a code owner August 1, 2026 10:13
Validating only current root requires broke `lake update <pkg>` after a
require is removed (e.g. depTree's `lake update c` to drop c from the
manifest). Accept names that appear in the existing manifest as well as
current root dependencies; still error on truly unknown names.
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

Pushed a fix so selective lake update still accepts packages present in the manifest (restores depTree); could a maintainer please add the changelog-lake label? External contributors cannot add labels.

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 1, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ea9fad0706f0b1da2467195dae75480595640670 --onto 5b8d06c1764fa367a1e27b3e89f64667eac425af. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-01 10:37:08)

@leanprover-bot

leanprover-bot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase ea9fad0706f0b1da2467195dae75480595640670 --onto a39eab69e1eee9ad38f4efe507907b1026a77808. You can force reference manual CI using the force-manual-ci label. (2026-08-01 10:37:09)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase ea9fad0706f0b1da2467195dae75480595640670 --onto 23393b959b33e3a8d15796b2397f8a04c315b9f4. You can force reference manual CI using the force-manual-ci label. (2026-08-01 19:11:28)

@tydeu tydeu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like the check! However, I have some comments on code location (see below).

Comment thread src/lake/Lake/Load/Resolve.lean Outdated

Copy link
Copy Markdown
Contributor Author

@tydeu The requested relocation is complete: validation now lives in reuseManifest, uses the already-loaded manifest, and the detailed contract is documented there. The retained-manifest-package regression is included and current Lean CI is green. Ready for re-review.

@tydeu tydeu added the changelog-lake Lake label Aug 1, 2026
@tydeu
tydeu added this pull request to the merge queue Aug 1, 2026
@tydeu

tydeu commented Aug 1, 2026

Copy link
Copy Markdown
Member

LGTM! Thank you! 🎉

Copy link
Copy Markdown
Contributor Author

Thanks for the re-review. GitHub still shows the earlier CHANGES_REQUESTED review as the latest formal review state even though the thread is resolved and you confirmed LGTM. Could you please submit an approval or dismiss the stale review when convenient so the PR is no longer blocked administratively?

Merged via the queue into leanprover:master with commit 05a6ddf Aug 2, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-lake Lake toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lake update nonexistant-pkgs does not complain lake update silently fails when argument does not exists

3 participants