Files
devvm/testdata/script
w3cjandClaude Opus 5.5 5bfb89c371 feat(gc): gc --caches frees devvm's share of the backends' own caches
Lima's download cache (9.1G on the user's machine) and smolvm's caches
(22G) are filled by devvm's builds but are the backends' own and hold
the user's own downloads too. devvm never prunes them on its own and
never runs limactl prune, smolvm pack prune or smolvm machine prune
(each reaches the user's own entries). gc --caches, only in a terminal
(gc_caches_need_terminal otherwise, before anything is deleted), then
lists devvm's share of each backend's cache with sizes and asks for
each backend apart (backend.CacheCleaner):

- Lima: entries of download/by-url-sha256 whose url hashes to the
  folder's name and is Ubuntu's cloud image at the address devvm
  downloads base from, for its release, a dated release, that no image
  record names, unchanged for an hour (a build may be downloading).
  Lima copies a VM's disk out of the cache, so no VM needs an entry.
- smolvm (macOS): the disks smolvm unpacks of each pack
  (vms/_pack-storage-seeds/v2-<sha256 of the .smolmachine>-auto, found
  on the user's machine: 20G of the 22G), tied to devvm's packs by their
  SHA-256 - packs devvm has, and every pack it makes from now on, which
  smolvm/packs records - that no machine of devvm's was made from,
  unchanged for an hour, with their lock files. Disks of packs that
  are gone and unrecorded can't be tied to devvm and stay; so do the
  machines' folders and smolvm's other caches. On Linux smolvm's state
  is devvm's own folder: nothing listed.
- Docker: volumes with devvm's label that no VM has, not the tools'
  volume, not one of a VM devvm has state for (a VM being made makes
  its volumes before its container). Never an unlabelled one, never a
  prune.

Each delete checks the entry again first. With --backend, only that
backend's cache.

Messages: gc_caches_need_terminal, gc_cache, gc_cache_entry,
gc_cache_confirm, deleted_cache. Docs: the What devvm keeps page (the
backends' caches, Lima, smolvm, Docker), backends/smolvm.md's Cleaning
smolvm's caches, backends/lima.md, the uninstall steps,
using/images.md's Cleaning up, the CLI reference.

Review (touches nothing of the user's): limactl prune empties the
whole cache and isn't used; --keep-referred would see only devvm's
Lima home. smolvm pack prune removes any unused cached extraction,
the user's own packs' included, and machine prune works on a named
machine's images; neither is used. Lima entries are tied by address
and hash, smolvm disks by the SHA-256 of devvm's own packs, Docker
volumes by devvm's label. Tests: lima TestDevvmCache (your download, a
recorded release, one being written, a wrong layout, another file
kept); smolvm TestDevvmCache (a VM's pack, someone else's, a recent
disk, a machine's folder kept; a recorded deleted pack's disk freed;
Linux lists none), TestPackRecorded; docker TestDevvmCacheVolumes (a
VM's, the tools', one being made, someone else's kept); gc_caches.txtar
(refused without a terminal before anything is deleted; the default run
leaves the caches).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:08:52 -07:00
..
2026-10-25 13:43:00 -06:00