Skip to content

feat(Cache): enable partial cache in downstream projects - #35415

Closed
joneugster wants to merge 7 commits into
leanprover-community:masterfrom
joneugster:eugster/cache_cleanup
Closed

joneugster wants to merge 7 commits into
leanprover-community:masterfrom
joneugster:eugster/cache_cleanup

Conversation

@joneugster

@joneugster joneugster commented Feb 16, 2026 •

Copy link
Copy Markdown
Member

Migrated to fork from: #21238.

Enable partial cache retrieval in downstream projects: lake exe cache get MyProject.Basic downloads only the relevant cache to build MyProject/Basic.lean


Notes:

Completed:

Open in Gitpod

@github-actions

github-actions Bot commented Feb 16, 2026 •

Copy link
Copy Markdown

PR summary 1c1dadbc28

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ isInLeanCore
- roots

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


No changes to strong technical debt.
No changes to weak technical debt.

@joneugster joneugster added t-meta Tactics, attributes or user commands CI Modifies the continuous integration setup or other automation labels Feb 16, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 19, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 27, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Mar 31, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 24, 2026
@kim-em

kim-em commented May 5, 2026

Copy link
Copy Markdown
Contributor

🤖 review by Claude

I tested this against a minimal downstream Lake project (single file importing Mathlib.Topology.Basic, depending on this branch via path =):

  • lake env cache get TestDownstream → TestDownstream is not covered by the olean cache. / No files to download / No cache files to decompress
  • lake env cache get Mathlib.Topology.Basic → works normally

So the headline feature from the description ("lake exe cache get MyProject.Basic downloads only the relevant cache") doesn't fire for downstream module names.

The new else branch in getHash correctly stores none and omits the downstream module from hashMap. But filterByRootModules (unchanged here) gates on hashMap.contains mod — false for downstream roots — and returns empty without ever consulting depsMap. insertDeps similarly requires (some deps, some hash) and won't recurse from a hash-less root. I think the missing piece is to traverse depsMap from a hash-less root and pull in its cached deps.

Minor:

  • Cache/Main.lean:111: inside if roots.isEmpty, roots.insert ... is equivalent to Std.HashMap.emptyWithCapacity.insert ... and shorter.
  • Cache/Hashing.lean:165: hashMap := stt.hashMap in the else with clause is a no-op.
  • Cache/IO.lean:25: isInLeanCore could use a docstring (and a note on why Std is included).

@kim-em kim-em added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. CI Modifies the continuous integration setup or other automation t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants