mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
2a99183ea4ee8052e76d3976ff773c0aab8aec46
203
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2a99183ea4 |
feat(vm): devvm update reads a changed devcontainer.json again
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]> |
||
|
|
e9ca7a4859 |
feat(vm): a moved or renamed project folder keeps its VM
A VM's files and machine are keyed by its name's hash, which stays; what moves is the state's dir. The finder finds a folder's VM by the state that records its path (finder.state: the path's hash first, then every state, recorded), so a VM moved there is found from the new path alone, and links by path (project.ForDir) match the recorded dir. When the folder has no VM, the finder looks through the states for one made for this folder at another path (moveHere, move.go; the match is here.movedFrom): the same folder identity (device, inode, birth time), the folder this user's, its identity unique (platform.UniqueFolderID: an ID with a birth time, and on macOS APFS or HFS+), another recorded path that's gone on the folder's device or only a symlink to here, its creation finished, not a --clone VM. One match is offered: in a terminal move_vm, [y/N]; without one vm_moved_here, naming devvm adopt; devvm adopt --force moves it without asking. Several matches warn (vms_moved_here) and move none. Never automatic. The move (finder.move) refuses a folder no new VM may have (checkUnsafe), holds the creation locks of the VM and of the folder's would-be new VM, checks again that no state records the folder and that the folder is still the one asked about (move_folder_changed), stops a running VM as devvm stop does, then records the path and identity under the VM's lock, refusing a state that changed meanwhile (create_running); vm_adopted says so. .git protection's record is kept: .git, its identity and its uchg locks move with the folder. The project folder's mount is now part of backend.Want (Want.Project, Instance.Project, Apply), so the next start mounts the folder where it is: Lima's wantEdits rebuilds .mounts in its one edit when the project mount or the agent folders differ (mount.project). A VM running with another path asks to restart (Y/n) and otherwise warns (next_start_folder, folder_next_start). A new VM at the old path can't use the moved VM's folder, so newName takes the first of the path's names whose VM folder holds no state (project.Nth: the hash of the path, then of the path and n). devvm adopt [VM]: with VM (by name or alias, as devvm rm VM), moves a VM whose folder is gone or not connected to this folder, for a copy on another disk (a new inode, never matched on its own): adopt_move_vm [y/N], --force, adopt_move_refused without either; refuses a --clone VM (adopt_clone), a lost machine (rm_vm_lost), an unfinished VM, a folder still there (adopt_folder_there) and a folder with a VM of its own (adopt_has_vm). It clears .git protection's record, as the copy's .git is another. rm_vm_state_mismatch is gone, as a dir needn't hash to the name any more: devvm rm VM acts as devvm rm only on the folder's own VM (finder.folderVM), and a VM whose state names a folder with another VM of its own is refused as one whose folder is there. macOS's FolderID has the folder's birth time too, as Linux's has. Security review (security-audit skill, focused, with an independent read): inode reuse needs a unique identity (birth time; APFS/HFS+ on macOS), the same device (in the ID) and the old folder gone; another user's folder never matches (its owner checked); a copy has a new inode and never matches; links and groups go by name and stay, and links by path take the recorded dir, a move refused when another VM records it; a symlinked cwd is resolved first, and a symlink at the old path counts only when it resolves here; .git protection's record stays for a move and is cleared for a copy; agents' mounts are unchanged (only the project mount changes); a VM can rename only folders inside its own mount, which it already writes. Fixed from the review: a folder swapped at the path while devvm asked was moved to (now move_folder_changed); macOS device:inode could collide with a later volume given the same device number (birth time added); a running VM kept the old path's share, which a new folder made there would reach (the move stops it first); a move to the home folder or into devvm's own folders (now checkUnsafe). FolderID's format change makes VMs and .git records made before it look like other folders (adopt them, or make them again). Tests: TestMovedFrom (table: gone/present, same/different device and inode, a non-unique ID, another user's, a clone, unfinished), TestMovedAway (gone, a folder, symlinks here/elsewhere/dangling), TestMoveHere (refused, no, yes, found by its dir, stopped, the new mount at start, a restart for a running old mount, a new VM at the old path by its next name), TestMoveFolderChanged, TestAdoptMoved, TestMoveHereSeveral, TestAdoptVM, TestUniqueFolderID, ForDir and Nth in project, wantEdits' moved project, the conformance start's moved project; move.txtar (refused, no, yes, found, Lima's mounts edit, a new VM at the old path, adopt VM of a copy); rm_vm.txtar's hand-edited dir; e2e project: mv, refused, a yes in a terminal (script), the home file kept, the new path mounted alone, moved back with adopt --force. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c98f91d8ad |
feat(history): devvm history import, and a new VM offers its folder's newest export
devvm history import [FILE] puts an export of agents' history into this folder's VM: FILE, or the newest export devvm saved for the folder (by its .folder file, through vm.Exports.Newest), never another folder's. The file is streamed into the VM as it is, and the VM's GNU tar unpacks it there as the VM's user, so the host never reads it. The VM lists the export's paths as they are first and imports nothing when one is outside the agents' history, absolute or has a .. part (history_import_unsafe). It unpacks into a folder of its own without owners or modes and without the agents' logins, ~/.claude.json (the old VM's placeholders) and every agent's mounted folders and copied files (importSkips), takes out symlinks pointing outside, then copies the history paths into the home without replacing what the VM has. A new VM with an agent offers the folder's newest export: in a terminal it asks, [y/N] (history_import_ask); without one it says how to import later (history_import_later). The import runs once the VM has started, before its setup, and a failed one only warns. Messages: imported, history_not_imported, history_import_unsafe, history_no_export, import_failed, history_import_ask, history_import_later. Tests: TestHistoryImportScript, TestHistoryImportRuns (GNU tar only), history_import.txtar; the stub guest keeps an import as history-in.tgz and takes a history-unsafe switch. e2e's project section: rm, a new VM in the same folder naming the export, devvm history import, the history checked in the VM, and a refused export with a .. path. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
84720ccfe3 |
feat(vm): opening a running VM with changes waiting asks once to restart it
When devvm opens a running VM that gets changes only at its next start (its size, SSH agent forwarding, agent folder mounts, network policy turned off while it ran confined), it names them in at most two lines and asks restart_now once, in a terminal. It's yes by default ([Y/n]) when the agent folder mounts wait, as an agent just added needs them, and no ([y/N]) otherwise. Yes stops the VM, so the launch starts it with the changes and opens the shell; no, no terminal or --no-input keep the next-start warnings and open the shell in the running VM. - starter.restartForNextStart asks, on the launch path only (upOpts agentDirs); nextStartChanges is the one list both it and nextStart's warnings use; nextStartContext gives each change's line, or past two the first and how many more - messages: next_start_size, next_start_agent, next_start_mounts, next_start_net_off, next_start_more (plural); restart_now is plural (count), one change or several - Env.restartNow takes the question's form (Confirm or Ask), the count and its context lines - updateAgentDirs no longer asks on its own: a running VM's new mounts join the launch's one question, so a launch asks at most once - tests: TestOpenAsksToRestart (both defaults, yes, no, no terminal, one, two and four changes, nothing waits), TestUpdateAgentDirs updated; size.txtar opens a running VM with a size waiting without a terminal, then no and yes in one (yes ends at a failing setup, so its coverage is written) - docs: commands.md's restarting section and answers table, ports-size, coding-agents, ssh, safety/network, internals/overview Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c1ca05bd94 |
refactor(vm): housekeeping and exports move out of cli
vm.Housekeeping owns what devvm keeps besides its VMs, and cli only renders what it returns: ListImages and ShareListing (the tool targets, worked out once in ToolTargets, for devvm images, gc, space and retention), LockGC, PlanGC (one inventory per run: the states, with --orphans the backends' lists too), GCPlan.Apply (returns GCDone, what it deleted in order, an image the backend refused among it) and Retain. gc runs on the run's one registry throughout, --caches included. vm.Exports owns an export's name (parsed without a regex), the list, the .folder file written and read, deletion and a folder's newest export; it replaces lifecycle.go's name, history.go's parse and retention's handling. One orphan definition: devvm space's leftover state is now what devvm gc --orphans would forget (Leftovers.FindIn, on space's own inventory), so a VM whose state changed in the last hour, one made in another Lima home and one being made again count as state, not leftover, and the row's retention uses the orphan's Changed time. space.txtar pins it against gc --orphans' list. gc's Short names old files and the Nix cache over its cap; the CLI reference is regenerated. using/space.md says what leftover state is. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e6f64dae31 |
refactor(vm): one VM inventory per run
vm.Inventory (internal/vm/inventory.go) holds each project VM's state, backend and Instance, read in one place: ReadStates for the states alone, ReadInventory (UsedBackends or AllBackends) for the backends' lists too, each within the host's list wait (30 s), with the backend's Check saying why a list failed. It replaces Env.mounts, recordedVMs, vm.List and vm.ToolsInUse, linkstate's clientStates listing, the secret list's, Leftovers.Find's (and backendVMs), cli/space.go's two (backendRows' list, vmFolders), images' state.Backends and sshconfig's running list: sshconfig.Write takes the inventory's Running VMs. state.ReadAll reads each VM folder on its own (only the inventory calls it, a structure-test callers rule); state.Backends and Registry.Used go. One failure policy: - a backend that can't list fails a listing (Inventory.Err) only when some VM's state names it: devvm ls and the ssh config fail, and the ssh config stays as it was rather than lose that backend's entries; space and gc --orphans name it and leave its VMs alone; - an unreadable vm.json is its own row: ls lists the VM with its name and status alone and warns (vm_state_unreadable); links, the secret list, rm VM and link targets leave it out; gc --orphans never takes it for an orphan; ToolsInUse and Mounts (images, gc, space, the SSH agent's mounted-key check) fail on it, naming the file; - FolderOf is bounded (5 s): a folder on a hung share is there. Mounts come from the states alone, stopped VMs and agents' folders included, so the mounted-key check asks no backend. ui.Table shows every cell through msg.OneLine, so ls's cells can't move the cursor or break a row. Docs: internals/overview's listing, troubleshooting's file devvm can't read, ssh's mounted keys, contributing's owners table. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1b9755a7df |
refactor(vm): one finder for the VM every command acts on
finder.target(ctx, need) finds the VM a command acts on: the folder's own, the nearest parent folder's (resolveFolder), or one named for devvm rm VM. Its need says what the command needs (has: any, the VM, its machine, made; own; folder; noVM), and need.check is the one place that refuses a missing VM, one made for an earlier folder at its path (found.other, from sameFolder), a pending remake and an unfinished one. It replaces Env's find, own, findExisting, existing (10 callers), folderVM (7 callers) and the linkVM, groupVM, portsVM and agentVM wrappers, Net's policyVM, up's and toRemake's checkFolder, and rm VM's inspect by name. devvm rm VM refuses a state whose folder doesn't hash to the VM's name (rm_vm_state_mismatch), so a changed vm.json never sends it to this folder's VM. The environment reads the folder devvm runs in lazily (finder.dir), so devvm build, rebuild, images, space and gc run from a deleted folder; NewEnv no longer fails. Guard: the structure test's callers rule, state.ReadHash and project.Parents called only in internal/vm/finder.go outside their package and tests. Tests: TestFinder (need x none, own, parent, nested repo, other folder, unfinished, remake pending with and without its machine), TestRmVMFolderOfAnother, callerCases, no_folder.txtar and rm_vm.txtar's mismatch case (its fixtures' hashes now match their dirs). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e13839aa41 |
feat(cli): every command on the folder's VM takes --here and --parent, resolved in one place
The VM a folder uses is decided once, by vm's resolveFolder, from the folder's own VM, the nearest parent folder's (with any repo of its own in between) and the command's rule (vm.Env.Folder): by default the folder's own, else the parent's unless a nested repo is in between, else none (devvm makes the folder's own, other commands say no_vm). --here takes only the folder's own; --parent takes the parent's across a nested repo and past the folder's own, and refuses a folder inside none with a VM (no_parent_vm). devvm asks nothing now, in a terminal or not: use_parent_vm and use_parent_vm_repo are gone. The questions before deleting, remaking or widening a parent's VM stay. find resolves through it; own is the folder's own VM (adopt, --clone); lookup and useParent are gone; Options.Here is the rule's. cli: addFolderFlags (flags.go) adds --here and --parent into the run's app, which vmEnv sets as the rule; the two are exclusive, and with -g where a command has it; --clone and --parent are exclusive; devvm rm VM takes neither (rm_vm_folder_flag). Commands: devvm, restart, stop, update, rm, code, desktop, host, history export, tools (add, rm, update), size, ports (add, rm), network (allow, deny, rm, log), ssh-agent, git-protect, clone, secret use, secret unuse, layer add, layer rm, group (join, leave), link (add, rm, publish, unpublish). Tests: TestResolveFolder (own, parent, none, nested repo, --here, --parent), TestFolderFlags (every folder command takes both, and no other; refusals before anything runs; the rule each sets), the parent tests and subfolder.txtar's cases updated for no questions and --parent. Docs: the Commands page's subfolder section, first VM, --clone's subfolders, the overview's subfolder VM; the CLI reference regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f619bd2ca |
fix(lima): choose every build VM's ssh port under the claims lock, and clear stale build-port records
Linux build VMs' ssh ports were Lima's own pick, outside the claims lock, so another VM's forwarder could take one before Lima bound it. Lima's start now gets every build VM's port from ports.Allocator.Build on macOS and Linux alike, and sets it with its one edit. - start.go: the l.OS == "darwin" condition goes. - build.go, tools.go: cloneEdits goes; a build VM's start always edits its new ssh port, so the configure step is always counted. - ports.Allocator.Build holds a file lock on run/build-ports/<name> (platform.LockFile) until release, so the kernel lets go of it when devvm ends, killed or not. free, under the claims lock, first deletes (clearStale) the records no process holds that are over 15 minutes old (staleAfter: longer than Lima's 10 minutes of waiting for ssh, which a killed devvm's limactl start may still spend binding it). Tests: TestBuild (a stale record kept while young, then cleared; a held one kept however old), TestStartBuildSSHPort on darwin and linux, TestStartConfined's Linux builds, TestBuildImageLayer, TestBuildTools; TestCloneEdits goes. build.txtar checks the build's port edit and that its record is gone; tools.txtar's steps are one count on both systems; layout.txtar lists run/build-ports on Linux. The limactl stub needed no change: it applies .ssh.localPort on every host, and the contract's scenario already starts builds with a port. Docs: internals/design (reserved ports; the build VM's ssh port lead is now confirmed, fixed), internals/overview, using/space. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
39c2ff4f4e |
test: one Go multi-call stub for every host command
The 18 shell stubs in testdata/stubs (about 600 lines, limactl 337 of them) are one Go binary, internal/stubtest/stub, which acts as the command it's run as (argv[0]): limactl, docker, security, ssh, ssh-add, ssh-agent, ssh-keygen, qemu-img, qemu-system-aarch64, qemu-system-x86_64, chflags, tmutil, sw_vers, uname, open, code and mise, and stub, scripts' commands on the stubs' state. stub-log is gone: each stub logs its call itself, in one write to $STUB_LOG, its arguments on no other process's command line. - internal/stubtest builds the binary once, into $TMPDIR/devvm-stubs-<hash> (its sources and Go's version) with a link per command, which every test process and later run reuses until the sources change; a day-old folder of another build is removed. stubtest.Bin, stubtest.Command (DEVVM_HOST_MISE's path), and Stubs' VM, Size, VMs, Keychain and SetKeychain on the state. - internal/stubtest/stubstate: the stubs' state, $STUB_DIR/state.json, typed JSON under a file lock (Lima's instances with their status, size and config, the Keychain, the SSH agent and its keys, Time Machine's exclusions, the tools build VM's folder). The instances file wasn't locked; TestCreatesAtOnce and TestUpdatesAtOnce make 20 and 50 changes at once. - guest.go is the VM behind limactl shell and ssh alike: a --clone VM's git on vmfs, a remake's home, a base build's packages, the setup's tar, the direct connection, host keys, a forwarder's ports, link forwards. - A link session's master listens with a backlog of one and never accepts, as the Perl one did, so a killed session's socket reads as stale once probed (link_life). TestScript's cleanup stops the sandbox's masters by their -M -S arguments. - Structure: the stubtest layers cover internal/stubtest/..., the binary and its state import nothing else of devvm's; execSites lists internal/stubtest/build.go and internal/stubtest/stub/process.go. Renamed switch: hostkeys-fail is hostkeys-fails. Moved into the state: instances, size-<vm>, config-<vm>, keychain/<account>, agent-up, agent-held, tm-excluded and tools-out; scripts use stub vm, vms, size, keychain, keychain-set, agent and agent-stop instead (build, existing, from, gc, gc_orphans, images, ls, net_interrupted, rebuild, rm_vm, secret, size, space, ssh, ssh_agent, up). Tests: stub_test.go (every stub in-process, TestShellWords), stubstate_test.go, TestBuild, TestCreatesAtOnce, TestState; the lima, platform, vm, tools and build tests use the state helpers and stubtest.Command. Coverage: internal/stubtest/stub and stubstate added, stubtest, build and tools raised (and lima, netpolicy on Linux). Docs: contributing (Stubs: the binary, logging, the state and the stub command, switches, the guest, adding a stub or a switch; Go test helpers; the layers), testing.md; AGENTS.md's stubtest and testdata rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
da5bae47f9 |
fix: tighten VM names, validate aliases, make written folders private and choose build VMs' ssh ports under the claims lock
- vmname.IsVM takes a name's folder part only as project.Slug makes it ([a-z0-9-], a letter or digit at each end), so a hand-edited name never carries spaces, slashes, newlines or ssh patterns. TestSlug checks that every name project.New makes is one. - vmname.Short and vmname.IsAlias: a VM's alias is devvm-<folder> of its own name or the name itself. sshconfig.Host, ChooseAlias and project.Named ignore any other alias, so one edited into vm.json never reaches the ssh config's Host line or names a VM. - state's writeFileMode makes a missing folder with PrivateDir (exactly 700, whatever the umask, a link refused); a folder already there keeps its mode. - ports.Allocator.Build chooses a build VM's ssh port on macOS under the claims lock (state.Claims, which VM.Claim now shares), records it in run/build-ports/<name> until limactl start returns, and ports.Used reads those records, so no VM or forwarder takes the port before Lima binds it. Lima's own freePort and platform.PortFree, its only user, go; Lima gets a Ports field (the allocator). paths.Dirs.BuildPorts is new, and Dirs' method limit goes to 54. Tests: TestIsVM, TestIsAlias, TestSlug, TestChooseAlias, TestWrite, TestTargets, TestWriteFileMakesPrivateDir, TestBuild, TestStartBuildSSHPort; layout.txtar lists run/build-ports on macOS. Docs: internals (backends, overview, design), contributing, using/space. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4388d79ae |
fix(tools): each shared tool image builds in a VM of its own
A tools build ran every tool of a batch in one VM with a shared work folder and output folder, and a tool image's key hashes only its own tool's inputs, so one tool's installer (as root, through sudo) could write into another tool's image: through the work folder, a process left running until the next tool's mkfs.erofs, or by replacing mise or mkfs.erofs. A fresh folder per tool and killing its processes wouldn't stop root, so Share.Build now builds each tool in a throwaway VM and an output folder of its own (buildOne, moveIn), one after another, and only that tool's image and its .glibc are read from that folder. shared-tools/build.sh takes exactly one TOOL VERSION FILE. Measured on Fedora 43 (bare-metal x86_64, Lima with QEMU and KVM), node, pnpm and bun: about 16 s in one VM, about 34 s in three (two runs each, the same), so about 9 s for each extra tool, once per tool version. Tests: TestBuildOneVMEach (node's build writes every tool's file in its folder; each image holds its own tool's), TestBuild's one call per tool, TestUpTools' calls, tools.txtar's VM per tool. Docs: internals/images.md (building tools), internals/design.md's shared tools (a VM for each tool, the cost). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d9d169e972 |
fix(tools): a --from base never builds tool images other VMs mount
gnu tool images, which any VM whose tools need their key mounts, always build in a clone of devvm's own Ubuntu base on the VM's backend, never in a --from image, whose code runs as root in its build. --from Debian and Ubuntu VMs mount those images, and tool_needs_glibc still refuses a base too old for one. When devvm's own base isn't built yet, devvm says so (tools_need_own_base) and builds it first, pinning the cloud image on its first build as usual. musl tool images build in the VM's own --from base, and their keys hash that base's digest (image.Tool.Base, tools.Target.Base, from the base's record), so they're only ever another VM's on the same container image. Their records keep it (base). devvm tools add, tools update and update build a musl VM's base first, its digest looked up, so the keys they work out are those of the base the images build in. Every gnu key hashes devvm's own base, so no image built in a --from base under an earlier key is mounted again. Share.Build reads the record of the base it's about to clone and refuses any but the one the images are for (buildsFor, tools_wrong_base): base from Ubuntu's cloud image for gnu, a --from base with the target's digest for musl. Tests: TestBuildOnlyInItsBase (hostile --from gnu and musl bases, a layer, no record), TestUpFromTools, TestToolsAddFrom, TestToolFile's musl digest, TestToolFileRefuses, TestToolTarget's digest; from.txtar: the clone of devvm's own base, a base record that says it came from a container image refused (tools_wrong_base), and tools_need_own_base before devvm's own base is built; e2e from checks where the Debian and Alpine VMs' tool images built and the musl records' digest. Docs: internals/images.md (building tools, keys, the share, listing), using/from.md, using/images.md, using/space.md, internals/design.md, internals/security.md, contributing's e2e list, AGENTS.md's tool-key rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3649978bdb |
feat(build): base's features are devvm's own; your extras are layers
devvm reads base's features only from its own files (assets/features): ~/.config/devvm/features is no longer a folder devvm knows. An extra of your own for every new VM is a layer of yours (devvm layer new), chosen with devvm setup --layers, which each VM's list can uncheck. - build: Features returns devvm's features alone; featureStep gives each its prelude; FeatureScript, the shadowing check and its feature_shadowed warning are gone. A chosen name devvm has no script for is skipped with unknown_feature, as before. - paths: Dirs.Features is gone. - Tests: TestFeatures, TestOwnFeatures, TestPickFeatures, TestSetFeatures, TestBuildRunsFeatures and the key tests use devvm's features only and check that a script in ~/.config/devvm/features is neither a feature nor in any key; features.txtar likewise. - Docs: customizing's Extras of your own (a layer chosen in devvm setup), settings, install, space, overview, internals/images and the landing page drop the user features folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
cdac5e5012 | refactor(image): typed image names, read once at the CLI boundary | ||
|
|
9348a1e518 |
refactor(assets): one prelude for the build scripts' architecture, libc and pins
assets/prelude.sh gives each of devvm's scripts that a build runs with
bash $devvm_arch (arm64 or amd64), $devvm_libc (musl where apk is, else
gnu) and devvm_sha TOOL (the script's TOOL_sha256_<arch>_musl on musl
where it pins one, else TOOL_sha256_<arch>). It replaces the arch and sha
helpers in layers/base.sh, layers/nix.sh, features/cli-tools.sh,
shared-tools/build.sh and oci/build.sh, and the Alpine checks in
docker.sh, desktop.sh and fzf.sh. Each script that reads it checks it
came first (: "${devvm_arch:?}").
image.OwnScript reads devvm's own scripts with the prelude before them:
base.sh, apt.sh, built-in layers (LayerData) and features (featureStep),
shared-tools/build.sh (the tools build and ToolFile's key) and the
conversion's oci/build.sh (Lima's convertSteps, written into the
conversion's own temp folder). Users' layers and features get none.
keyHash.own goes, its one caller now hashing OwnScript's bytes.
Image keys change: every image and every shared tool image rebuilds.
Tests: testdata/script/prelude.txtar pins which pin devvm_sha picks from
each script on arm64 (aarch64 and arm64) and amd64, gnu and musl, and
refuses another architecture and a missing pin; oci.txtar sources the
prelude first and checks build.sh stops without it; TestOwnScript,
TestPreludeUsers (only scripts that get the prelude use it, each checks
its variables), key rows for the prelude in build and tool keys, and
recipe expectations with the prelude before devvm's scripts only.
e2e's nix copy as a user layer starts with the prelude.
Docs: internals/images.md (the scripts' prelude, keys), contributing
(owner, agreement test), maintaining, assets/oci/README.md, AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
b4628d7bd1 |
refactor(gc): drop gc --recent and the one-hour rule for tool images
Every tool image build (tools.Share.Build) runs for a devvm that holds the making lock shared from before it picks a VM's tools until the VM's state lists them, and holds the share's lock while it builds and moves images in. gc --tool-images takes the share's lock first, then tries the making lock alone, so it waits for a build in progress and keeps every current tool image no VM has while a VM is being made. The age rule added nothing, so gc --tool-images now deletes current tool images no VM lists however recently they were built. - tools: Share.NoVM keeps only the state and record checks; NoVMRecent and builtRecent go. - cli: gc loses --recent; gcPlan.making holds what it keeps while a VM is being made (showMaking). - msg: gc_tools_recent, gc_recent_needs_tools and gc_recent_making go. - tests: gc_tools.txtar checks a new tool image goes, and that gc waits for a tool build in progress and keeps every image while that VM is made (the limactl stub's shell-waits-on); gc.txtar checks gc's package cache cleanup (a stale set, its file, an unnamed file, an old .taken-* folder, a new one kept). - docs: using/images.md, using/space.md, internals/images.md, the cli skill's judgment.md and the gc reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
97672c4267 |
refactor(backend): base's size as Go constants, base's disk in Lima's origin
Base's size was read from assets/base.yaml four ways: vm.BaseDisk's
line scanner (a new VM's smallest disk), SizeChoice.Fitted's same scanner
for CPUs and memory (devvm size -g and setup's question), Lima's
buildSize regexes (base's build size), and limactl create reading disk:
from the template on its input. Now backend.BaseCPUs, BaseMemoryGiB and
BaseDiskGiB are the one source:
- vm checks new VMs' disks against backend.BaseDiskGiB, and Fitted fits
BaseCPUs and BaseMemoryGiB; SizeChoice has no Assets any more.
- Lima's buildSize uses the constants; its Origin carries base's disk as
a step of its own ("disk", its GiB), which originOf requires and
createArgs passes as --disk=, so base's key still hashes it, and the
--from conversion's VM gets it too.
- base.yaml sets no cpus, memory or disk, and is hashed only into Lima's
key as Lima's settings.
Tests: TestBuildImageBaseSize (pinned on the old code: base created with
4 CPUs, 8 GiB and a 100 GiB disk, now all flags and none in base.yaml),
TestBaseSize, TestOriginOfRefuses' no disk and bad disk; the limactl stub
reads create's --disk=. Docs: internals/images.md, internals/lima.md,
contributing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
1f2e4a0edc |
feat(tools): refuse a shared tool that needs a newer glibc than its --from base
Each shared tool is its project's prebuilt release, built against a glibc it needs at least, so a --from gnu base older than that ran the tool into a loader error. Now devvm measures both sides and refuses the tool clearly. - A tool image's build measures the newest GLIBC_ version its ELF programs and libraries need (shared-tools/build.sh's glibc_needs: readelf's version needs, testdata folders left out), writes it to FILE.glibc, and devvm keeps it in the image's record (glibc), taken only as a plain file holding one version (tool_bad_output). - A --from conversion records the image's glibc version (getconf GNU_LIBC_VERSION in a chroot; oci/build.sh's glibc output, checked by checkConverted), in base's record and every image's on it (backend.Built.Glibc, state.Image.Glibc). Ubuntu's own base has none and isn't checked; musl needs none. - tools.Target carries the base's glibc (not hashed: a gnu tool image is the same on every base); a VM's state records it (tools.made.glibc); Launch.buildTools checks every tool with tools.Share.Runs after building, for new VMs and devvm tools add/update and devvm update: tool_needs_glibc names the tool, its version and both glibc versions. - image.ValidGlibc and image.GlibcOlder own the version's shape and order. build.Env.ToolTarget reads base's record once (BaseLibc gone). - Measured minimums, current releases (arm64 / amd64): node 2.28/2.28, pnpm 2.18/2.18, bun 2.17/2.17, python 2.17/2.17, uv 2.28/2.17, rust 2.17/2.17, go none (its 2.34 came from Go's own testdata), claude 2.17/2.17, opencode 2.17/2.17, codex 2.28/2.28 (its voice helper). - Tests: TestGlibc, TestBuildGlibc, TestBuildGlibcRefused, TestRuns, TestGlibcNeeds (build.sh's function against debug/elf, where readelf is), TestToolTargetGlibc, checkConverted's glibc cases; from.txtar: an old base refuses node at launch and at devvm tools add, keeps go, and records 2.24; e2e: the Debian base's record and VM state hold the VM's real glibc, no tool image needs a newer one, and Ubuntu's tool images record a glibc; the stubs write FILE.glibc and glibc. - Docs: using/from.md (Shared tools and glibc), using/toolchains.md (Which bases they run on), internals/images.md, assets/oci/README.md. Every tool image's key changes once (build.sh), so each is built again. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
de28721978 |
fix(build): check base's recorded packages on the host against Ubuntu's signed archive lists
A first build of base gave back each package it downloaded with apt's
entry for it, and the host took the build VM's word that each entry was
apt's: anything with root in that VM before apt.sh end could record a
package with a made-up entry, which every later build of the key
replayed. Now the build also hands back the InRelease files and package
lists apt used, and the host checks them itself before it keeps
anything:
- each InRelease is clearsigned by Ubuntu's archive key, pinned in
assets/layers/ubuntu-archive.gpg ("Ubuntu Archive Automatic Signing
Key (2018)", F6ECB3762474EDA9D21B7022871920D1991BC93C, from
keyserver.ubuntu.com by fingerprint, checked against the Ubuntu
security team's list), and one of 26.04's suites;
- each package list has the SHA-256 and size a verified InRelease gives
one of its Packages lists;
- each recorded .deb's SHA-256 is in one of those lists, as the package,
version, architecture and size apt's entry says, and the set keeps
the archive's own entry.
- internal/ubuntu/pgp.go verifies clearsigned messages (RFC 4880's
cleartext signatures: text signatures, dash-escaping, trailing
whitespace, nothing before or after); archive.go's VerifyRelease and
Release.Lists read a verified InRelease (ArchiveKeyring).
- assets/layers/apt.sh: record copies apt's *_InRelease and *_Packages
lists to out/<n>.InRelease and out/<n>.Packages; base's build keeps
lists uncompressed (Acquire::GzipIndexes "false").
- internal/build: take accepts the lists (an InRelease at most 4 MiB and
all of them 32 MiB, a list 512 MiB with lines of 1 MiB and entries of
4 MiB, all lists 2 GiB, no name twice), signedEntries and
archiveEntry check them; cache carries devvm's own files for the key.
- Tests: Ubuntu's real resolute-updates InRelease verified, and refused
when changed, framed differently or signed by another key; clearsigned
parsing (dashes, CR LF, trailing whitespace, a binary signature
refused); InRelease fields; a recording refused for a forged
InRelease, a list no InRelease gives, a .deb no signed list has,
another package's entry, missing lists, a list or an InRelease twice,
a line over 1 MiB; a good set kept
with the archive's entry (gpg-made fixtures in
internal/build/testdata/archive); apt.sh's record giving back the
lists.
- Docs: images.md's Base's packages, design.md's trust note (the
recording VM's made-up packages closed), settings.md's mirror
section, maintaining.md's archive key.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
2933b535a9 |
feat(clone): devvm clone on|off switches a VM to or from its own clone
devvm clone [on|off] is a setting: bare (and --json) it shows whether the folder's VM has its own clone of the repo. on and off make the VM again through the shared remake, keeping its home folder and settings, after asking (--force, --no-export, --clean-home as devvm layer add). - on: a mounted VM is made again with nothing of the folder mounted; its branches are seeded as a new --clone VM's, and once the old machine is deleted, .git is checked as a launch does and unlocked. - off: the clone is checked as devvm rm does (unfetched branches offered for fetching into saved/<remote>/*, uncommitted changes asked about, terminal only; --no-clone-check skips it after a warning); the remote goes before the new machine's .git is locked, and is added back if the switch is undone. - The remake records its clone mode (remake.clone), so a remake that didn't finish finishes in it, and undo restores the old mode. - devvm --clone on a mounted VM and layer add/rm/update on a clone VM now name devvm clone on/off. rm's clone check messages name the command; --no-clone-check has one help text (addNoCloneCheckFlag). - teardown removes a clone's remote and .git's locks independently. Tests: TestSetCloneOn, TestSetCloneOff, TestSetCloneUndo, TestSetCloneRefuses, clone_switch.txtar, e2e clone section checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
389ac9f326 |
fix(vm): a VM without network policy gets only ~/.claude.json's settings, account state and MCP servers
Without network policy, the setup sent the host's whole ~/.claude.json: primaryApiKey and customApiKeyResponses reached the VM's own ~/.claude.json, and the projects' history its setup's staging folder, though sync.sh dropped it from the merge. agentlogin.ClaudeCopy keeps only claudeTopKeys (claudeTop, which the network policy copy uses too), with the MCP servers as they are, and the setup sends it (Store.ClaudeCopy) for every VM without network policy. A ~/.claude.json devvm can't read stops the setup (login_copy_failed) instead of reaching the VM unread. stage.has had no caller left. Tests: sync.txtar's ~/.claude.json with an API key, its answers and a project's history, none of which the copy holds (failing before), and one that doesn't parse; TestClaudeCopy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
aee099e52c |
fix(agentlogin): opencode OAuth logins devvm doesn't bind lose their tokens, and opencode's other files stay on the host
With network policy, an opencode OAuth login devvm doesn't bind (Copilot Enterprise, a provider it doesn't know) reached the VM with its refresh token, against network policy's promise that a VM never holds one, and opencode's config folder's files that aren't settings, such as a .env, were copied unredacted. The VM's copy of opencode's auth.json now has devvm-redacted for such a login's access and refresh tokens, and devvm warns (opencode_login_withheld); API keys for providers devvm doesn't know stay as they are, warned as before. File.VMCopy returns a VMFile (Data, Kept, Withheld). With network policy, the VM doesn't get opencode's files that are neither settings nor Markdown (withheld in sync.go), each named with config_not_copied; AGENTS.md and other Markdown still go. Tests: TestOpencodeUnboundOAuthWithheld (failing before), TestWithheld, TestVMCopies's opencode_login_withheld, sync.txtar's opencode .env and AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7dba353351 |
fix(agentlogin): Redact parses settings files whole and scrubs what ~/.claude.json's servers lose
A VM with network policy got secrets from the agents' settings files that Redact couldn't read or didn't look for: TOML lines it couldn't parse (multi-line arrays, quoted dotted keys, spaces around dots) were copied as they were, and JSON's string lists, URLs and env values under names that don't look secret were never scrubbed. Redact now parses each file whole (JSON with UseNumber, TOML with BurntSushi/toml), refuses one that doesn't parse, and writes the copy from what it parsed, through one walk for both formats: values under secret-looking keys, and lists and tables under them (but key bindings); every value of env and headers tables (env, environment, headers, http_headers, shell_environment_policy.set), but references, paths, URLs (scrubbed, or whole under a credential's name: credName) and true, false and numbers up to five digits; scrubURL for every URL; scrubArgs for every list; known key shapes anywhere. scrubArgs also scrubs URLs in arguments and in --flag=URL, for ~/.claude.json too. Claude Code's own settings env (settings.json's top-level env) keeps its documented configuration variables (claudeEnv: ANTHROPIC_MODEL and the model families, CLAUDE_CODE_*, DISABLE_*, MAX_*, *_TIMEOUT_MS), unless the name says it's a credential (credName: KEY, TOKEN as a word, SECRET, PASS, AUTH, CREDENTIAL, COOKIE, HEADER), so Claude in the VM keeps its model and limits. MCP servers' env and headers keep no value. Tests: TestRedactTOMLLeavesNothingUnread, TestRedactJSONArraysURLsAndEnv, TestRedactClaudeEnv (failing before), TestRedactTOML and TestRedactRefuses updated; sync.txtar's unreadable config.toml is now one that doesn't parse. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4a782085b9 |
test: raise the linux coverage baselines, and network.txtar's proxy follows a hostagent that lasts
- linux.txt raised from Fedora's mise run coverage (backend, lima, build, cli, docgen, gitprotect, image, netpolicy, paths, ports, project, proxy, secrets, settings, sshconfig, state, trust, vmssh). - network.txtar's first network-policy launch makes the test's runner its hostagent, so the proxy that follows it is still running when the ps check looks under load: the stub's hostagent is devvm itself, gone at once, and the proxy ended within a lifeline tick. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8d00c42e14 |
fix(netpolicy): a VM's CAs are readied under a lock and deleted once its policy is off, and the proxy refuses minting GitHub credentials in absolute form too
- trust.InitCA takes the caller's ctx and holds the CA folder's lock (paths.CA.Lock, vms/<hash>/run/ca/lock), so two launches of one VM at once never leave a key and a certificate of different runs (TestInitCATogether failed first, TestInitCACancelled, TestInitCAMismatched). - netpolicy.Proxy.Unconfined: a VM's first start without network policy stops its proxy and then deletes its CA folder, keys and all, under that lock; a proxy that won't stop keeps them (TestUnconfined, network.txtar). - The proxy's forwarder refuses GitHub calls that make a lasting credential for every HTTPS request, so absolute-form https:// requests get the 403 that intercepted tunnels got (TestForwarderRefusesMinting failed first); the minting paths also match /repositories/ID and /organizations/ID. Each forwarder's idle upstream connections close when its request or tunnel ends. - e2e: the build proxy check expects the run log's devvm:<key>@ and no proxy key in the log. - Docs: design.md's CA threat check, network.md, overview.md's locks, space.md, safety/network.md. Baselines raised (darwin). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
0941219a76 |
feat(build): base's packages recorded per key, replayed from a host cache
base's apt packages are no longer pinned by a snapshot. A key's first build of base records them: assets/layers/apt.sh (a recipe step, as root, before base.sh and after the last feature) points the image's sources at an apt mirror+file: list of config.toml's ubuntu-mirror and then Ubuntu's own archive, so apt checks everything against the archive key whichever server answers, and keeps what it downloads. At the end it gives back each package with apt's entry for it. devvm checks what comes back (regular files only, each named by its own SHA-256, each entry matching a file's size and SHA-256, nothing left over, at most 20,000 entries and 16 GiB), keeps the files in ~/.local/share/devvm/packages/<sha256>.deb and the key's set in packages/sets/<key>.json, before the image's record. Every later build of that key replays the set from the cache, checked on the host first, with apt given only those files: no network for base's packages, and a key's packages never change. A --from base keeps its image's own sources, unpinned. base keeps no package lists, so each layer's recipe starts with apt.sh lists, which fetches them when there are none. - backend.ImageSpec.Packages (Send before the steps, Take after) and backend.PackagesDir; Lima runs both over limactl shell as root. - Fail fast: apt.sh turns apt's retries off and exits 75 when no source answers, which Lima reports as build_sources_unreachable. - packages_missing refuses a replay whose cached file is gone or changed; packages_refused what a build gives back that isn't packages. - config.toml's ubuntu-mirror (settings.UbuntuMirror), checked as an http(s) address without a user, query or spaces (ubuntu_mirror_invalid). - devvm gc deletes the sets of keys neither current nor built, then, under the cache's lock, the files no set names at that moment, and builds' leftover folders over a day old (gc_packages, deleted_packages); devvm space lists the cache. - The snapshot is gone from base.sh, guest/sync.sh and desktop.sh, and scripts/bump.sh's apt step with it. - Tests: recording then replaying, a missing or changed cached file, every refusal of what comes back, gc's view of the cache and its race with a new set, the set record, the mirror setting, Lima's exchange and exit 75, apt.sh's mirrored and record functions, apt.sh in the keys; the limactl stub keeps what's sent and gives back $STUB_DIR/packages-out.tar. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e93f29333a |
feat(ubuntu): pin the newest signed cloud image at base's first build
devvm's files keep only Ubuntu's release (26.04) and its cloud image key. The first build of base on a machine pins the newest dated release whose SHA256SUMS carry a valid signature from that key and list an image for the host (state.UbuntuPin, images/ubuntu.json), and every later build uses the pin without looking anything up. devvm rebuild base pins the newest again. The pin is in base's recipe, so base's key hashes it. The signature is checked in Go (internal/ubuntu/pgp.go: OpenPGP v4 RSA signatures with SHA-256/384/512, the standard library's crypto), so no gpgv is needed and a host without one is no longer unchecked. - backend.Images gains PinOrigin (backend.Pin: PinFirst, PinNewest, PinOlder); internal/build pins before it keys a build, and says what it pinned (origin_pinned). - Lima: Origin and createFromUbuntu read the pin; PinOrigin finds the newest with ubuntu.Finder (Newest, Release) under images/locks/ubuntu; a --from conversion pins only when nothing is. - Messages: ubuntu_unreachable and no_ubuntu_release; ubuntu_unsigned and ubuntu_checksum_unpinned are gone. - e2e pins its own release (DEVVM_UBUNTU_RELEASE, a test override; scripts/bump.sh e2e-ubuntu moves it); bump.sh's apt moves the package snapshot alone. The gpgv stub is gone. - Tests: the verifier against Ubuntu's real signature and a test key (damaged keys and signatures, packet and subpacket lengths, armor), Newest/Release, PinOrigin, the pin record, and the key covering the pin. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e148ca33ca |
fix(clone): the --clone push and fetch's ssh always connects to the VM itself
devvm's ssh for a --clone VM's seed push and rm's fetch read devvm's ssh config, so a url.*.insteadOf, pushInsteadOf or remote URL in the repo's config could send them to another host; only the pinned host key (HostKeyAlias, BatchMode) stood in the way. Their GIT_SSH_COMMAND (gitSSHCommand) is now a shell function that ignores the host, port and options git passes, and runs ssh with vmssh.SSH's new CommandArgs: no ssh config (-F none), the VM's loopback port, user and key from vmssh.FromTarget, and the host keys pinned for its current start (vmssh.KnownHostsFor) under HostKeyAlias, with BatchMode and nothing forwarded. In the VM it runs only git-receive-pack or git-upload-pack, whichever git's last argument asks for, on the clone's own path; anything else fails without ssh. Links' linkSSH is now Env's ownSSH, which both use. Tests: TestUpCloneInsteadOf (failed on the previous code), TestGitSSHCommand, TestForwarderSSH's command args, clone.txtar's push past an insteadOf, and e2e's clone section (an insteadOf on the first push, and a git worktree's clone with only its branch and upstream). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4477a1285d |
fix(clone): --clone takes only a repo of the folder's own or a verified git worktree
A project folder whose .git pointed into another repo on the host (a gitdir file, a commondir, alternates) passed the --clone check, and the seed push copied that other repo's branches into the VM. gitprotect.OwnRepo now checks what git reads in the folder: a .git folder without a commondir, or a linked worktree's .git file whose link git made both ways (its gitdir is <repo>/.git/worktrees/<name>, that entry's gitdir file names this .git back, and its commondir leads to that <repo>/.git); no alternates, and no objects, packed-refs, reftable or refs that are symlinks, in the git dir or the common dir. cloneSource runs it before the VM is made and again before the push, and checks that git's rev-parse --absolute-git-dir and --git-common-dir agree. A worktree's push sends only its branch and that branch's upstream. gitprotect's commondir and gitdir resolution are shared (commonOf, resolvedDir) rather than copied. New messages: clone_git_elsewhere, clone_alternates. Tests: TestCheckCloneRepoPointers (failed on the previous code), TestSeedRefs, TestUpCloneWorktree, TestOwnRepo, and clone.txtar's refusals. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
866b9e0930 |
fix: the processes devvm starts don't inherit the files it was given
A terminal, an editor or a test harness can give devvm files past the standard three without close-on-exec (testscript's ttyin puts a pty on descriptor 3), and devvm's background processes then held them, keeping that terminal or pipe open as long as they ran: on Linux a script hung until its timeout. devvm now marks every file it was given from descriptor 3 up close-on-exec as it starts (platform.CloseInheritedOnExec, called first in main), which covers every process it starts, Lima's included, and keeps them open itself. TestCloseInheritedOnExec re-runs the test binary with an extra file on descriptor 3, starts a detached process and checks it doesn't hold it (/proc/<pid>/fd on Linux, lsof on macOS); layer_add.txtar now answers yes in a terminal. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c12fadd036 |
fix(ui): the run log keeps URL passwords out of commands' output
Lima's hostagent logs a proxy variable's value, password and all, when it replaces a loopback proxy's address with the guest's gateway, overrides the system's or lima.yaml's value, or can't parse it (Lima's pkg/cidata setupEnv), and limactl start passes those lines on to its stderr. For a VM without network policy, Start gives limactl the shell's proxy variables, so a password in the shell's HTTPS_PROXY could land in devvm's run log. LoggedCmd's output now goes to the run log through a redacting writer: whole lines (ended by \n or \r, or 64 KiB), each redacted, so a password split across writes is still found, the rest written once the command ends. redact, which the command's + line already took, also replaces the password of any URL's user info with <password>, besides the proxy keys' <key>. limactl.go's comment says when Lima logs the values. - ui: urlPassword, redacting, redactLineMax. - Tests: TestURLPasswordsStayOutOfTheLog (a Lima-like line, the URL in the command's environment, never its arguments), TestRedactingWriter; network.txtar and e2e's network check expect Lima's password stand-in as devvm:<password>@ in the run log. - Docs: troubleshooting's run log, network policy's Without network policy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ed70aeae3b |
feat(netpolicy): config.toml's company proxy reaches devvm's own downloads and builds' checks, and VMs without policy warn
config.toml's [proxy] covers the places it missed: - devvm's own requests on this machine (the download of its mise, Ubuntu's cloud image listing, --from's registries) go through it when the environment sets no proxy. settings.CompanyProxy.Route is their transport's proxy: at the first request it looks up the proxy secret, puts it in each URL that names a user, and routes each request as a VM's proxy does (proxy.Upstream.WithPassword, proxy.Upstream.Route, reusing the proxy's NO_PROXY matching). A missing password fails the request with fetch.ErrProxy, which isn't retried; HostMise shows its message. - The mise devvm runs on this machine gets HTTPS_PROXY, HTTP_PROXY and NO_PROXY in its environment (settings.CompanyProxy.Env), with the password in the URL, as mise takes it nowhere else; never in its arguments or a file. With the environment's proxy it adds nothing. - devvm build, rebuild, the remakes' builds and tool builds check the company proxy and its saved password before anything starts (build.Builds' checkProxy, tools.Share.Build), through the one check a new VM and a VM's proxy use: settings.CompanyProxy.Upstream, which netpolicy.Proxy.Upstream now calls. secrets.Store.ProxyPassword owns the proxy_password_missing mapping. - A VM without network policy never gets config.toml's proxy, as the guest would need the password, which never leaves this machine; each start of one while config.toml is the only proxy warns (proxy_needs_policy), naming devvm network on or the shell's HTTPS_PROXY, with a doc link. Wiring: tools.Env.Proxy (its Password set by cli and vm from devvm's secrets), from.NewLookup/NewRegistry/NewPublicRegistry take the proxy, lima.New and registry.New take a *settings.CompanyProxy for Ubuntu's listing. internal/fetch stays standard library only. - Tests: TestUpstreamWithPassword, TestUpstreamRoute, TestUpstreamRouteAuthorizes, TestCompanyProxy, TestCompanyProxyPasswordMissing, TestProxyPassword, TestHostMiseThroughCompanyProxy, TestMiseCmdCompanyProxy, TestBuildChecksCompanyProxy (tools and build), TestRegistryThroughProxy, TestUbuntuThroughCompanyProxy, TestTransient's ErrProxy, and company_proxy.txtar's build, rebuild and no-policy cases. - Docs: network policy's Behind a company proxy and Without network policy, config.toml's [proxy], How it works' Through a company proxy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
50b0db2f7e |
refactor(vmssh): one host-key record per VM per start, which every ssh of devvm's checks
vmssh owns a VM's host keys: PinHostKeys reads them from the running VM through its backend (at most 64 KiB within 30 s) once for each start, into one record in the VM's folder, vms/<hash>/run/known_hosts (paths.VM.KnownHosts), whose first line names the start it was read for (backend.Run.ID). A record of another start is read again, keys read while the VM started again aren't recorded, and ErrNoHostKeys says none can be pinned. KnownHostsFor returns the record for the current start without reading, for links' sessions; ForgetHostKeys removes it before each start. ParseHostKeys is the one parser, for every key type: a line is kept only when its key decodes, names its own type and has more after it, and certificates, markers, patterns and anything else are dropped. The ssh config's entries, the port forwarder (-known-hosts), links' sessions and a --clone VM's git all check the VM against that record. sshconfig's own parser, recordHostKeys, changeKnownHosts, HostKey and ForgetHostKeys go, with the shared known_hosts and its lock (Dirs.KnownHosts, Dirs.KnownHostsLock): a record per VM, each written whole, loses no other VM's keys. The forwarder's ports.known_hosts copy and Forwards.HostKey go, and teardown leaves the record to the VM's folder. paths.Dirs's method limit drops to 47. Tests: TestParseHostKeys, TestPinHostKeys, TestPinHostKeysNone, TestPinHostKeysTogether (vmssh); TestForwardsStart and TestForwardsRun use the record; TestWrite reads keys again after a start, TestWriteUnreadableRecord (sshconfig); TestLinkConn refuses a target without a record and never reads one; up_test's call lists. The limactl stub shows a wire-format ed25519 key per VM. testscripts ssh (a launch keeps the record, a restart reads it again), up, existing, host_code, clone and layout updated; e2e's project and link checks read the VM's record. Docs: internals/security.md, design.md, overview.md, ports.md, lima.md, backends.md, git-protection.md, using/ssh.md and space.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2304f26bf0 |
feat(netpolicy): config.toml sets the company proxy, and a start warns when its proxy loses one
config.toml's [proxy] table (https, http, no-proxy) is the company proxy that VMs' proxies and builds go through when devvm's environment sets neither HTTPS_PROXY nor HTTP_PROXY; the environment's settings win whole, never mixed with config.toml's. Each value is checked as config.toml is read (backend.CheckProxyURL, backend.CheckNoProxy), and a URL holding a password is refused (proxy_password_in_config): config.toml is copied between machines and kept with dotfiles. The password is the host-only secret proxy (devvm secret set proxy, in the Keychain or devvm's secrets folder). A URL that names a user gets upstream.secret in the proxy's config, and the proxy looks the value up through IO.Secret as it starts (upstreamPassword), so no file of devvm's holds it. No VM is ever bound to it: devvm secret use refuses (secret_host_only) and secrets.Names drops it. A new VM and a VM's proxy refuse to start while it isn't saved (proxy_password_missing, netpolicy.Proxy.Upstream). A start whose VM's proxy last ran with an upstream and now has none warns (upstream_proxy_gone), naming config.toml, with a doc link. - settings.HostProxy: the environment's, else config.toml's; used by netpolicy, Lima's build proxy (buildUpstream) and devvm doctor's CA hint. - proxy.Upstream.Secret, proxy.UpstreamSecret; secrets.Secret.HostOnly; secrets.Token keeps spaces inside the proxy password. - Messages: proxy_password_in_config, proxy_password_missing, upstream_proxy_gone, secret_host_only, proxy_password_howto, password_prompt (answered by --stdin). - Tests: TestHostProxy, TestUpstreamSecret, TestPrepareUpstreamConfig, TestBuildUpstreamConfig, config.toml refusals, the warning in TestPrepareUpstream, company_proxy.txtar, secret.txtar and ca.txtar cases. - Docs: troubleshooting's Behind a company proxy, network policy's Behind a company proxy and secrets, config.toml's reference, How it works. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
a75f4daa28 |
feat(update): devvm update moves the VM to newer shared tools, then remakes it only when its image is outdated
devvm update first takes devvm tools update's step (Tools.update, split out of Tools.Update), which needs no remake because shared tools are mounted. Then, only when the VM's image chain changed, it names what changed (vm_changed) and asks to make the VM again through the shared remake (canRemake, agreed and remakeNow, split out of remakeTo). Only newer tools: recorded and a shell, with no question. Nothing newer: vm_current. A no keeps the VM with its newer tools and opens a shell when there were some. Without a terminal or --force, an outdated VM is refused before the tools change. devvm tools update stays the tools-only command, and newer_tools names devvm update. devvm layer add and devvm layer rm move to the root help's Change your VM group, listed by both names, while layer and layer new stay under Images: commandGroups takes a subcommand's path, addGroups adds the group to its parent too, and the usage template lists it in the root's group. Tests: TestUpdateTools (tools only, both without a terminal, declined, agreed, neither), update.txtar's tools-only, no-terminal and declined cases, TestHelpGroupsAndDocs's groups for layer add, layer rm and layer --help, and an e2e check that devvm update on a current image never makes the VM again. TestRemakeDone still proves a failed delete of the old machine keeps the remake recorded. Docs: commands, images' Outdated VMs, toolchains, troubleshooting, coding agents, internals and contributing; the cli skill's tree; the CLI reference regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
cb9ee36f0a |
test: drop usage-error and e2e checks that other tests already cover
Generic usage errors (an argument too many or missing, an unknown flag) left 14 CLI scripts: TestUsageErrorsEveryCommand checks every command for them, TestShowCommandsTakeJSON for which commands take no --json, and root.txtar keeps one through the binary. e2e drops five checks that exercise no VM: retention's settings (retention.txtar), a second gc (gc.txtar), ls and size --json (TestJSONShapes, beside e2e's text checks), devvm code with a stub (host_code.txtar) and a CA file that isn't a certificate (ca.txtar, trust's TestRead). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1640feb608 |
feat(netpolicy): one CA per VM, with a successor the VM trusts ahead of time
Each VM with network policy has CAs of its own in its run folder, vms/<hash>/run/ca/ (paths.VM.CA, paths.CA: ca.pem/ca.key, next.pem/ next.key; folder 700, keys 600, kept out of Time Machine on macOS), so a leaked key reaches one VM and no proxy can sign for another VM. The shared ~/.local/share/devvm/ca (Dirs.CA) is gone. trust.InitCA(paths.CA) readies the current CA and the next one at each launch: the current one stays while it has over a week left, then the next one (started) takes its place, else a new one; the next one starts a week and an hour before the current one ends and is made again when it doesn't follow it. Each CA lasts 30 days and an hour, and its common name holds its serial, so a VM's two CAs never share a subject. The proxy's config gains ca_next, ca_next_key and ca_next_sha256 (part of Sum); the proxy signs with the next CA from an hour after its start (ca.signer), so the switch needs no launch or new proxy, and a VM not opened again stays verifiable for at least 30 days less an hour after its last launch. /ca.pem serves both certificates. loadCA reads the CA files with readPrivate (no links, a key only the user may read, 64 KiB cap) instead of tls.LoadX509KeyPair. The VM's setup sends both certificates (devvm-proxy.crt, devvm-proxy-next.crt) and no key. Tests: TestInitCA, TestInitCASwitch, TestInitCAReplaced (trust); TestNextCASigns, TestLoadCA, config check rows (proxy); TestPrepare and TestPrepareRestartsTheProxy for the VM's CA files and both sums (netpolicy); TestVMFiles; network, sync and layout txtar; e2e network: a second network-policy VM with different CAs, each VM trusting only its own and holding no key, each proxy serving and presenting only its own VM's CAs, devvm rm deleting one VM's CAs. Docs: internals/network.md (The VM's CA), design.md (A CA per VM, its threat check), safety/network.md, overview.md's per-VM files, space.md, security.md, attack-vectors.md, limits.md, coding-agents.md, contributing, internal/proxy/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
120ca70279 |
fix(vm): a VM whose folder is on a disk that isn't connected isn't gone
A folder with nothing at its path is now one of three folder states (vm.FolderOf): there, gone, or not connected. With nothing at the path, devvm compares the device of the nearest folder above it that exists (platform.DeviceOf) with the device in the recorded folder identity (platform.FolderDevice): the same device is gone, another is not connected (a folder moved to another disk and then deleted counts too), and no recorded identity or an unreadable device is gone. devvm ls writes (not connected) and --json gives folder_state (there, gone, not_connected) in place of folder_gone; devvm space names such VMs (space_folder_not_connected) and lists them as folder_not_connected. devvm rm VM refuses one without a terminal, even with --force (rm_vm_not_connected), and in one asks (delete_not_connected_folder_vm), which --force never answers. Tests: TestFolderOf (a fake device: same, other, none, unreadable, and a real deleted folder), TestDeviceOf, the JSON shapes, rm_vm.txtar's not-connected case, ls.txtar. Docs: commands (rm, ls, a folder on a disk that isn't connected), space, troubleshooting, overview. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4b9086e0cc |
feat(layer): devvm layer rm makes the folder's VM again without some of its layers, keeping its home and settings
devvm layer rm LAYER... [--force|--no-export|--clean-home] is the shared remake with layers taken out: Lifecycle.RemoveLayers works out the image (removedImage: the VM's other layers in their order, base when none is left), says the layers the VM lacks (lacks_layers) and refuses a name that isn't a layer, then remakeTo. AddLayers and RemoveLayers share remakeLayers, so neither copies the remake. Its Args refuse base, a shared tool's name and a name no layer can have (vm.CheckLayerNames), so one of the user's layers whose script is gone can still be taken out. devvm tools rm of a layer (custom_layer_remove) names devvm layer rm, and parts_flags_ignored and pick_vm_help name it beside devvm layer add. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4ad9c2c3d |
feat(vm): devvm update makes an outdated VM again from its image's new build, keeping its home and settings
devvm update [--force|--no-export|--clean-home] (internal/cli/update.go) is the shared remake with the VM's own image name: Lifecycle.Update calls toRemake, decides with build.Builds.Outdated (WarnIfOutdated's check, now its owner) whether the chain's keys changed, says vm_current and does nothing when they didn't, else names what changed (vm_changed) and calls remakeTo. --from VMs are judged on the recorded digest and built with build's lookup. The remake's flags are one adder (addRemakeFlags) for devvm layer add and devvm update. vm_outdated names devvm update. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]>
|
||
|
|
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]> |
||
|
|
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]>
|
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |