Commit Graph
321 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 c40f9bbf74 fix(sshconfig): change known_hosts under its own lock
Pinning or forgetting a VM's host keys takes known_hosts.lock (an OS file lock, paths.Dirs.KnownHostsLock), reads the file again inside it and writes it whole with state.WriteFile, so two devvms at once lose neither's pin. ForgetHostKeys takes its caller's ctx. TestHostKeyConcurrent holds two pins' reads until both have read; it fails on the unlocked code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:38:27 -07:00
w3cjandClaude Opus 5.5 329e31be1d refactor(secrets): the proxy looks secrets up in-process, from one versioned bindings file
The proxy no longer runs devvm secret get for a value: proxy.IO.Secret,
which devvm _proxy sets to secrets.Store.Get, looks a binding's value up
in the proxy's own process (Keychain, devvm's secrets folder, or the
agent's login file), so internal/proxy stays standard library only.
Config.SecretCmd (secret_cmd) and the hidden devvm secret get command go,
with secret_to_terminal and secret_read_failed; Main refuses a config
with secrets and no IO.Secret.

One binding type, proxy.Binding, with kind secret|login and a login's
agent, in proxy.BindingList ({"version": 1, "bindings": [...]}), written
by secrets.Store (Encode) and read by the proxy and RefreshFiles with
proxy.ReadBindings (private regular file, no link, 1 MiB, version and
kinds checked; an unreadable file has no bindings). It replaces
proxy.binding, secrets.binding and agentlogin.Binding; the kind replaces
the name-prefix classifiers in proxy.ttlOf, secrets.loginOf and
RefreshFiles' Lookup check; proxy.InterceptLines replaces
agentlogin.Hosts and RefreshFiles' host loop.

agentlogin's user-actionable errors are typed (ErrCodexNoKey,
ErrCodexNoChatGPT, RefreshError) and secrets maps them to messages:
codex_no_key, codex_no_chatgpt, codex_refresh_failed,
opencode_refresh_failed, and login_read_failed for the rest.

Tests: proxy TestSecretValueLooksUpInProcess, TestReadBindings,
TestBindingsUnreadableHaveNone, ttlOf by kind, Main refusing secrets
without a lookup and -secret-cmd, config refusing secret_cmd; secrets
TestGet by kind, TestLoginFailed; agentlogin TestCodexBindings (kind and
agent checked on every binding), TestGetErrorsSayWhatToDo; secret.txtar
and network.txtar on the new file and without secret get; e2e's network
section keeps the fake token off argv and checks no command prints it.

Docs: the proxy README (Secrets section), internals/network.md,
safety/network.md, using/coding-agents.md, contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:35:25 -07:00
w3cjandClaude Opus 5.5 cab497bc8f feat(layer): devvm layer add makes the folder's VM again with more layers, keeping its home and settings
The one remake in vm's Lifecycle (remake.go): the image built first, the
agents' history exported and the home folder saved (home.go: the VM's tar
stream filtered on the host), the VM stopped and its machine renamed
aside (backend.Backend's Rename, limactl rename, vmname.Aside), the new
machine made from vm.json, started, its home put back, then the old one
deleted. A failure or interrupt before that puts the old VM back; a
killed devvm leaves the remake section, which the next devvm or devvm
layer add finishes. The VM keeps its ID (design.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:58:21 -07:00
w3cjandClaude Opus 5.5 619570e445 refactor(backend): backend.Check, the specs' Validate and the registry's guard
backend.Check(ctx, b) returns the first of a backend's Problems, in place
of Check in the Backend interface (Lima's and the fake's go).

ImageSpec.Validate and ToolsSpec.Validate hold the build specs' checks
Lima made itself: a layer from a container image, a network that isn't a
build's, a key that isn't one, a tools format other than the backend's,
folders that aren't absolute. ToolsSpec gets Name, what it builds, for
the refusal's vm.

The registry hands out each backend behind a guard: CreateVM, Start,
BuildImage and BuildTools run the spec's Validate and the review's
refusal for spec.Features() (VMSpec's, Want's and Confinement's,
ImageSpec's, ToolsSpec's) before the backend sees them, without a second
warning for an unreviewed emulation let through. Callers' own Require
calls stay as the clear error path; the guard is the backstop.
Want.Features is new; VMSpec.Features uses it and adds agent-toggle when
the VM is made ready for it. backend.As finds a backend's other
interfaces behind the guard (KeyFiles, Storage, Locator, Forgetter,
UsageReporter, StrayFinder, CacheCleaner).

Structure test: execSites lists the 17 files whose 24 exec.Command*
calls stay, each with why (they make a command a runner runs, or one
that streams, asks on the terminal, outlives the run or carries a
secret); a host command made anywhere else fails, as does a listed file
making none. guardOwner: a type assertion or type switch to a backend
package's type outside guard.go fails (use backend.As). TestRulesFail
cases for both.

Tests: TestCheck, TestImageSpecValidate, TestToolsSpecValidate,
TestGuardRefuses, TestGuardLetsThrough, TestAs; TestFeaturesNeeded
gains Want's and agent-toggle; Lima's refuse cases for what Validate
owns move to the backend package.

Docs: internals/backends.md (the guard behind the first check);
contributing's How a backend plugs in (Check, the guard, Validate, As),
the structure test's execSites and guardOwner, and the owners table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:13:57 -07:00
w3cjandClaude Opus 5.5 361087f95a refactor(proxy): host-only modes out of proxy.Main, into agentlogin and trust
devvm _proxy takes one flag, -config, and running the proxy is Main's only
mode. What only the host does runs in devvm itself, through typed functions:

- internal/agentlogin (new; imports only fetch, jsonc, proxy and state):
  File{Kind, Path, Salt, TokenURL} with VMCopy (the VM's copy and what it
  keeps as it is), Bindings, Get (refreshing OAuth tokens), plus Hosts,
  MCPSecrets and Redact. The salt is a parameter, not a global or
  DEVVM_LOGIN_SALT. Login files are read with proxy.ReadRegular (no FIFO
  hang, 64 MiB cap) and written with state.WriteFile; the refresh goes
  through fetch.NewClient (HTTPS-only redirects, 30 s, reply capped at
  1 MiB) with context.WithoutCancel.
- trust.InitCA makes devvm's CA (state.WriteFileMode), replacing -init-ca;
  netpolicy's InitCA field is it, and proxy_ca_failed carries the error.
- internal/jsonc: devcontainer's JSONC stripper, now redaction's too; the
  redactor's own copy changed commas inside strings.
- proxy.HostOK is exported for agentlogin's MCP host check.
- secrets.Store loses its Login seam and LoginKept; IO loses Stdin and Kept.

Tests: proxy.txtar's login, redact and init-ca cases become unit tests in
agentlogin and trust; proxy.txtar and TestMainRefuses check the old flags
are refused. New: TestRefreshOutlivesItsCaller, TestRefreshFails,
TestGetRefuses, TestLoginFileNotRegular, TestHosts, TestRedactRefuses,
TestRedactJSONKeepsStrings, TestInitCA, TestInitCAFails, TestBundle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:04:31 -07:00
w3cjandClaude Opus 5.5 9fa06140b0 refactor(backend): every backend lists each feature's Caps, checked at registration
Lima's Caps are a literal listing all 19 features. Caps.Check refuses
Caps that leave a feature out, list an unknown one, or rate a feature
better than what it is built on (Feature.BuiltOn: ports-all on ports,
agent-toggle on agent-forwarding, link on ssh); Registry.Register runs
it. The fake lists what a test leaves out as None.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:48:44 -07:00
w3cjandClaude Opus 5.5 bdc95ef6ee refactor(ports): port forwarding out of the backends, one owner in vmssh
The port forwarder is devvm's on every backend. vmssh (moved out of
internal/backend) holds it, the link sessions, and its one owner,
vmssh.Forwards: the lock, stop and start of a VM's forwarder, which
ports it forwards read from vm.json (ports.Forwarding) each time, the
listed ports a host program has left out (ports_taken), the host key
devvm pins, and the backend's new ForwardTarget (user, key, host
loopback port) and Lifeline. One hidden command, devvm _ports
(cli/forwarder.go, vmssh.Main), replaces _lima-ports.

The backend no longer forwards: SetPorts, Want.Ports, Confinement.Free,
Confinement.HostKey and Confinement.Forwarded go; Lima keeps its own
forwards off and gives ForwardTarget (Lima's ssh port on 127.0.0.1,
Lima's user, _config/user). Lima's Stop and Delete no longer touch the
forwarder, and Lima's Forget goes with the backend/ folder: the
forwarder's files are in the VM's run/ (ports.pid, .status, .lock,
.known_hosts) and logs/ (ports.log), its control socket run/port-<hash>.ctl.
vm starts the forwarder after each start and on devvm ports of a running
VM; devvm stop, rm, gc --orphans and an interrupted start stop it.
vm/ports.go's hand rollback goes: the state changes first, and a
forwarder that can't start only warns. A structure-test layer keeps
backends from importing vmssh.

Tests: TestForwardsStart, TestForwardsRun, TestForwarderMain,
TestSplitPorts (vmssh); TestForwardTarget (lima); TestForwarding
(ports); TestStartPorts, TestSetPortsRunning (vm); testscripts up,
ports, layout, gc_orphans updated. Docs: internals/ports.md,
backends.md, lima.md, design.md (Ports on Lima), overview.md,
using/space.md, contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:19:39 -07:00
w3cjandClaude Opus 5.5 b338b2841f fix(test): stub-log keeps the logged words off perl's command line
On a Mac with CrowdStrike Falcon, the limactl stub's call log failed for a
start's combined limactl edit: Falcon SIGKILLs a perl whose arguments hold
an ssh option (.ssh.forwardAgent=false) next to a proxy URL with a
password (the .env --set), so TestLimactlStubContract/stub failed with
"Changing ...'s Lima settings failed". The line's length had nothing to do
with it (TestCallLinesWhole already logs 100 kB lines).

stub-log is now a bash script that pipes the joined words to perl, which
still appends them in a single write. TestCallLoggedWithEditWords logs a
call with those words whole. Contributing's stub section says why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:20:36 -07:00
w3cjandClaude Opus 5.5 8e914b17c9 refactor(proxy): one typed, versioned config for every proxy, read as a private file
devvm _proxy runs with one argument, -config FILE: proxy.Config as JSON
(version 1), which a VM's proxy (vms/<hash>/run/proxy.json, written by
netpolicy.Proxy) and a build's (build-proxy/proxy.json, written by
backend.ProxyStarter) both use. It holds what the flags and the run
folder's sidecars held: the address, the VM, the password (proxy.auth),
the built-in policies and the user's files (proxy.policy), the logs, the
lifeline, the CA, the secrets, the user's CAs (proxy.cas), the company
proxy (proxy.upstream, now proxy.Upstream), upstream_unresolved, the Nix
cache and its cap, the links, and the SHA-256 of devvm's binary and CA
(proxy.bin, proxy.ca), which the proxy doesn't read. devvm writes it whole,
mode 600, before each start, and starts a running VM's proxy again when
the config it would start it with has another Sum. ReadConfig reads it as
the links' list is read (readPrivate): O_NOFOLLOW and O_NONBLOCK, fstat,
a regular file owned by the proxy's user that nobody else may read or
write, at most 1 MiB, of ConfigVersion, no unknown field, a password, a
loopback listen address. The VM's proxy is found by _proxy -config with
its own config's path. paths.VM names ProxyConfig, ProxyPID and
ProxyStatus.

Policy files are read only as regular files of at most 1 MiB
(proxy.ReadRegular, PolicyMax), in the proxy, devvm network and doctor, so
a FIFO or a link to /dev/zero can't hang them (ErrNotRegular, ErrTooLong;
ErrNotPrivate for the config and the links' list); the proxy keeps a
file's last rules and logs why once.

hostOK refuses a name with an empty label (evil.test.., evil..test,
.evil.test), so no form of a name gets past a deny the policy's own trim
would miss.

A build proxy that can't be spawned leaves no config behind.

Tests: config round trip and Sum; ReadConfig refusing a link, a FIFO, a
folder, group-readable and group-writable files, a long file, other
versions, unknown fields, two configs, no password, non-loopback
addresses, a CA without its key, a negative cap; ReadRegular and the
policy readers on a FIFO, /dev/zero and a big file without hanging; the
running proxy keeping its last rules; hostOK and requests with empty
labels (failing on the code before); Prepare's config, restarts on a
binary change, a missing config and one others may read; concurrent
config writes; the build proxy's config and its removal; proxy.txtar,
network.txtar, nix_cache.txtar and layout.txtar; e2e checks of the
config's mode, password and the proxy's arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:51:45 -07:00
w3cjandClaude Opus 5.5 51007fe851 refactor(backend): declarative Start, one Lima edit of what differs
Start takes what a VM's state asks of it, backend.Want (its size, agent
folders, agent forwarding and ports), beside its Confinement, and a
stopped VM's start changes only what differs, in one limactl edit with
the confinement's own edits. CreateVM makes the VM as its spec's Want
says (VMSpec embeds Want). SetSize, SetAgentDirs and SetAgentForwarding
go, and with them vm_not_stopped: devvm size, ssh-agent and the agent
mounts save to the state, and the next start applies them. A pure
backend.Validate keeps the early refusal (disk_shrink) before anything
changes.

Lima's ports record (vms/<hash>/backend/ports) goes: which ports a VM
forwards is vm.json's ports.forward alone, passed in Start's Want and in
SetPorts, which now changes only a running VM's forwarder.

Tests: backend TestValidate, TestFakeStartValidates; lima TestWantEdits,
TestStartWantInOneEdit, TestSetPortsNoEdit, TestCreateVM and the
forwarder tests on Want's ports, the real-Lima scenario's combined edit;
vm tests read Start's Want; size, ports, up, up_size, layout and
gc_orphans scripts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:42:26 -07:00
w3cjandClaude Opus 5.5 6c276af933 fix(state): every path in devvm's folders from paths, a VM's folder deleted under its lock, and the state layout review's fixes
paths names the files that were built elsewhere: Dirs.ShareLock
(tools.lock), RetentionLock, GroupsLock, ToolImage, QEMUWrapper,
DefaultLima and ToolsBuildPrefix, and paths.VM's comment says what
backend/ holds. The structure test's owners rule fails a filepath.Join
onto a Data or Config field outside internal/paths, and an os.MkdirTemp
or os.CreateTemp there with a literal name (pathCases).

Fixes:
- state.RemoveFolder deletes a VM's folder holding the VM's lock, so a
  change another devvm is making lands first and none after it; teardown
  and clear use it (TestRemoveFolder).
- Retention at a command's start skipped tool images when tools/.lock
  existed, a file nothing makes: it asks tools.Env.ShareBusy, which tries
  the share's lock (TestLockShare).
- An image's build VM's folder (its sandbox profile and start record) is
  deleted once the image is built (TestBuildImageBase; layout.txtar).
- doctor says what in vms/ it can't read (vms_unreadable) instead of
  dropping the error (TestVMFolderProblems).
- devvm rm VM checks again after asking: a folder that came back, a VM
  made again, or an agent VM stopped meanwhile keeps the VM
  (TestRmVMChecksAgain).

Docs: overview's run/ and locks, rm VM's second check, space's run/ row
and doctor's findings, images' retention and the share's lock,
Contributing's owners table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 16:31:31 -07:00
w3cjandClaude Opus 5.5 ae0fd533fc refactor(msg): names mode is the UI's, read once with each stream's style
A msg.M always renders as its text: String, Error, Parts and Segments no
longer read DEVVM_MESSAGES, and Line is gone. internal/ui reads names mode
in newStyle, with each stream's color, and shows messages as names through
the style (message, segments, line, valueParts). ui.New takes the function
it reads the environment with, so tests make a names-mode UI without
t.Setenv. Messages shown as data go through UI.Text or Table.Text (doctor
--json, ls's image cell, setup's network choices); vm.PickRow.Desc is a
msg.M that cli renders. A config.toml value's refusal keeps its message
(state.CorruptError.Msg, Shown), so fail shows its names in names mode.

