Skip to content

refactor(Cache): tidy lake-manifest parsing in Cache - #8767

Closed
eric-wieser wants to merge 11 commits into
masterfrom
eric-wieser/improve-cache
Closed

eric-wieser wants to merge 11 commits into
masterfrom
eric-wieser/improve-cache

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Dec 1, 2023 •

Copy link
Copy Markdown
Member

This now respects local copies of Mathlib dependencies (though in practice these invalidate the online cache because to point to local copies of Mathlib, the hash for lakefile.lean and lake-manifest.json is first invalidated).


Open in Gitpod

Comment thread Cache/IO.lean Outdated
else -- only mathlib files, when not in the mathlib4 repo, need to be redirected
config.push <| .mkObj [("file", pathStr), ("base", mathlibDepPath)]
if let some base := findRoot path then
config.push <| .mkObj [("file", pathStr), ("base", toString base)]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@digama: this doesn't seem to be working properly for Std, but I can't see what LeanTar is doing with my base argument.

Can you teach it a verbose mode that prints out where the extracted files are being written to?

@digama0 digama0 Dec 11, 2023 •

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.

The else config looks suspicious, that means to skip the file entirely.

The way this works is that you pass a json argument containing either pathStr or {"file": pathStr, "base": base}, and base, if provided, overrides the baseDir which is passed as the -C argument (with default value .). This says to decompress pathStr which is an ltar file, with base as the base for all generated files. The ltar file contains a list of relative paths and these are joined to base.

For the usual ltars generated by CI, the paths will be of the form:

  • .lake/build/lib/Mathlib/Tactic.trace (and .lake/build/lib/Mathlib/Tactic.{olean,ilean,c}[.hash]) for files in mathlib
  • .lake/build/lib/proofwidgets/.lake/build/lib/ProofWidgets/Compat.trace (etc) for files not in mathlib

If you would like to trim these paths to something shorter, you can do so by setting the -C argument appropriately during the packing stage. (But don't forget to do something to change the root hash such as adding whitespace in lake-manifest.json, because these ltars will not be compatible with previous builds.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks!

lake/build/lib/proofwidgets/.lake/build/lib/ProofWidgets/Compat.trace looks like a bad path to me. Did you mean lake/packages/proofwidgets/.lake/build/lib/ProofWidgets/Compat.trace?

@digama0 digama0 Dec 11, 2023 •

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.

yes. .lake/packages/proofwidgets/.lake/build/lib/ProofWidgets/Compat.trace more specifically. (A cheap way to find out without additional tooling is strings NNN.ltar | grep proofwidgets, where NNN.ltar is the output of lake exe cache lookup ProofWidgets/Compat.lean)

Comment thread Cache/IO.lean Resolved
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jan 7, 2024
@ghost ghost added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) labels Mar 19, 2024
@ghost

ghost commented Mar 19, 2024

Copy link
Copy Markdown

This PR/issue depends on:

@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Mar 19, 2024
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 2, 2024
@github-actions

github-actions Bot commented Aug 5, 2024 •

Copy link
Copy Markdown

PR summary bf64581eac

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ findRoot
+ parseManifestPaths
- isPathFromMathlib

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.

@eric-wieser eric-wieser removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 5, 2024
@joneugster joneugster added the t-meta Tactics, attributes or user commands label Aug 14, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 12, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Mar 11, 2025
…in leantar files (#21848)

See review comments in #8767 for more context.
tukamilano pushed a commit that referenced this pull request Mar 20, 2025
…in leantar files (#21848)

See review comments in #8767 for more context.
idontgetoutmuch pushed a commit to idontgetoutmuch/mathlib4 that referenced this pull request Apr 7, 2025
@joneugster

Copy link
Copy Markdown
Member

Mathlib has moved to PRs from forks. This PR is still from a branch of the main repository and will soon be closed! Please migrate the content to a fork and reopen a PR from there if you wish to do so. See Zulip topic for more instructions. Thank you for contributing to mathlib!

@joneugster joneugster added the will-close-soon Unless something changes, we will close this PR soon label Sep 19, 2026
@joneugster joneugster closed this Oct 24, 2026
@YaelDillies
YaelDillies deleted the eric-wieser/improve-cache branch October 24, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-meta Tactics, attributes or user commands will-close-soon Unless something changes, we will close this PR soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants