The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).
The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.
devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.
Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm's files keep only Ubuntu's release (26.04) and its cloud image key.
The first build of base on a machine pins the newest dated release whose
SHA256SUMS carry a valid signature from that key and list an image for the
host (state.UbuntuPin, images/ubuntu.json), and every later build uses the
pin without looking anything up. devvm rebuild base pins the newest again.
The pin is in base's recipe, so base's key hashes it.
The signature is checked in Go (internal/ubuntu/pgp.go: OpenPGP v4 RSA
signatures with SHA-256/384/512, the standard library's crypto), so no
gpgv is needed and a host without one is no longer unchecked.
- backend.Images gains PinOrigin (backend.Pin: PinFirst, PinNewest,
PinOlder); internal/build pins before it keys a build, and says what it
pinned (origin_pinned).
- Lima: Origin and createFromUbuntu read the pin; PinOrigin finds the
newest with ubuntu.Finder (Newest, Release) under images/locks/ubuntu; a
--from conversion pins only when nothing is.
- Messages: ubuntu_unreachable and no_ubuntu_release; ubuntu_unsigned and
ubuntu_checksum_unpinned are gone.
- e2e pins its own release (DEVVM_UBUNTU_RELEASE, a test override;
scripts/bump.sh e2e-ubuntu moves it); bump.sh's apt moves the package
snapshot alone. The gpgv stub is gone.
- Tests: the verifier against Ubuntu's real signature and a test key
(damaged keys and signatures, packet and subpacket lengths, armor),
Newest/Release, PinOrigin, the pin record, and the key covering the pin.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A VM's state is vms/<hash>/vm.json: core fields (version, id, name,
alias, image, chain, from, dir, folder, backend, backend_at, created)
and one section per package, each a json.RawMessage its owner decodes
into its own type (state.Section, state.SetSection), what was asked for
at its top level and what devvm made under "made":
net (netpolicy), git (gitprotect), ports (the new internal/ports),
agent (sshagent), tools (tools), secrets (secrets), and size, clone,
devcontainer, desktop and links (vm, internal/vm/state.go).
- state.VM.Update takes vms/<hash>/lock (platform.LockFile), reads the
file again, applies a change and writes it once; a failed change, or
write, writes nothing. VM.Set and its calls are gone; read-modify-write
of lists (links, publish, secrets, tools, size, ports) happens inside
Update. VM.Claim also holds run/claims.lock, after the VM's own;
VM.Create writes a new VM's whole record once, its alias chosen
(sshconfig.ChooseAlias) under the claims lock. Reads take no lock.
- created replaces "net unset" as unfinished (VM.Finished).
- internal/ports: the ports section (forward, host.ssh/proxy/desktop),
ports.Used (was netpolicy.UsedPorts), and one Allocator for ssh, proxy
and desktop ports under the claims lock (desktop allocated without
one before; run/ports.lock and netpolicy's own ports key are gone).
- gitprotect: mode recorded before the backend makes the VM (NewMode;
clone for --clone, which ls and git-protect share as gitprotect.Mode);
made.git_id (platform.FolderID), one git_dirs list for modules and
embedded git dirs, delegations, protected; Unlock takes the union of
recorded and current git dirs.
- links' entries, git dirs, tools and devcontainer commands are JSON
lists, not strings in values; the key=value parser is gone.
- vm.checkState reads every section of the folder's VM as it's found.
- registry.For drops its unused Dirs.
- Tests: TestVMRoundTrip, TestVMOtherName, TestVMID, TestVMUpdate,
TestVMUpdateTogether (two writers on one VM and on crossed VMs),
TestVMClaim, TestVMFailures, TestVMCorrupt, TestChooseAliasTogether,
TestUsed, TestSSH, TestChooseTogether, TestUnlockRecorded,
TestCheckState, TestChangesTogether, TestChangesAtOnce; testscript's
vm_state, json_set with dotted and := keys; e2e's vm_state/vm_set.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every file devvm keeps for a project VM is in one folder, vms/<hash>/,
where <hash> is the 14-hex hash of the project folder's path that the VM's
name ends with: its state, its own rules (policy), its backend's files
(backend/: record.json, key, known_hosts, proxy, ports and the port
forwarder's ports.*), what its runs leave (run/: proxy.*, sandbox.sb,
started, lifeline.pid, secrets.*, links.*) and its logs (logs/:
network.jsonl, proxy.log, links.log). Build VMs keep the same layout in
run/builds/<name>/. The top-level run/ holds only what isn't one VM's or
must be short: the hashed control sockets, links' link-<hash>.sock/.ctl,
the QEMU wrapper and the ports lock.
A folder's VM is found by its path's hash (state.ReadHash), with the name
and backend its state records, so devvm --backend docker then devvm in
the same folder opens the one VM, and a backend's name limit applies to
new VMs only. The state records the VM's name and its ssh alias, chosen
once at creation (sshconfig.ChooseAlias) and never recomputed. Links'
targets match recorded names, aliases and folders (project.Targets).
One teardown (vmFolders.teardown) replaces Lifecycle.forget,
undoCreate's own list, Leftovers.Forget's, Proxy.Forget and space's
leftoverFiles: it stops the proxy and link session, then the pieces
outside the folder (clone remote or .git locks, other VMs' links and the
group, host keys, the backend's leftovers), removes the folder, and
writes the ssh config. Each backend's Delete and Forget remove the VM's
backend/ folder (vmssh.Forwards.Forget). A new VM made where an earlier
one's folder was left clears it first. devvm space counts an orphan's
whole folder as leftover state and the other VMs' logs as network logs.
Path builders move into paths: Dirs.VMDir, Dirs.VM and paths.VM's files
(secrets' BindingsFile/PolicyFile, netpolicy's run, EventLog, ProxyLog,
LinkList, VMPolicyFile, Lima's profileFile, startedFile, forwards.file,
vmssh.Forwards.file, links' LinksLog/linksPID, Docker's vmFile and
lifeline), ToolLockConfig, ToolLockChecked and ToolsCheckLog; the
user's cache folder for Lima's and smolvm's caches is Dirs.UserCache,
from HOME, not os.UserCacheDir. Dirs.VMState, LimaVMs, SmolvmVM and
DockerVM go. vmname.HashOf and IsHash, project.Hash.
The proxy takes the links' sockets' folder (-link-sockets, devvm's run
folder) apart from the links' list, which is in the VM's run folder.
Tests: a VM made and removed (rm, gc --orphans) leaves nothing under
vms/, and with network policy has no file named for it outside its
folder (TestTeardownLeavesNothing); a new VM over an old folder starts
clean; lookup finds a VM made on another backend with a long folder name
and makes no second one (TestLookupOtherBackend, and in docker.txtar);
the alias stays put when a second VM shares the folder name
(TestChooseAlias, ssh.txtar); every socket fits under a 35-character
home with the longest VM name (TestSocketsFit); space counts an
orphan's whole folder (TestLeftoverFolders); paths.VM's files; state by
hash and name; the proxy refuses a socket in the list's own folder.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN
and CFG by default, and adds stub_reset, catg (the one file a glob
matches), vm_name VAR NAME (the folder's VM) and project NAME [git];
script_cmds.txtar checks each. Every script is rewritten onto them, its
assertions kept; TestCommandLines leaves the scripts' own commands out.
mise run test runs scripts/test.sh: the tests as before, with the CLI
tests' devvm built with -cover for every package (CLI_GOCOVERDIR),
merged with the Go tests' counters by go tool covdata, then
scripts/coverage.sh holds each package to testdata/coverage/<os>.txt.
mise run coverage raises the baselines; coverage.txtar checks the
comparison. The macOS baseline is recorded from this tree.
Co-Authored-By: Claude Opus 5.5 <[email protected]>