Tests: ui TestNamesMode; state TestFiles covers Msg and Shown; Go tests
compare NamesOf or Names, and drop t.Setenv("DEVVM_MESSAGES") outside ui,
msg's TestNames and the testscript runner. The structure test lists
DEVVM_MESSAGES in internal/ui/style.go only; ui.UI's method limit is 47
(Text).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:01:47 -07:00
w3cjandClaude Opus 5.5 74431b01b9 docs: messages' doc links point at user pages
Twenty-six messages that linked into How it works now link to the user
page that says what to do, with new sections where one was missing:
troubleshooting's The proxy doesn't start, A download doesn't check out
and A new tool release isn't there yet, .git protection's When devvm
reports .git, and paragraphs in Lima's devvm's Lima home and limits,
coding agents' copies and the devvm secret get row. TestDocLinks fails
for a link into internals/ or contributing/ unless internalDocLinks lists
the message with why (backend_unreviewed_used, qemu_refused,
tool_bad_output).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 16:37:51 -07:00
w3cjandClaude Opus 5.5 8ec7547ebd feat(cli): devvm rm VM deletes a VM whose folder is gone, and ls and space mark it
A VM whose recorded project folder is gone (nothing at its path) is
marked: devvm ls writes "(gone)" after its folder and gives
"folder_gone" in --json; devvm space names it in a note and in
--json's "folder_gone". devvm rm takes an optional VM, by name or ssh
alias, from any folder: this folder's own VM goes through rm; a VM
whose folder is there, a name that isn't a VM's, and a VM its backend
lost are refused. It asks in a terminal, --force answers, and without
either it refuses. Agents' history is exported first unless
--no-export; a stopped VM that mounts its folder is refused, as
starting it would make the folder again (Lima makes a missing mount's
folder); a --clone VM needs --no-clone-check. Never deleted by gc or
retention.

vm: FolderGone, Lifecycle.RmVM/rmGone, recordedVMs (moved from
Links.projectVMs); project: Named (Targets uses it). Messages:
rm_unknown_vm, rm_vm_folder_there, rm_vm_lost, rm_gone_stopped,
rm_gone_clone, rm_vm_export_failed, rm_vm_failed,
delete_gone_folder_vm (answered by --force), space_folder_gone.
Tests: testscript rm_vm, ls; TestFolderGone, TestList, TestTargets,
TestJSONShapes. Docs: commands (rm, ls, a VM whose folder is gone),
space, troubleshooting, coding-agents, overview; CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 16:19:44 -07:00
w3cjandClaude Opus 5.5 c77a3fbc3b docs: the state layout, each part described once in its owner page
Overview's State files explains the two folders, the formats, a VM's
folder file by file, its state and the locks; the data folder's listing
is space.md's and the config folder's settings.md's, linked from the
others. design.md gets a note on the layout and why no database.
Contributing names the paths and how to add a file, socket, record,
default or lock. Stale facts fixed: the claims lock in space.md and
design.md, the forwarder's control socket, the config folder's version,
the proxy README's Nix cache path, an export's .folder file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 16:14:31 -07:00
w3cjandClaude Opus 5.5 628dc11c94 feat(state): a layout version for devvm's folders, made_by in its records, the golden listing and doctor's leftovers in vms/
The data and config folders each hold a version file (state.Layout, 1).
state.CheckLayout runs before every command but help, completion,
version and devvm's hidden commands, under version.lock: the same
version goes on, a missing file gets this devvm's, an older one runs
the migrations in order (migrations(), empty now), and a newer one in
either folder refuses with layout_newer; a file that isn't a version
fails with layout_unchecked.

made_by, devvm's version, is in vm.json's core fields (set when the VM
is made, kept by later changes), image records and tool image records.
It's passed from cli's devvmVersion through vm.NewEnv, tools.New and
build.Env.Version.

testdata/script/layout.txtar makes two network-policy VMs with a
forwarded port, a link and a secret, and compares every path under the
data and config folders with checked-in listings (macOS and Linux).

devvm doctor warns about entries in vms/ that aren't VM folders
(vms_stray) and VM folders without vm.json (vm_folder_stateless),
changing nothing.

Tests: TestMigrations, TestCheckLayout, TestCheckLayoutMigrationFails,
TestVMFolderProblems, TestSkipsLayout; made_by checks in TestVMRoundTrip,
TestImage, TestToolImage, TestUp, the build and tools tests and scripts;
doctor's unit test and script. Docs: internals/overview (the layout
version, made_by), using/space, using/settings, using/troubleshooting,
internals/images, Contributing (changing the state layout).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 15:50:49 -07:00
w3cjandClaude Opus 5.5 5a9f1b71c2 feat(cli): changes that apply at the next start ask to restart now
devvm size, devvm network on and off, devvm ssh-agent and devvm
git-protect (macOS) on a running VM ask in a terminal, without
--no-input, whether to restart it now ([Y/n]): yes restarts it as devvm
restart does, no or no question (no terminal, --no-input) keeps today's
message (size_next_start, net_set_running, agent_set_running,
git_protect_next_stop). Agents' mounts ask the same question.

- one owner: Env.restartNow (Env.CanAsk, then restart_now) and
  Env.restartOr (yes: Launch.Restart; else the later message), in
  internal/vm/existing.go; UpdateAgentDirs uses restartNow
- restart_now replaces update_mounts (AnswerFor: devvm restart)
- tests: TestRestartToApply (each command: yes, no, no terminal,
  --no-input), TestUpdateAgentDirs's --no-input case
- e2e: network's no-terminal on and off say net_set_running
- docs: commands.md's restarting note and answers table, ports-size,
  ssh, safety/network, git-protection, coding-agents; CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 15:43:41 -07:00
w3cjandClaude Opus 5.5 aab5272a4b feat(vm): offer to delete and make again a VM whose creation didn't finish
In a terminal without --no-input, devvm asks remake_unfinished ([y/N]);
yes deletes the VM as devvm rm does (Lifecycle.delete, teardown) and
makes it as for a folder without one. Without a terminal, with
--no-input, on no or for a parent folder's VM, vm_unfinished stays.
Adds ui.CanAsk (a function, keeping UI within its methods) and
Env.CanAsk, set by cli; AnswerFor names devvm rm, then devvm.
vm_unfinished's doc link points at troubleshooting's new entry.

Tests: TestRemakeUnfinished, TestCanAsk; existing.txtar covers
--no-input, no and yes (delete, clone, start in order).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 15:35:12 -07:00
w3cjandClaude Opus 5.5 9f6f62d28a refactor(state): vm.json, typed state in package sections, changed under the VM's lock
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]>
2026-11-03 14:47:06 -07:00
w3cjandClaude Opus 5.5 cd7f202b64 fix(ports): choose new ports below the host's ephemeral range
The proxy's, desktop's and Lima's ssh ports came from 20000-59999 (or the
kernel's port 0, inside the ephemeral range), which overlaps Linux's
ephemeral range: a live outgoing connection could take the port between
the check and the bind. One owner now picks them: platform.FreePort over
platform.ChoosablePorts, 20000 up to just below the ephemeral range
(Linux: ip_local_port_range; macOS: net.inet.ip.portrange.first, 49152 if
unreadable), or 20000-32767 when unknown or too small. Proxy.Ports is
the seam.

Tests: TestPortsBelow, TestParsePortRangeFirst, platform's TestFreePort;
netpolicy's TestFreePort checks the chosen range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 15:08:18 -07:00
w3cjandClaude Opus 5.5 9f9dfbf89d feat(setup): devvm setup chooses the layers every new VM gets
devvm setup chooses default layers, as it chooses new VMs' coding
agents: settings' layers key (config.toml's layers = [...], or
settings.json's, saved by devvm setup), bottom first, each name checked
as a layer's (not base or a shared tool's).

- devvm setup --layers LIST|none saves them without asking; a name that
  isn't a layer is a usage error with a did-you-mean, and config.toml's
  are refused (set_in_config). In a terminal, setup asks for them last,
  after the agents (layers_help), with each layer's description.
