Any work that can take noticeable time now runs under the UI's status
line: a Reporter's Status with a label message, or a LoggedCmd step.
The UI:
- status lines are a stack: a Status or LoggedCmd inside another shows
its own line, then the outer one is drawn again, where before it
ended the outer one for good
- a message (Info, Warn, Note, Say, data on Stdout/Stderr) clears the
line, prints and draws it again below; an unended line holds it
- a question (Ask, Confirm, Answer, Secret), the picker and
ui.Terminal hold it until they're done
- no status line starts once the run is interrupted, as nothing would
clear it
- the run log's path is read without the log's lock, as the status line
reads it under outMu
Covered, by site and label:
- finder.target: finding_vm; Lima's limactl --version: checking_backend
- bringUp's checks (seeds, instance, recordFolder, hostChecks, ssh,
requirements) and a running VM's go-on (proxy, pins, mount check):
checking_vm; startOnce after the agent: starting; the self-check's
probes: checking_network; pinHostKeys: reading_host_keys
- setUpVM (sync, ssh config, links, clone seed): setting_up_vm; each
devcontainer command: running_script; makeMachine: creating;
buildOnce: checking_image; paste's count and rm: reading_pasted
- volumeOf's lookup (diskutil), for launch, adopt, move, ls and rm:
looking_up_volume
- vm.ListAll (devvm ls): reading_vms; devvm doctor's checks:
doctor_checking
- devvm agent import: agent_import_reading (walk, links, opencode),
agent_store_saving (copy, marketplace git checks, tmutil); devvm agent
save: agent_save_reading, agent_save_comparing, agent_store_saving
- devvm stop (from its pins check on): checking_vm; a delete, an
orphan's teardown and Lima's DeleteImage: deleting; devvm git-protect
and clone on/off's .git work (leftBehind, mountFolder, unmountFolder):
git_protecting; git-protect's re-read: finding_vm
- devvm clone add: clone_reading, clone_adding; clone fetch:
clone_fetching; planClone: clone_planning; the clone check before rm
or a remake: clone_checking; history export and import:
history_exporting, history_importing; a remake's home: saving_home,
restoring_home
- devvm upgrade's install: upgrade_installing; the shared tools' step
back and .NET's downloads: resolving_tools; gc's caches: reading_space;
the retention settings (daily and in gc): retaining
Work that takes the terminal stays off: the shell, ssh-add's
passphrase (checkAgent, Agent.Ensure, reloadAgent) and an agent's login.
Tests and guard:
- msg.Fake: OnStatus and Showing; its LoggedCmd shows its step
- backendtest.Fake: OnCall
- TestLaunchStatusLines: every backend call of a new, running and
stopped VM's launch runs under a status line but the shell's and
Running's (pid files)
- TestSSHAddOffStatusLine: ssh-add, on the user's agent or devvm's, never
runs under one; chflagsCalls fails a .git lock or unlock with none
- the structure test's status-lines rule (statusSites, statusFree)
- TestStatusLinesNest, TestMessagesClearTheStatusLine,
TestQuestionsHoldTheStatusLine, TestSecretAndPickerHoldTheStatusLine,
TestTerminalHoldsTheStatusLine, TestNoStatusLineOnceInterrupted,
TestFakeStatus, TestAgentImportStatus, TestAgentSaveStatus,
TestDoctorReport, TestProblems, TestList, TestListLooksUpVolumesOnce,
TestVolumeOfCache, TestWithSDKDownloads, TestRetainStatus,
TestSetCloneOn, TestTeardownLeavesNothing
The rule is written in the cli skill (rule 14, checklist, review), the
codebase-standards skill (Show what devvm waits for, its checklist line
and rules.md's row), Contributing's CLI page (Status lines), its tests
and structure pages, and the troubleshooting page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
internal/safefile (standard library only) owns every read of a file a VM
can write or swap: Read and Open never block on a FIFO, follow a final
link only when asked, and check the opened file is regular, within its
cap and, with OneLink, singly linked; OpenRoot opens beneath a folder.
The proxy, secrets, agentlogin, devcontainer, detect, agent save and
gitprotect read through it, fixing three hangs on a FIFO the VM leaves,
and forbidigo holds those callers to it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The history export keeps at most 2 GiB: past it, devvm stops the VM's
command, removes the partial file and keeps no export. devvm history
export fails with history_too_large; devvm rm, devvm rm VM and a remake
warn with it and go on. opencode's import of devvm's logins (devvm agent
login) is read up to 1 MiB, then stopped and refused
(opencode_import_too_much). Each VM command adds at most 4 MiB to the
run log (Env.vmLog), then a "devvm: truncated" line.
agentsave's bounded writer is the one owner, in bounded.go: it takes in
vm's capped, and with a cancel it fails every write past its max, so a
command that keeps writing ends. Its buffer is a field: embedded, it gave
the writer bytes.Buffer's ReadFrom, which io.Copy (os/exec's copy of a
command's output) used in place of Write, so no cap held, agent save's
128 MiB included. vmssh's capped had the same flaw, fixed the same way.
Env.HistoryMax, and DEVVM_HISTORY_MAX in a test build, stand in for the
export's cap in tests. The stub guest's opencode-floods and
history-floods switches write without end.
Tests: TestBounded (io.Copy too), TestVMLog, TestExportTooLarge,
TestRemakeHistoryTooLarge, TestImportLoginsTooMuch, TestShellFloods,
vmssh's capped through io.Copy; history_import.txtar (an export that never
ends: export fails, rm deletes and warns, the run log truncated) and
agent_login.txtar (opencode's import floods).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Before devvm makes a new VM it shows a summary of what the VM gets:
each toolchain, coding agent and layer with why (the file that calls for
it, devvm setup, config.toml or the flag that gave it), its size, network
tier and ports, and the devcontainer.json it's made as. Where the picker
shows (CanPick) and something is left to choose, it asks
"Customize it? [y/N]": Enter makes the VM as shown; y opens the picker
(a part a flag gave greyed out), then the network tier question when no
tier is given or saved, then the VM's CPUs and memory (for this VM
alone). Without a terminal or with --no-input the summary ends with the
flags that choose others. The summary replaces new_vm_gets and
devcontainer_using. devvm's first run asks its size and agents first,
as before, then shows the summary.
A test build's DEVVM_PICK_ON_PIPE shows the picker with a terminal on
stdin alone, so testscript's ttyin reaches it (up_customize.txtar).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm update now makes the folder's VM again from its devcontainer.json
as it is now when the file changed, is gone or appeared since the VM was
made, as well as when its image is outdated. devcontainer_changed and
devcontainer_new name devvm update instead of devvm rm, then devvm. A
file's forwardPorts now join the VM's ports as devvm ports add adds them,
for a new VM and when devvm update reads the file again.
- vm.json's devcontainer section records what of the VM is the file's:
image (the file's image, when the base starts from it), from_flag
(--from won), parts (what its features mapped to), gave (those the VM
got from the file alone, not from --tools/--layers, setup's layers,
the folder's other files, nor unchecked), ports (its forwardPorts) and
ports_gave (those it added to the VM's ports).
- devcontainer.Reread (pure) drops what the file gave that it no longer
lists and adds what it lists anew that the VM lacks; the user's stay,
and what the user took out stays out. It applies to parts
(rereadParts) and to ports (filePorts, through AddPorts and
RemovePorts, as devvm ports add and rm). devcontainers.reread
re-pins a new image (or falls back to $DEVVM_FROM's), keeps --from's,
and replaces variables and commands.
- The remake section carries reread (the new from, shared tools, ports
and devcontainer section; tools built for the new base after the
image) and was (what the VM had, kept when the new machine is made),
which the undo gives back, for every remake.
- Messages: devcontainer_changed/new reworded, devcontainer_reread and
devcontainer_gone added, devcontainer_ports_not_forwarded removed; the
docs link points at the new "Updating a VM from the file" section.
- Tests: TestReread, TestRereadParts, TestFilePorts, TestFileParts,
TestUpdateDevcontainer (undo and finish), TestUpDevcontainer and
TestPlanDevcontainerFrom (the file's ports added), devcontainer.txtar
(a new VM's ports, update after a change with the user's port added
and the file's removed, --from winning, the file removed, a file that
appeared), e2e's devcontainer section (the file's port reaches this
machine; devvm update, the home kept, the new port in place of the
old one).
- Docs: using/devcontainer (its ports, the security note), images,
toolchains, commands, the internals overview's remake section and
state table, the design note, the security model, attack vectors.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Options stays as it was asked for: devcontainers.prepare returns the From
a new VM is made from and its devcontainer.json's plan, which go into
newVM (from, dc) and from there into its builder, its parts and its state.
creation.plan parses --cpus, --memory, --disk and --ports itself
(newPorts: the flag's, else the default's, the file's ports beyond them
said), so Up and create no longer carry them.
creation.machineSpec is the one VMSpec a VM's machine is made with, new
(creation.plan) or again (remaking.spec), agent-toggle let through or not
as Allowed has it, so the requirements' check tells of an unreviewed
emulation once. creation.makeMachine is the one make: the ssh port,
CreateVM and created, for create and remaking.finish.
Tests: TestPlanDevcontainerFrom (a devcontainer.json pinning From: the
plan's From and builder, size, ports, the ports warning), written on the
code before; TestChooseNet loses its devcontainer case, which chooseNet
never read. up_test and remake_test are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm set SSH_AUTH_SOCK process-wide from the finder's inspect, each
start and a new VM's plan, so later limactl calls and every background
process devvm spawned got whichever VM's agent was set last: a run that
reached several VMs (a group's sync, a link's change) could hand one VM
another's agent, and ssh-add -l checked the wrong agent.
- vm: Env.useAgent is gone; Env.agentSocket maps a choice to its socket
(devvm's, the user's from Environ, or none). The finder's found carries
agent, set by inspect and by bringUp from the confinement it returns;
found.exec passes it. start sets Confinement.AgentSocket for every mode,
runningConfinement takes the running mode and sets it too, and the sync,
devcontainer commands, --clone's seed, home copy, export, desktop and
the shell carry it.
- backend: ExecOpts.Agent, ShellOpts (Shell takes it), AgentSocket ""
means none; the backend never reads devvm's SSH_AUTH_SOCK.
- lima: limactl removes SSH_AUTH_SOCK from every command; Exec, Shell
and start (confine) set the VM's own; a degraded start's check carries
it.
- daemon: Spawn drops SSH_AUTH_SOCK from the child environment.
- Guard: forbidigo bans os/syscall Setenv, Unsetenv and Clearenv outside
tests and daemon/status.go; testdata/lint breaks it.
- Tests: TestAgentPerVM (two VMs, devvm's and the user's, in one run),
TestDetach (no agent), TestExecAndShell and TestProfileAgent (Lima's
per-command env), TestUpSSHAgent and TestOpenAgent check the shell's
and Exec's agents and that devvm's environment stays as it started.
- Docs: internals/security.md (how the agent travels), contributing's
forbidigo list and owners table.
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]>
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]>
internal/shell, a stdlib leaf: Quote, QuoteJoin and EnvName. They
replace the 4 shell quoters (lima's shq and shqJoin, docker's shq, vm's
and devcontainer's shellQuote) and the 4 variable-name regexes (docker's
envKey, vmssh's envName, vm's envVarName, devcontainer's envName).
lima's quoting tests move there as TestQuote and FuzzQuote.
internal/vmname, a stdlib leaf below project: Prefix, HashLen, IsVM and
SlugOf. project's vmName regex, IsVM and Prefix go (callers use vmname),
lima's projectVM, docker's hostname parsing and cli's export-name regex
use it. TestImageKey (lima) pinned imageKey before the change;
TestParseExportName covers the export names.
Value patterns exported once: from.IsDigest (lima's idPattern),
image.IsKey (build's keyLike and the keyPattern copies in lima, docker
and smolvm), image.ToolVersion (tools' versionLike) and image.ToolName,
with TestIsDigest and TestValuePatterns. state's featureName stays:
internal/state may not import internal/image.
netpolicy.PolicyFiles names a user layer's policy file only for a part
image.LayerName takes, so an image-name part such as ../x never names a
file outside the user's layers; TestPolicyFiles's ../x cases failed
without the check.
The structure test's owners check gets literals: a non-test string
literal holding '\'' outside internal/shell, or [0-9a-f]{14} outside
internal/vmname, fails, naming the owner. TestRulesFail has cases that
break and keep both. shell and vmname join the leaves' layer, and
devcontainer may import shell. Coverage baselines: shell and vmname
added at 100.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A value a VM made reached the terminal unfiltered wherever a caller
forgot msg.Shown, such as the errors passed as err.Error() and a link's
name. Four cleaners did the job in different ways: msg.Shown (quoting),
ui's printable and oneLine, netpolicy's oneLine and the port
forwarder's log (which let C1 through, in UTF-8).
msg.Printable and msg.OneLine are now the one cleaner: they drop C0 but
newline and tab (OneLine drops those too), DEL and C1, in UTF-8 or as a
lone byte. Every message value goes through OneLine as the message
renders, in Text, Segments and names mode, so no caller can forget it,
and msg.Shown is gone with its 68 calls. The status line, the run log's
end and verbose output, Pick, devvm network log, the forwarder's log and
a clone's status lines use them too.
Tests: TestPrintable and TestValuesArePrintable (internal/msg), the
hostile-value segments test, TestLogLimit (internal/backend/vmssh) with
C1 in UTF-8 and as a lone byte; TestCheckLinks and
TestNewVMOtherRepoAndCommondir expect the cleaned values.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new VM gets what the folder's .devcontainer/devcontainer.json (or .devcontainer.json) says, on every backend: image as --from (only an image its registry gives anyone, asked anonymously, pinned to that digest, never a registry on this machine or its network), features devvm has layers for (docker-in-docker as the docker layer, node, python, rust, go), forwardPorts as far as the user's ports allow, containerEnv and remoteEnv in the VM's environment, onCreate/updateContent/postCreate commands once and postStartCommand at each start, in the VM as its user. --no-devcontainer skips it; the command line wins. Later launches only warn when the file changed.
Nothing from it runs on or reaches the host: initializeCommand never runs, ${localEnv} and the host-folder variables are refused, builds, Compose and docker-outside-of-docker are refused, mounts, runArgs and privileged ignored. The file is read through os.Root, without blocking, at most 1 MiB. A docker layer only the file asks for still asks about network policy on Docker.
Reviewed with the security-audit skill (FuzzParse, design note); e2e: project 69/0, docker linux 135/0, smolvm 131/0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>