leanprover / leanprover/lean4

RFC: Exclude `.lake` directory from backups with `CACHEDIR.TAG`

Open
#4,998 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Lake P-medium RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

The .lake/ directory contains remote sources and build artifacts for a project. Hence its contents can be automatically recreated from the rest of the project source. Such directories should be marked with a CACHEDIR.TAG file. This allows automatic backup tools (e.g. Restic, Borg and GNU tar) to ignore the contents of the directory when instructed (e.g. --exclude-caches flag on tar).

The only effect on users should be that their automatic backups may get smaller as the contents of .lake/ directory get excluded. In the rare case that files should be recovered from backups, the user needs to recompile their Lean projects. I would argue that this is a relatively minor inconvenience, and if this is a problem, the user should not have excluded caches from backups in the first place.

Other programming languages are already doing this. For example, Rust is excluding both target/ and ~/.cargo/{git,registry}/ directories.

Community Feedback

The feature was first proposed in the Lean Zulip. It got green light from @semorrison and @tydeu.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the repository entry point that creates or initializes the .lake/ directory; the issue does not name a file or test. Verify how CACHEDIR.TAG should be added there, then confirm that a newly created .lake/ contains the tag and remains usable for rebuilding Lean projects.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.