- A new VM's picker checks setup's layers under Layers ("from devvm
  setup"), and they keep their order at the bottom of the image, with
  what's added on top. Without a terminal a new VM gets them; --layers
  replaces them and --layers none gives none. A devcontainer.json's
  layers go on top.
- A default layer whose script is gone is skipped with a warning
  (default_layer_gone); one the backend can't run fails before anything
  is built, naming the layer and both ways out (default_layer_lacks).
- pick_setup_agent becomes pick_from_setup, for agents and layers;
  desktop_no_layer names devvm setup --layers too.

Code: settings.KeyLayers, Defaults.Layers, checkLayers, layerKind;
vm.LayersChoice (Set, Ask), creation.addSetupLayers,
requireSetupLayers, inOrder; cli addLayersFlag, setup's --layers and its
completion.

Tests: TestReadConfig, TestConfigRefused, TestPrecedence,
TestReadSaved; TestLayersChoice, TestUpParts (setup's layers, --layers
replacing them, --layers none, a gone layer), TestUpSetupLayerLacks,
TestUpPicker (setup's layers checked, their order kept); TestSetupLayers,
TestSetupAsks, TestSetupConfigSets; setup.txtar (--layers, none, unknown
names, a new VM getting them, --layers and --layers none replacing them,
a gone layer warned, config.toml's layers refused and given to a new VM).

Docs: settings (config.toml's layers key, devvm setup's fifth question
and flag, Layers for new VMs), images (what a new VM gets), customizing,
desktop, commands, first VM; the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:57:53 -07:00
w3cjandClaude Opus 5.5 d2dc8c74b6 feat(layers): desktop is a built-in layer, not one of base's features
devvm --layers desktop (or desktop under the picker's Layers heading)
gives a VM the Xfce desktop devvm desktop opens; base no longer has it.

- assets/features/desktop.sh moves to assets/layers/desktop.sh, with a
  built-in layer's header, and assets/layers/desktop.policy (no rules: its
  packages come from the distribution's archive, which base's policy has).
- image.DesktopLayer joins image.Builtins (desktop, docker, nix, sorted):
  reserved, listed under Layers, taken by --layers and completion, its
  policy read by netpolicy.Policies.
- build: desktopFeature and chosenFeatures' special case are gone; until
  a choice is made, base gets every feature. devvm setup --features
  desktop is no_feature.
- devvm desktop: desktop_no_feature becomes desktop_no_layer (devvm rm,
  then devvm --layers desktop), linked to the desktop page. The picker's
  row: pick_layer_desktop.
- apt snapshot: base.sh's /etc/apt/apt.conf.d/50devvm-snapshot stays in
  base's image, and only guest/sync.sh (project VMs) removes it, so a
  layer built on base installs from the same snapshot and package lists;
  said in base.sh, desktop.sh and internals/images.md.
- No backend feature: desktop builds and runs like any layer on Lima.

base's image key changes (desktop leaves the features, base.sh's comment
changes), so base rebuilds, now about 400 MB smaller without the desktop
on the --from tier's every-feature base, and for anyone who chose it.

Tests: TestBuiltins; TestOwnFeatures (devvm's features without desktop,
every one until chosen, desktop refused); TestLayersAndCheckLayers,
TestCompleteParts, TestPartFlags and TestUpPicker list desktop under
Layers; TestBuiltinPolicies allows desktop.policy alone without rules;
testscript: desktop.txtar (a base VM refused with desktop_no_layer, its
build without the layer's script; --layers desktop builds the desktop
image), setup.txtar (--features desktop is no_feature), the layer lists
in build, layer, up and up_checks. e2e: the desktop section checks a base
VM has none of the desktop's programs and is refused, then makes its VM
with --layers desktop; from's Alpine VM gets the desktop layer too.

Docs: using/desktop.md, using/images.md (built-in layers, desktop),
using/customizing.md, using/from.md, using/_index.md,
getting-started/commands.md, internals/desktop.md, internals/images.md
(the desktop layer, the snapshot in layers), internals/design.md,
contributing; the CLI reference for devvm desktop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:10:52 -07:00
w3cjandClaude Opus 5.5 3141ecbbb5 test(e2e): check every host command and perl module the sections need first
Before it builds anything, tests/e2e.sh checks the commands and perl
modules of this machine's that the chosen sections use, and lists each
missing one with what installs it (brew on macOS, apt-get or dnf on
Linux), then stops. Always: limactl, go or mise, git, pgrep, pkill and
OpenSSL's openssl (the check it had, now one line of the list). By
section: nc, lsof (macOS) or ss (Linux), curl, ssh, ssh-agent, ssh-add,
ssh-keygen, tar, python3 (macOS's sandbox check), sha256sum or shasum,
perl with File::Find (no_leak: images, nix, from; Fedora's
perl-File-Find) and IO::Socket::INET (project; Fedora's perl-IO).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:16:46 -07:00
w3cjandClaude Opus 5.5 ffbc139969 test(lima): a contract test of the limactl stub against real Lima
TestLimactlStubContract runs scenario on dummy instances twice, through
the real limactl and through testdata/stubs/limactl, and after each step
compares every instance as devvm reads it from limactl list --json: their
order, status, size, mounts, agent forwarding, ssh port and networks, and
the edits each kind of start would make (startSets).

The stub had drifted from Lima, and now matches it:
- create ignored --cpus= and --memory=: every image was 4 CPUs and 8 GiB.
- clone started from an empty config: Lima's keeps its source's config,
  size and lima.yaml (env), then --mount-none, then each --set.
- Only --set .portForwards, .ssh.localPort and .env were kept: the
  mounts, .ssh.forwardAgent, .propagateProxyEnv, .hostResolver and .dns
  were dropped, so each start edited them again. The stub keeps any
  --set (and del()) in $STUB_DIR/config-<name>/, on create too.
- delete left the VM's size and $LIMA_HOME/<name> (its lima.yaml).
- list gave instances in the order they were made: Lima sorts them.

devvm relied on the clone drift: a project VM keeps its image's
propagateProxyEnv: false (from the build's start), so its first start
without network policy edited it, where the CLI tests said it edits
nothing. CreateVM now sets .propagateProxyEnv=true at the clone. And
rebuild.txtar relied on the list order: it compares the deletes sorted,
as Lima lists images by name. On Linux a layer's or the tools build's
VM, cloned from a built image, keeps the config its image's build made,
so Start edits nothing (no ssh port there) and the build's step count
was one too many: cloneEdits counts the configure step only when Start
edits (TestCloneEdits).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:11:57 -07:00
w3cjandClaude Opus 5.5 6ba7c5557a test(lima): validate every Lima config devvm makes with limactl validate
TestLimaConfigsValid runs the real limactl on dummy instances (a small
local file as their image: they can't boot, but limactl creates, clones,
edits, lists and deletes them) in a sandbox of their own, and runs
limactl validate on each instance's lima.yaml after every step of
scenario: base from Ubuntu's image and from a --from conversion, a layer,
the tools build VM, the conversion's VM, a project VM with its mounts,
ports, size and environment, its settings changed, each start's edits
(a build's networks, network policy with the proxy's password, none),
and everything deleted. It skips when limactl isn't on PATH.

Test seams in the Lima backend: configure (Start's edits and the
password), convertedImages, layerArgs and toolsArgs; sandboxDirs is
sandbox without the stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 13:58:19 -07:00
w3cjandClaude Opus 5.5 3da8ffa208 fix: Lima-only review: docs and messages describe Lima alone, doctor --json drops backend_source
- doctor --json: backend_source goes (it could only be built-in).
- AgentWhileRunning and the agent_on_risk_running and
  agent_devvm_risk_running messages go: nothing sets the field.
  Confinement.SSH, NoAgent and AgentFixed stay, as the generic
  emulation contract for ssh and agent-toggle.
- The unused experimental badge goes: its shortcode, Markdown version,
  partial, CSS, llms.txt filter and flask icon.
- Messages: space_backend_unknown, space_stray, gc_backend_skipped and
  gc_orphans_unknown start with "The lima backend" instead of a
  lowercase name; backend_lacks and backend_unreviewed point at doctor's
  features, not other backends; space_caches_note says Lima's caches;
  setup_in_config's description no longer names a backend key.
- Docs: "on every backend" and similar leftovers go (limits, devcontainer,
  images, ports, lima, design, the docs index); space's "Lima's caches";
  safety/network and security say every Lima VM can have network
  policy; images says a docker-layer VM keeps it; ports.md says devvm
  records every VM's ssh port; security's set-id paragraph says where a
  root-owned file comes from; Contributing lists the invariants a new
  backend's threat check covers.
- AGENTS.md: msg.IDOf, now used only by tests, joins deadcode's list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 13:23:49 -07:00
w3cjandClaude Opus 5.5 79b3ef94d4 refactor(cli): one backend: no --backend flag, no BACKEND column
devvm runs every VM on Lima, so the command line has no backend choice:

- --backend is gone from devvm, build, rebuild, images, images rm, gc,
  space, doctor and setup (addBackendFlag, addBackendFilterFlag, setup's
  own, checkFlagValue's case, its completion); a removed flag now fails
  as an unknown flag (exit 2).
- devvm setup no longer asks for or saves a default backend; config.toml
  and settings.json have no backend key (settings.KeyBackend, Values and
  Defaults' Backend, checkBackend, Value.With, Source.File, FromFlag).
- Tables lose BACKEND: ls, images (both tables), space (both tables);
  doctor's FEATURE table is FEATURE and SUPPORT for Lima. space's images
  row is freed by images rm.
- --json keeps every backend field (ls, images, tool records, space,
  doctor's backend, backend_source "built-in" and every backend's
  features).
- The registry keeps Lookup, For and Default: For(d, vm) gives a VM its
  recorded backend and a new VM NewVMs, else Default; tests set NewVMs.
  vm.Env's lookups lose the flag parameter, found.flagIgnored and
  Options.Backend.
- Messages removed: backend_unknown, backend_unknown_default,
  default_backend, backend_help, doctor_backend_from,
  backend_flag_ignored; backend_unknown_vm stays (a VM's recorded
  backend), linked to backends#a-vms-backend.
- Docs: Backends' choosing section becomes "A VM's backend"; settings,
  setup, images, gc, space, doctor, commands and install pages lose
  --backend and BACKEND; Contributing gains "How a backend plugs in".
- Tests: unit tests for For, settings, setup, doctor's table, the
  tables; CLI scripts check --backend as an unknown flag on devvm,
  build, restart, images, gc, space, doctor and setup, and a config.toml
  backend key as unknown; e2e's table checks lose the column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 12:46:28 -07:00
w3cjandClaude Opus 5.5 e720d2def5 fix(tools): Debian --from bases boot the generic kernel, which has 9p, and the tools build waits for its folder
On an x86_64 Linux host, a --from base made from a Debian image (node:24)
booted Debian's cloud kernel, which has no 9p (CONFIG_NET_9P is not set).
Lima mounts with nofail, so every mount was an empty folder, and the
shared tools' build VM failed at `cd /mnt/devvm-tools/.build`. Not a race
and not nesting: it fails every time on that image, on the Debian 13 KVM
guest and on bare-metal Fedora alike.

- assets/oci/bootify.sh: Debian gets linux-image-$arch on every
  architecture (the generic kernel, already used on arm64 for gpio_keys),
  and net.ifnames=0 on its kernel command line: with the generic kernel
  udev's enp0s4 came up from Lima's MAC match before cloud-init's rename
  to eth0, which failed as busy and stopped its init stage, leaving no
  ssh host keys.
- assets/shared-tools/build.sh: wait_share waits up to 60 s for
  .build/mise.lock, mounting the folder again from fstab while it isn't
  mounted, then fails naming the folder and mount's last error.
- tools.txtar: wait_share there at once, mounted late, never mounted.
- docs: internals/images.md (the wait), internals/design.md (the cloud
  kernel's missing 9p, the rename).

Both scripts are in image keys: --from bases and every tool image
rebuild.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 11:08:06 -07:00
w3cjandClaude Opus 5.5 f4fd373439 refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend,
Caps, Features, Review/Require, the registry, backendtest.Fake), so
another backend is an addition.

State from a smolvm VM reads as an unknown backend (backend_unknown_vm,
gc_orphans_unknown); nothing migrates it. The image keys of
layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images
rebuild once.

Lima's port forwarder moves off smolvm's files first: newForwarderCmd and
forwarderMain from internal/cli/smolvmports.go to limaports.go, and
assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder
at run time, so no image key changes).

Removed:
- internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its
  registry entry, registry.Experimental and backend_experimental.
- The decider: backend.Decider/UsesDecider, Confinement.Decider and
  DeciderToken, internal/proxy/decider.go and its test, the proxy's
  -decider, -decider-to and -decider-token-file, netpolicy's
  KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in
  vm's forwarding and UsedPorts.
- backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and
  agent_unchosen_stop.
- vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped).
- paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's
  Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing
  called (a test helper now).
- ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and
  bump.sh's ubuntu_image, with its part of bump.txtar.
- assets/smolvm/ and assets/container/; the no-init-system branches of
  layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in
  features/desktop.sh and guest/ca.sh.
- Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh,
  creating_from_image, packing_image, pack_failed, backend_experimental,
  agent_unchosen_stop; descriptions naming smolvm reworded.
- Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and
  sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a
  failing or hanging Lima listing instead (the limactl stub's list-fails
  and list-hangs); the --backend smolvm examples; e2e's --backend smolvm
  and its section (about 1,130 lines), the smol_* helpers and the
  link section's backend switch.
- Coverage: internal/backend/smolvm's lines in both baselines.
- Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm
  notes (Ports on Lima now holds the forwarder's description), the
  backends table's smolvm column, every page naming smolvm, the README,
  the home page's backends art, and AGENTS.md's smolvm rows and gotchas
  (and the Docker bind-mount gotcha, which nothing refers to).

Kept: the docker layer, on Lima; --from's local Docker; --backend, the
BACKEND column and setup's backend choice, which the next commit removes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 11:34:05 -07:00
w3cjandClaude Opus 5.5 50b4e796b7 fix(daemon): a proxy just started whose arguments read as none yet is still waited for
On Linux, a process devvm has just started shows empty arguments in
/proc/<pid>/cmdline for a moment: exec lets the parent go on once the new
program replaces its memory, and the kernel sets the argument area only
once the program has loaded. Proc.Ready took that moment as the proxy
having ended, so a start under load failed at once with
proxy_start_failed while the proxy ran on, its log and status empty.
Ready now counts the process as running while its pid file names it, it
is alive, and its arguments are its own or can't be read yet
(Proc.starting); an ended one is reaped by Detach, so it stops counting.

Tests: TestReadyArgsUnread (fails on the old code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 11:18:26 -07:00
w3cjandClaude Opus 5.5 1917072228 refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the
default backend and smolvm stays experimental. The backend architecture
(Backend, Caps, Require, the registry, backendtest.Fake) stays, so
another backend is an addition.

Removed:
- internal/backend/docker, its registry entry and Names/Experimental's
  docker half; devvm _docker-connect and _docker-ports
  (internal/cli/dockerssh.go); assets/docker/unpack.sh.
- Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS,
  DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256
  ldflags vars and the CLI tests' Linux-build archive (linux_release).
- Interfaces only Docker implemented, with their callers:
  backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix),
  DiskUser (ls's and size's disk-over warning, size's disk_used and
  --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover
  (gc --orphans' volumes, networks, containers and images),
  DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and
  vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name.
- The docker layer's runtime on a backend that makes VMs for it:
  vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet
  returns a bool now), the refusals at start and devvm network on, ls's
  "(sysbox)" and --json docker_layer, size_disk_default_unused.
- The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix).
- paths.Dirs.Docker and paths.VM.Lifeline.
- assets/guest/tools.sh's linked-folder branch; services.sh's
  DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd.
- Messages: every docker_* the backend used, docker_layer_runtime,
  net_docker_layer, net_off_docker_layer, committing_image,
  pulling_image, unpacking_tools, disk_over, size_disk_default_unused,
  gc_orphan_volume/_network/_container/_image, docker_connect_failed;
  gc_orphan_elsewhere reworded.
- Tests: docker.txtar, the docker stub's engine (its --from half
  stays), the ssh stub's login-shell branch; e2e's --backend docker,
  --engine, the docker host VM and Docker Desktop runs.
- Release: one GoReleaser pass, no Linux-build pin in the macOS builds,
  no Linux devvm in the Homebrew formula's libexec. Linux builds stay.
- Docs: backends/docker.md and internals/docker.md, design.md's Docker
  notes, the Docker column of the feature table, and every page's
  mentions of the Docker backend, Docker Desktop as one, and Sysbox.

Kept: the docker layer in Lima VMs, devcontainer docker-in-docker,
--from with images only a local Docker has, Docker Hub references.

State written by a Docker VM before this reads as an unknown backend
(backend_unknown_vm).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00
w3cjandClaude Opus 5.5 d8a7d4de7f refactor(state): a folder per VM, keyed by its project folder's hash
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]>
2026-11-03 08:16:39 -07:00
w3cjandClaude Opus 5.5 dd3f0deb3f feat(state): config.toml and settings.json hold the defaults, and devvm's own files move to the data folder
~/.config/devvm/config.toml is the defaults you write by hand: backend,
network, ports, features, agents, [size] cpus/memory/disk and
[retention]'s six keys. devvm reads it and never writes it, strictly: an
unknown key (toml.MetaData.Undecoded, its line found by key) or a value
its check refuses (ParseCPUs, ParseGiB, ParsePorts, ask/on/off, a
backend's name, image.FeatureName, image.Agents, ParseDuration,
ParseSize, counts) fails naming the file and the line.
~/.local/share/devvm/settings.json holds what devvm setup, size -g,
ports -g, network -g and retention save (unknown fields ignored).

internal/settings owns both: Defaults (Value and List, each with its
Source: flag, config.toml, settings.json or built-in), Read, Save, which
refuses a key config.toml sets (set_in_config, with a doc link), and
the parsers and retention settings that moved from vm and state. A flag
wins over config.toml, config.toml over settings.json, settings.json
over the built-in default. Settings methods lose their files; setup
uses vm.NetworkChoice instead of its own copy; creation.plan reads one
snapshot (firstRun) after the first-run questions; the registry gets
the default backend through DefaultBackend; state's featureName copy
goes with base-features.

devvm size -g, ports -g, network -g and retention show each value's
source after a #, and in --json (source, sources); devvm doctor names
the file that sets its backend (doctor_backend_from) and adds
backend_source. devvm setup skips what config.toml answers
(setup_in_config) and refuses a flag that would change it.

ssh_config (and so the ~/.ssh/config Include line), known_hosts,
agent-keys.json and secrets/ move to the data folder. agent-keys.json is
{"keys": [{file, fingerprint, confirm, lifetime}]}, parsed once
(AddedKey); Keys formats KeyList.

Tests: settings' table tests (every key, unknown keys, bad values, an
empty file, precedence, Save's refusal and merge, settings.json's
fields), agent-keys.json, the registry's default backend, setup with
config.toml, SizeChoice with config.toml; CLI scripts for size -g,
ports -g, network -g, retention, setup and doctor's sources, each
refusal, a hand-edited config.toml with a typo, and ssh -G resolving
devvm-web through the Include line. Docs: settings.md's config.toml
section with a full example, linked from each command's page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:56:29 -07:00
w3cjandClaude Opus 5.5 299ddb1476 refactor(state): image records in images/<key>/, rebuild counters per backend and --from, tool image records, cache/
- Image records are images/<key>/record.json (JSON, unknown fields
  ignored; name, chain, from, digest, libc, built). state.Images lists
  the folders; AnyImage needs a record.json; RemoveImage deletes the
  folder. Lima's cache cleaner reads records through state.Images.
- Rebuild counters are images/rebuilds.json, keyed by (backend, from as
  given, name), changed under images/locks/rebuilds. image.Inputs takes
  them through an image.Rebuilds interface. A rebuild on one backend no
  longer outdates the others' images, and two --from references that
  wrote the same counter name (node:24, node-24) stay apart.
  paths.RebuildFile, RebuildName and unsafeName are gone.
- Tool images: <file>.sha256, .target and .idle become one <file>.json
  (sha256, libc, format, backend, built, idle_since; state.ToolImage).
  BACKEND and LIBC read the record; the fallbacks (format matching,
  a VM's target, the current target) go, with toolTargets, vmToolTargets,
  formatBackend and gc's backendTools (toolsOn does it).
  Share.IdleFor owns reading idle_since.
- cache/ (Dirs.Cache) holds mise/, nix-cache/ and from-digests.json.
  With the cache gone, from.Recorded takes the newest base record's
  digest for the reference, so no key changes.
- Key check: the rebuild counter is the one input that moved and changes
  keys (deliberately: per backend and exact from). The --from digest
  moved to cache/ and stays an input, kept stable by the records'
  fallback. Records, mise and the Nix cache are outputs.
- Tests: state's image, rebuild, digest and tool record tests; image key
  cases per backend and exact from; build.TestRebuildIsPerBackend;
  from.TestRecordedWithoutTheCache; cli.TestToolsOn; rebuild.txtar
  (Docker's and smolvm's rebuilds keep Lima's and the other --from's
  bases), gc_caches.txtar and from.txtar (a missing cache/); the
  testscript command json_set; e2e reads the JSON records.
- Docs: space, images, settings (retention), internals images,
  overview, network, security, contributing (json_set).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:37:36 -07:00
w3cjandClaude Opus 5.5 ee8146a5e4 fix: scripts and tests work without shasum, and two CLI scripts start Lima outside devvm on bash 5.2's sh
Fedora 43 has sha256sum but no shasum (Perl's Digest::SHA), and its /bin/sh
is bash 5.3, which runs the last command of an `a && b` -c string in sh's
place.

- install.sh's check_host stops with "needs sha256sum or shasum" before
  downloading; its sha256 already used either. install.txtar covers
  shasum alone, both, sha256sum alone and neither, with made-up sums.
- scripts/release.sh and scripts/bump.sh get a sha256 helper (sha256sum,
  else shasum -a 256) in place of four shasum calls.
- gc_orphans, release, release_head and tools scripts hash with sha256sum,
  else shasum. tools' old fallback never fell back (the pipeline's
  status was cut's).
- ls and existing_agents restart a VM outside devvm with
  `sh -c '... && limactl start ...; exit $?'`: without the exit, bash's
  sh exec'd the stub, whose ha.pid then named the test runner (the pid
  devvm recorded), so the VM still looked confined.
- The install page lists sha256sum or shasum among the script's needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:13:46 -07:00
w3cjandClaude Opus 5.5 34e2e5ef5a feat(cli): devvm WORD naming a toolchain, agent or layer points to its flag
devvm node said "Did you mean devvm code?", which misleads anyone who
means the tool. When the unknown word, or each name in it joined with +
or a comma, is a toolchain, an agent or a layer (devvm's own or the
user's), the usage error is no_command_part, with the flags that choose
them: devvm node+claude -> devvm --tools node --agents claude. Any other
word keeps the did-you-mean over the commands (msg.Closest). The names
come from partNames, which checkPartFlag reads too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:06:06 -07:00
w3cjandClaude Opus 5.5 da93384f60 fix(lint): fetch.Client is its own type, and forbidigo bans http.Transport, os.Create and O_TRUNC
fetch.Client was an alias of http.Client, so &fetch.Client{} got past
NewClient's timeout and HTTPSOnly. It is now a struct only NewClient fills:
Do sends with the client's policy, Transport returns its own transport for
callers to change (ubuntu's file://, the public registry's dialer), and any
other Client fails every request with ErrNoClient, which isn't transient.
forbidigo's HTTP rule also bans http.Transport, and http.Client's Transport
field, outside fetch, the proxy and tests.

The os.WriteFile rule also bans os.Create and os.O_TRUNC, so a
truncate-in-place write outside state needs a nolint saying why. The four
left are not files written whole from memory, or are the standard library
only: tools' check log and a link session's log (a process writes them as
it runs), fetch.Download's file (streamed, removed on failure) and
daemon's pid and status files (one write, which readLine and readStatus
take as missing until its line ends). state's doc says so.

Tests: TestClientMadeByNewClient (nil and zero Clients send nothing and
aren't retried; NewClient's transport is its own); from's and build's
tests use the registry's own client trusting the TLS test server.
Fixture lines: http.Transport, os.Create, os.O_TRUNC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 06:43:13 -07:00
w3cjandClaude Opus 5.5 4d863bb749 fix(cli): another part's name in --tools, --agents or --layers names the flag that takes it
The picker change's review:

- --tools claude, --layers node, --agents node and the like are refused
  with part_other_flag, which names the flag that takes the name, as in
  devvm --agents claude; a name no part has keeps unknown_part or its
  did-you-mean. checkPartFlag checks the three parts' names together.
  TestCheckFlagValue, up.txtar, up_checks.txtar and setup.txtar cover it.
- image.ToolName is back, with its TestValuePatterns row: ToolFile and
  ParseToolFile check a tool's name with it.
- internals/design.md's Docker layer checks name parts_flags_ignored for
  --layers docker on a VM that exists, as e2e checks, in place of a
  message that's gone.
- The home page and the README give the Claude Code token before
  claude's first start, the home page's list says which rows it shows
  checked, and the FAQ says the agents' config comes from your machine.
  The README says the first run asks for new VMs' size and agents before
  the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 06:47:59 -07:00
w3cjandClaude Opus 5.5 a134e0d8a6 feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's
toolchains, coding agents and layers are checked in one picker, under three
headings, before the network-policy question; --tools, --agents and
--layers (each an exact list, or none) skip it, and a part left out takes
its default: the detected toolchains, devvm setup's agents, no layers (a
devcontainer.json's features still count). Without a terminal, or with
--no-input, the VM gets the defaults and new_vm_gets says so in one line.
devvm setup --agents (and its first-run question) chooses new VMs' agents.
devvm tools in a terminal opens the same picker for the VM, its layers
fixed, and turns the changes into tools add and rm.

An image is base and layers only: tools are the VM's tool_names state key.
build, rebuild and images rm refuse a shared tool (tool_not_layer), and
devvm build builds no tool images. devvm ls gains a TOOLS column and
--json tools. gc's --tools is --tool-images, so --tools has one meaning.

Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or
no_command_like, did-you-mean over commands, msg.Closest), the lacks path
in internal/vm/existing.go, and the messages vm_lacks_tools,
vm_lacks_layer, layer_is_command, layer_name_command, no_image_for,
no_command_or_image*, tools_not_images, tools_not_images_rm, detected,
vm_is_now (vm_tools_now), secret_with_image (secret_with_claude).
New: ui.Pick takes headed sections with fixed rows, ui.CanPick,
vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go),
state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents,
project.DetectFiles. Image keys are unchanged in form: images never held
tools; docker.sh's and nix.sh's comments changed, so those layers rebuild.

Docs: the home page's quick start steps, diagram (sandbox.svg), cards and
FAQ; README; getting started; using (images' What a new VM gets, coding
agents' Running an agent, settings' agents); internals; contributing;
the cli skill; AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 00:45:09 -07:00
w3cjandClaude Opus 5.5 b8c2b60795 fix(vm): a link session doesn't reuse a lookup its connection cancelled
targetRuns stored a lookup whose context ended as the target's run, with
no start, so for linkRunFor every other connection to that target, those
waiting on it and those coming after, was refused as
link_target_stopped though the target ran. A lookup cut short is now
marked and dropped from the cache before it's done: the connection that
cancelled finds the target stopped, and the waiters look again, one of
them leading the new lookup.

- targetRuns.get split into lookup (find or make, under the lock) and
  run (look, then keep or cut).
- TestLinkRunCancelled: one waiter cancels, another waiting on it and a
  third in the same second get the run, from two lookups.
- internals/ports.md and design.md say a cut-short answer isn't shared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 01:38:10 -07:00
w3cjandClaude Opus 5.5 497414fdda fix(tools): retry the pinned mise's download after failures that may pass
HostMise's download of devvm's pinned mise was a single request, so one
dropped connection or a 5xx from GitHub's release host failed the tools
lock's resolve. It now runs in fetch.Retry, tried again up to three
times after fetch.Transient failures (no answer, 408, 429, 5xx), one
second first and doubling; a 4xx, a refused redirect or a checksum
mismatch fails at once.

- Env.RetryDelay: the delay seam, time.Second from New.
- TestHostMiseRetry: two server errors then the file, a 429, and 404
  and 403 answered once.
- internals/images.md says how the download is retried.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 01:38:10 -07:00
w3cjandClaude Opus 5.5 2b25a0c7dd fix: the shared foundations' review: one Lima host address, a kill only for its own process, and the Linux baselines
The consolidation pass over the shared foundations:

- Lima's host address on its user-mode network, 192.168.5.2, is one
  constant, limaHost, which the VM's proxy URL and the build proxy's
  both use (proxyHostDarwin and buildProxyHost went).
- platform.LockFileShared had no caller: LockFileSharedWaiting with no
  waiting does its job, and its tests use that. image.ToolName had none
  either, and goes until the tools picker needs it. mise run deadcode
  lists only what AGENTS.md names.
- tools' writeNew, a third whole-file writer, goes: the share's .sha256,
  .target and idle files are written through state.WriteFile.

From the security audit of the phase:

- daemon.Proc.Stop sends SIGKILL only to a process whose arguments still
  say it's this one. A process still ending, whose arguments can't be
  read, is waited for; so is another process given the pid since whose
  arguments can't be read either (a setuid one, on macOS), which would
  have been killed. TestProcStopKillsOnlyItsOwn fails without it.
- forbidigo's signalling rule also bans os.Process's Kill and Signal
  outside daemon and platform; tests signal their own children, and
  devvm desktop's ssh child, not yet waited for, says why with a nolint.
  testdata/lint has a line for each. Contributing's checks table says so,
  and internals/network.md says which process SIGKILL goes to.

testdata/coverage/linux.txt is measured again with mise run coverage on
the x86_64 Linux host: it had no lines for fetch, shell and vmname, so
mise run test failed on Linux, and daemon was set by hand. arm64 (the
Linux host VM) agrees within a point. darwin.txt: daemon 97.8, tools
89.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 23:52:51 -07:00
w3cjandClaude Opus 5.5 dc349717a2 fix(links): a link session's connections to one target share its run
Each connection a link session carried asked the target's backend
whether it runs, its start and its ssh (Inspect, StartID, SSH). On
smolvm each of those runs smolvm machine ls, and a burst of 256
connections ran them all at once, which answered wrongly for some, so
connections were refused as link_target_stopped or ssh: vm_not_running.

linkCheck gives a session targetRuns: one lookup in flight for each
target (by name and ID), its answer reused for linkRunFor (one second),
so a burst asks the backend once on every backend, and a target that
stops is noticed within that second. The links state, CheckLink and the
policy check as the target runs (policyEnforced) are still made for
each connection.

e2e's lk_stopped connects again until the stop is seen, as a
connection within that second may reuse the target's run.

Tests: TestLinkCheckBurst (256 concurrent checks run one Inspect and
one SSH; failed with 256 of each before), TestLinkRunReused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 23:24:35 -07:00
w3cjandClaude Opus 5.5 c601958355 fix(links): link sessions' and port forwarders' ssh get devvm's limit on open files
A link session carries up to 256 connections at once through an ssh
master to each target, which takes in two descriptors (stdin, stdout)
for each connection's ssh -W. Go raises devvm's own soft limit on open
files but gives the processes it starts the one it started with, 256 by
default on macOS (and for launchd jobs, as the remote e2e runs are), so
the master ran out of descriptors well before 256 connections
("mm_receive_fd: recvmsg: Message too long") and closed those it
couldn't take: e2e's 256-connection check failed,
and as it returned early it left its link to db:47241 in place, so the
group checks after it found other links than they expected. A shell
with a higher limit (this Mac's) never showed it.

- platform.ShareFileLimit sets the limit to what it is now, so the
  processes devvm starts from then on get it; vmssh.Links.Run and
  vmssh.Forwarder.Run call it first. TestShareFileLimit starts a child
  test at a soft limit of 256 and checks its own child gets more (fails
  without it: 256).
- e2e: the link section runs devvm at a soft limit of 256, so it fails
  without the fix on any Mac (it did, deterministically, on this one).
  lk_cap ends its hold server and removes its link whatever came of its
  checks, and shows the reasons of its refusals. lk_start waits until the helper listens or has ended (its
  wrapper writes "exited N"), and on a failure says so with "failed: ",
  lists its files, shows its output and the VM's TCP listeners. gp_join
  publishes and starts its server, then the three join whatever came of
  the server (gp_joined), so a server that doesn't start fails that
  check alone.
- docs: internals/ports.md (the ssh processes' limit), contributing
  (the link section's limit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 22:47:16 -07:00
w3cjandClaude Opus 5.5 ae77c7bc45 fix(daemon): a stopped process counts as stopped once it's gone, not once its arguments go
A proxy restarted on a running VM (its company proxy settings changed,
say) was stopped with SIGTERM, and Proc.Stop took it as stopped as soon
as its arguments could no longer be read. An ending process loses its
memory before its files: on macOS kern.procargs2 fails some milliseconds
before its listening socket closes (every time, in a test of 30 stops),
and on Linux /proc/PID/cmdline reads empty. When Stop looked in that
window, Prepare found the VM's proxy port still taken, failed the launch
with proxy_port_taken and stopped the VM (Unproxied): e2e's company
proxy checks 15 and 17 failed in turn, and the checks after them found
the VM stopped.

- daemon.Proc.Stop waits until no process has the pid, or another
  process does (Proc.ended); one whose arguments can't be read is still
  ending.
- platform.ProcessArgs on Linux returns an error for an empty cmdline
  (an ending or unreaped process), as macOS does, never [""].
- Tests: TestProcStopWaitsForTheEnd (fails before the fix: Stop returned
  while the process still ran) and TestProcessArgsEnded.
- e2e: check prints a failed check's "failed: " lines first, then its
  last lines (5, or check_lines); checks 15 and 17 are functions
  (corp_through, corp_direct) whose steps each name themselves, then
  corp_why shows the VM's status, its proxy, the launch's output, the
  proxy's log and events, and the company proxy's log and events.
- docs: internals/network.md says when the old proxy counts as stopped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 22:46:56 -07:00
w3cjandClaude Opus 5.5 51f1dc48e7 test: stubs write each call-log line in one write
The stubs logged with echo "x $*" >> "$STUB_LOG", which bash can write
in pieces for a long line, so a stub running at the same time could put
its own line in the middle. Every stub now appends through
testdata/stubs/stub-log, a Perl script that writes the whole line with a
single syswrite to the file opened for appending: the call log and the
stubs' shared lists ($STUB_DIR/containers-made, unpacked, scripts,
tm-excluded). The stubs run it from their own folder (${0%/*}), and
stubtest.New links it too when it puts only the named stubs on PATH.

TestCallLinesWhole runs two open stubs at once with 100 KB arguments
while the test appends short lines of its own to the log, and checks
every call landed whole; it failed on every run with the old stubs.
TestStubsLogWithStubLog fails on any stub that appends to $STUB_LOG or
$STUB_DIR with the shell's >>.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 22:27:07 -07:00
w3cjandClaude Opus 5.5 e9f791bc96 refactor: one owner for the proxy's constants, URLs, variables and tunnels
The proxy owns the links' addresses and domain and the proxy user:
proxy.IsLinkAddr, proxy.LinkAddr, proxy.LinkDomain and proxy.ProxyUser
replace vm.IsLinkAddr, vmssh.IsLinkAddr, vm.LinkNet, vm's linkNetAddr,
vm.LinkDomain, netpolicy.LinkDomain and the proxy's own isLinkAddr and
linkDomain. TestLinkAddrsAgree goes, because there's nothing left to agree.
The proxy's link list now refuses an IPv4-mapped address too, as vm's
parser already did.

backend owns the guest's view of a proxy: ProxyUser (proxy.ProxyUser),
ProxyURL, GuestProxyVars, ClientProxyVars and NewProxyPassword replace
four URL builders (BuildProxy.URL, Lima's, Docker's and smolvm's), the
user written out in three places (netpolicy.ProxyUser, buildProxyUser,
Docker's proxyUser), the guest's variable list in three (Lima's inline
loop, smolvm.proxyVars, Docker's proxyVars) and the client's in two
(limaProxyVars, Docker's noClientProxy list), and the two password
generators. Confinement.ProxyUser goes: Docker ignored it, and every
backend now uses ProxyUser. A new VM's proxy key is NewProxyPassword's
64 hex digits, as a build proxy's was; a VM keeps the key it has.
doctor reads HTTPS_PROXY through backend.ReadHostProxy.

In the proxy, hijack and splice replace the three CONNECT copies
(tunnels to allowed hosts, tunnels to links, interception's hijack) and
the relay's pipe. A tunnel passes the bytes as they are, passes on the
end of what the client sent, and ends, closing both connections, when
the server's bytes end or the client has gone. A relayed connection now
ends with the proxy's side too, where before it waited for both.

Tests: splice_test.go characterises the allowed-host tunnel, the link
tunnel and the relay (a megabyte of every byte value, a half-close
answered, a client that goes away ending the tunnel), written against
the code before this change; TestSpliceEnds, TestHijack and
TestIsLinkAddr (every LinkAddr) are new, and so are TestProxyURL,
TestNewProxyPassword and TestProxyVars. TestLinkListRefused gains a
mapped address.

e2e: the relaunch without a company proxy says which step failed, with
the launch's output, the VM's status and the proxy's log, and a link
helper that doesn't start shows its output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 20:51:28 -07:00
w3cjandClaude Opus 5.5 6f9259b514 test: give each CLI test script its own coverage folder
The CLI tests' devvm is built with -cover, and every script set one
GOCOVERDIR. Go names a run's temporary meta-data file by the time
(time.Now().UnixNano(), microseconds on macOS) with no process ID, so two
devvm runs from parallel scripts that start together write the same
temporary file; the first renames it and the second's rename fails, and
devvm prints "coverage meta-data emit failed" on stderr, failing any
script that checks stderr (seen in ls.txtar and version.txtar).

- script_test.go: scriptCoverDir sets GOCOVERDIR to a folder of the
  script's own (os.MkdirTemp under CLI_GOCOVERDIR).
- scripts/test.sh: covdata merge takes the unit folder and every
  non-empty script folder as one comma-separated -i list, so percent and
  the baselines read the same counters as before.
- Contributing's Coverage section says each script writes to a folder of
  its own, and why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 22:04:17 -07:00
w3cjandClaude Opus 5.5 b5c51ae9f7 test(e2e): need OpenSSL as openssl, and stop at the start without it
The CA checks serve HTTPS with openssl s_server, and macOS's LibreSSL
cuts the VM's OpenSSL client off mid-request. e2e now checks openssl
version before it builds anything and stops in one line naming
brew install openssl@3 (Homebrew's keg first on PATH) when openssl is
LibreSSL or missing. The contributor docs list OpenSSL among e2e's
needs on macOS; devvm itself never runs openssl on the host, so doctor
and the user requirements stay as they are.

Tested by hand: a stub openssl printing "LibreSSL 3.3.6" first on PATH,
one printing nothing, and PATH=/usr/bin:/bin (macOS's LibreSSL) each
stop tests/e2e.sh --only project at once with exit 1, before the
sandbox or the build is touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 21:23:14 -07:00
w3cjandClaude Opus 5.5 5003d94cfb refactor: read HOME once, into paths.Dirs.Home
paths.FromEnv reads HOME, which must be absolute, and keeps it, cleaned,
as Dirs.Home; everything else takes the home folder from there. Six other
reads go: vm.NewEnv's and cli's devvm secret's os.Getenv("HOME"),
gitprotect.New's, Docker's and smolvm's os.UserHomeDir (Desktop's
settings file, the machines' location), and smolvm's Getenv("HOME")
(DiskDirs).

- vm.Env.Home and secrets.Store.Home are gone: both read Dirs.Home.
  secrets.NewStore takes the Dirs alone; gitprotect.New takes the home
  folder for ~ in git's paths.
- forbidigo bans os.UserHomeDir, with its line in
  testdata/lint/forbidigo.go; the structure test's owners check gains
  envOwners, HOME read only in internal/paths/dirs.go, with cases for a
  read outside it, through a field, in paths and in a test.

Tests: TestFromEnv checks Home (and a HOME cleaned), TestNewHome (~ is
the home New is given, not the environment's), TestDiskDirs checks
Location too. Coverage unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 16:07:15 -07:00