vmname.VM is the name of every machine devvm runs on a backend: a
project VM, an image's machine (devvm-img-<key>), a build VM and a
remake's aside. Fields, parameters, results and map keys that held a VM's
name as a string now hold a VM, from the backend interface down to the
CLI's --json structs, whose output is byte for byte the same.
Boundary parsers, the only places a string becomes a VM:
- vmname.Parse: a project VM's name (state's vm.json name, export file
names, devvm _links's argument, the forwarder's -vm, project.Nth)
- vmname.ParseListed: one path element, for what a backend lists
- VM.UnmarshalText: JSON (Lima's list, proxy config and events, links'
targets in state, link lists); empty stays no VM
- vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs
- msg.M.VM: the VM a message's function took, read back
vmname's functions on names became methods (Hash, Slug, Short, Aside,
AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname;
vmname.Join joins VM lists. Messages' vm and vm_name fields are typed
by the generator. Seven messages whose field took something else became
what= (backend_lacks, backend_unreviewed, backend_unreviewed_used,
starting, deleting, configuring, running_script) and rm_vm_failed's
name=: the text is unchanged, the names-mode scripts follow.
Review.RequireFor names an image or the tools being built.
Typed sites per package (added lines with vmname.VM, non-test): msg 347
(generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22,
backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8,
ports 6, paths 3, sshagent 2, sshconfig 2, tools 2.
The structure test's owners rule now fails on a field, parameter or
result named for a VM (vm, vms, otherVM, vmName) typed string, []string
or map[string]…, and on converting anything but a literal to vmname.VM
outside the files it lists; internal/stubtest is free. depguard holds
internal/vmname to the standard library, and the proxy may import it.
ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
backend.Backend is Name, Caps and four roles, each required:
- Host: Problems, NameMax, Location, DiskDirs, Floors
- Images: BuildImage, Images, ImageSize, DeleteImage, BuildTools,
ToolFormat, KeyFiles
- Machines: CreateVM, Start, Running, ProxyURL, Stop, Delete, Rename,
List, Inspect, Exec, Shell, SSH, ForwardTarget
- Housekeeping: Usage, Strays, DevvmCache, DeleteCache
The optional interfaces Lima implemented (KeyFiles, Storage, Locator,
UsageReporter, StrayFinder, CacheCleaner) are gone into the roles, and
their callers call the methods directly; Forgetter stays the one
optional role, found with backend.As. Running(ctx, vm) returns a
backend.Run (ID, Confined, Lifeline) in place of StartID, Confined and
Lifeline. Space.Check, Space.Warning and LocationOf take a Host.
lima.Lima keeps its fields, Name, Caps and its shared helpers (14
methods), and embeds host, images, machines and housekeeping, each over
the Lima it's part of (withRoles); backendtest.Fake is split the same
way. The guard has every role's methods, its own for the ones it guards.
Structure test: max-methods counts an interface's declared methods too;
Lima and the fake leave largeTypes. Tests: TestRunning, TestGuardRoles,
TestAs (Forgetter), TestFakeRunningAndNone, two TestRulesFail cases.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm space [--json] lists each kind of thing devvm keeps, on every
backend, with its count, size (allocated blocks, as du), whether devvm
makes it again (remade, only copy, log, state, leftover), what devvm gc
frees of it now and what frees the rest, then a total: VMs and images
per backend, shared tool builds per backend and C library, exports,
network and run logs, devvm's own mise, the copies of devvm's files,
the leftover state of VMs their backend no longer has, and the rest of
devvm's state. The backends' own caches come apart and outside the
total: Lima's download cache, smolvm's caches on macOS (pack disks,
image disks, archives, registry; never its machines' folders) and
Docker's labelled volumes that aren't one VM's own.
backend.UsageReporter (optional): Lima, smolvm and Docker say what their
VMs and caches take. Each backend gets 30 s; one that doesn't answer is
named when a VM's state uses it (space_backend_unknown), and its VMs are
never counted as leftovers.
Each tool build now leaves <image>.target beside it (libc, format), so
listings tell a Lima, smolvm and Docker build of a version apart;
tools.Listed has Target, from the record or the target it's current for;
Share.Delete deletes the record too.
Messages: reading_space, space_failed, space_backend_unknown,
space_caches_note. Stubs: docker volume ls; smolvm machine ls fails with
smolvm-ls-fails. Docs: the What devvm keeps page leads with devvm
space; commands table; images' Cleaning up; CLI reference.
Review: space runs only listings (limactl list, smolvm machine ls and
data-dir, docker info, container ls/inspect --size, system df, volume
ls), each bounded by ctx with a timeout; the txtar checks no call
creates, deletes, starts, stops or edits. Backend caches aren't in the
total. Sizes checked against du on the e2e sandbox data and the user's
caches (Lima 9.1G, smolvm pack disks 20G, both match du -sh). APFS
clones count for both, as the page says.
Co-Authored-By: Claude Opus 5.5 <[email protected]>