Skip to content

v0.56.0

Latest

Choose a tag to compare

@github-actions github-actions released this 12 Nov 04:49
· 2 commits to master since this release
0ff7654
feat: make hermit gc collect unused state in the user cache (#642)

`hermit gc` has been a no-op since usage tracking was removed, because
updating a usage record on every exec was too expensive. As a result the
user cache grows without bound: every package version, download, link
farm and manifest source ever used stays on disk until `hermit clean`
wipes everything.

This restores GC by recording usage cheaply and collecting anything not
used within `--age` (default 168h).

- Usage is the modification time of the directory being used, updated at
most once an hour, so a frequently run binary costs one stat. Packages
are marked when unpacked or run. Activation marks every installed
package and the link farm, because linked binaries and variables such as
`JAVA_HOME` reach packages without going through Hermit.
- `hermit gc` removes unused packages (including staging directories
from interrupted unpacks), link farms, downloads and sources. It also
removes binary links and update-check records once their package is
gone. Hermit's own `hermit@*` packages are always kept, and packages
unpacked outside the state directory are never touched.
- The command no longer needs an environment, and shows a single
progress bar that grows as each phase starts and names the directory
being removed.

Two related fixes came out of testing this against a large cache:

- Removing a package now only makes directories writable before
deleting. Unlinking a file needs write permission on its parent alone,
so this avoids a stat and a chmod per file.
- Progress lines are kept within the terminal width. A wrapped line was
not cleared on redraw, which corrupted the output when many tasks were
shown.

Known limitation: usage is only recorded when Hermit runs, so a shell
left activated for longer than `--age` without running Hermit can lose
binaries reached through its link farm. Re-activating the environment
fixes it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>