mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
84
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b5c58d82b8 |
fix(tools): a platform's missing download (a 404) steps the tool back, not failing the resolve
mise 2026.11 (devvm's host mise since 0.2.0-rc.1) downloads some files as it locks them and fails the whole `mise lock`, writing nothing, when one is a 404. So while Node 24.23.0 had no musl builds on unofficial-builds, Versions.Resolve returned tools_resolve_failed: a first run stopped, and the daily check and devvm tools update kept their versions. The step back only handled a lock that succeeded with an entry lacking a download. - lockAll: after a full lock whose own log shows a 404, lock each tool on its own, and a tool that still fails one platform at a time, so its entry lacks only the missing platform and stepBack steps it back. Any other failure in the fallback is resolveFailed's. - lockTool: one lock, its log started again, missing only on its own 404. - olderWithDownload/lockVersions: when the step back's lock of its older versions 404s, lock them one at a time. - logSays: shared by resolveFailed. - Stub mise: MISE_STUB_FAIL=404 and MISE_STUB_OFFLINE_TOOL; per-tool, per-platform merging checked against real mise 2026.11.14. - Tests: TestRefreshStepsBackPastA404, TestMise404. Checked against real mise 2026.11.14: node steps back to 24.22.3, the other 12 tools at their newest. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1946707e19 |
fix(tools): mise's downloads try six times, on the host and in tool builds
Through a proxy that cut and stalled connections (measured on the mini, a two-minute stall), mise's three retries of bun's download each timed out after 30 s, as mise tried again on the connection that had stalled, and the tool build failed. shared-tools/build.sh and the host's mise (miseCmd) now set MISE_HTTP_RETRIES=6, which outlasts such a stall; each try still ends after 30 s without bytes (mise's http_timeout). Every tool image's key changes (shared-tools/build.sh). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
dd46dd7a0f |
feat(tools): tool images build side by side
A first run built its tool images one after another, each paying a build VM's boot (5.7 s on vz, 9.3 s on QEMU) before a download of a few seconds to a minute. Share.Build now hands the images out to up to four slots (buildAll), each slot's builds one after another in a build VM of its own: - slots: as many as the host's memory, less what the backend's running VMs have, and its CPUs give a build VM of 2 GiB and 2 CPUs each after keeping 6 GiB and 2 CPUs, at most backend.MaxToolSlots (4) and the number of images; one alone keeps base's size. A backend that can't list its VMs builds one at a time. A running VM's memory counts whole (7.5 GiB, not 7): TestBuildSlotsFit's running VMs fail when it isn't counted or is truncated. - plan lowers the slots until the backend's disks have room: Floors.ForTools counts Tools once for each build VM at once, as on a disk without copy on write each is a whole copy of base. - backend.ToolsSpec gets Slot, Slots, Size and Hold; Lima's slot VMs are the constants ToolsVM to ToolsVM4, sized with --cpus/--memory, and the first slot's build deletes what a killed run left in the slots this run doesn't use. Builds hold the share's lock, so one devvm uses the slots. - A failed build's VM goes in the run's cleanup, which runs after the build let go of the share's lock: it deletes the VM only once it has the lock again (ToolsSpec.Hold, Env.holdShare's TryLockFile), and leaves it while another devvm holds it (a build, gc or the daily refresh) (TestBuildToolsCleanupHolds, TestBuildHoldsShareForCleanup). The next tools build deletes what it finds in the slots, and so does devvm gc, which holds the share's lock: backend.Images' DeleteToolsLeft, Lima's deleting the slots' build VMs that are there and no other VM, which gc asks of every backend first, without asking, a backend that can't being a run log line. It returns what it deleted, which gc names in one line (tools_build_vms_deleted), and gc then never says nothing_to_clean or nothing_deleted (gc_tools_build.txtar, TestDeleteToolsLeft in lima and vm, the fake's ToolsLeft). The cli skill's judgment.md names this exception to "gc --force deletes exactly what gc lists". The conformance suite's delete-tools-left checks that it deletes no other VM, not even the project VM of a folder named tools (devvm-tools-<hash>), and no image (TestConformanceFinds: deletesAllVMs, deletesImage, deletesByPrefix). The share's lock is the data folder's, so devvms with their own data folders and one Lima home don't exclude each other's builds: the docs say not to build tools or run gc in two at once (a lock per build VM in the Lima home would close it, but it would replace Hold and needs e2e). - Side by side, one status line covers the builds (building_tools_together), and their commands' lines in the run log are tagged with their tool (msg.WithLogTag): the UI's LoggedCmd prefixes them and shows no status line of its own. Every write starts with the tag, as does every line in it, one ended by "\r" included, so no build can pass a line off as another's (TestTaggedWrites), and a tool's lines are found after another's "\r" (taggedLines splits there, a progress bar's updates staying one line: TestTaggedLines). The first failure cancels the others and is what Build returns, tagged (backend.LoggedIn), so ErrorLogged shows that tool's lines' end. - A test build's DEVVM_TOOL_SLOTS caps the slots; the CLI tests set 1, so the stub's calls keep their order, and tools_side_by_side.txtar sets 3, with an interrupt that leaves no build VM. The stub keeps each build VM's folder by its name, and the fake backend's BuildTools runs its builds outside its lock, as a real backend's would, passing ToolsBuild its context. Docs: images.md's Building tools and Free space, ports-size.md, space.md, images.md (using) and gc's help (the build VMs gc deletes), settings.md (one Lima home for two data folders), extending.md, testing.md and tests.md; the cli skill's judgment.md; the CHANGELOG's first highlight and the release page's A faster first run. New messages: building_tools_together, tools_build_vms_deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3c7fbad7a3 |
feat(tools): mise downloaded as its .tar.gz, on the host and in base
mise's raw binary is 147 to 192 MB, its .tar.gz 51 to 63 MB. Both of a first run's mise downloads now take the archive: - the host's mise (internal/tools): the .tar.gz checked against its pinned SHA-256 by fetch.Download as before, into a folder of its own, then hashed again through the descriptor that mise/bin/mise is taken out of with archive/tar and compress/gzip, capped at miseCap. One devvm downloads it at a time (Dirs.MiseDownloadLock, cache/mise/download.lock, mise_waiting), and another takes what it kept. Under the lock, a .download-* folder a killed run left is taken away first (TestHostMise). A failure says its cause (mise_download_failed's Because) in the run log too. - base's mise (layers/base.sh): devvm-fetch's .tar.gz, unpacked with tar in a folder of mktemp's, which every base has (gzip is Essential on Debian and Ubuntu, BusyBox has it): .tar.xz would need xz, which --from images may lack. The pins are the archives' SHA-256s from the release's SHASUMS256.txt, and scripts/bump.sh reads the .tar.gz lines. TestMisePins still checks that base.sh's Linux pins are the host's. Docs: images.md's Versions and overview.md's locks; the release page's A faster first run; the CHANGELOG's Highlights, a first run that downloads less with the cloud image's two lines, now highlights too. Base's key changes (base.sh). Tool images' keys don't: they hash base's mise version, not its checksum. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
a8f0517579 |
feat(lima): devvm downloads Ubuntu's cloud image itself
Lima's download of the cloud image neither retries nor times out: one cut in its 900 MB fails base's build, and a stall hangs it. devvm now downloads the pinned image itself through fetch.Resumable (ubuntu.Download), into images/ubuntu/<sha256>.img (Dirs.UbuntuImage), resuming across cuts, stalls and runs, and gives Lima that file. Lima 2.3 checks a local file against the digest before it copies it. - Before downloading, it takes the image from Lima's own download cache when that holds it with the pin's SHA-256: copied into a new file of devvm's own, mode 600, hashed as it's written, capped, stopped by the context, and kept only once it checks out. Lima's cache is never changed, and a base whose dated release Ubuntu may have removed still builds again. - One devvm downloads at a time (images/locks/ubuntu-image), another waiting under ubuntu_image_waiting and looking again under the lock (TestUbuntuImageAfterWait, which fails without that second look). - The download goes through the company proxy and trusts the user's CAs (Lima.Roots, from trust.Pool, which internal/cli passes through the registry), as do the Finder's lookups (TestNewTrustsRoots, and the registry's TestOverrides). An untrusted certificate is ubuntu_untrusted, naming the CAs' folder, one from a trusted CA that's for another host, out of date or not valid yet ubuntu_bad_certificate (check the clock and what answers for the host), and any other that fails to verify (a SHA-1 signature, a CA's name constraints, a key for clients alone) ubuntu_certificate_invalid, naming Go's reason, for the lookups (the listing, the checksums, their signature: TestLookupCertificates) and the download alike (TestLocalImageFailsFor), and a release Ubuntu removed (404, 410) ubuntu_release_gone, which names devvm rebuild base; none is retried. ubuntu_download_failed no longer starts with devvm. - fetch.Untrusted, fetch.BadCertificate (an x509.HostnameError, or a CertificateInvalidError that's Expired) and fetch.Unverified (any failure to verify, with its reason, so every error the other two name), beside fetch.Gone, are the one place that tells a certificate's failures apart: Transient asks Unverified, the lookups and the download ask all three, host mise asks Untrusted, and a forbidigo rule keeps x509's and tls's verification errors in internal/fetch (TestCertificateClasses, TestTransient, testdata/lint, the owners doc's row). - An https address, or a test build's file:// DEVVM_UBUNTU_URL, read from disk the same way; anything else is refused. The CLI tests' sandbox has a stand-in of this host's image in the store. - Base's record keeps the image's address, and the key is as it was: it hashes the pin (release, file, digest), not the location. - devvm gc --caches frees devvm's copies that no record names and that aren't pinned now, unchanged for an hour, a stopped .part and a killed import's .import included, and those of a kept image once its .img is there. A pin it can't read fails it. - Of Lima's cache, it frees only an entry that devvm's own state shows a build of devvm's left: a base record names its address, devvm has its own copy of the image, and the installed Lima's own templates (share/lima/templates beside limactl, Lima.Templates) don't name it. An entry no record names may be the user's own Lima's, so it stays, and none is freed when the templates can't be read, with a line in the run log naming the folder and why. A test build's DEVVM_LIMA_TEMPLATES stands in for the templates folder. - ubuntu.ParseImage reads a record's image as Image.String writes it, and ubuntu.IsSHA256 is the one check of a cloud image's SHA-256, in place of Lima's own regex. - devvm space shows the copies as a cloud images row, freed by gc --caches, kept as state, as a release Ubuntu removed can't be downloaded again. 0.1.0's frozen state runs the new commands (fixture_v010_cloud_image): devvm looks in Lima's cache under the SHA-256 of the address 0.1.0's base record keeps and never changes the entry, base builds from devvm's own copy, and gc --caches keeps that copy, frees Lima's entry the record names and devvm's own stale copies, and keeps an older entry no record names. Docs: images.md (the download, its failures, the import, gc's rules), space.md, backends/lima.md, settings.md (the lookups and the download trust your CAs), troubleshooting.md, overview.md, testing.md, tests.md, structure.md's internal/fetch row; the CHANGELOG's two Fixed lines, which later commits make highlights, What to do 5 and 6, and the release page's Ubuntu's cloud image in devvm's folder. New messages: downloading_ubuntu, importing_ubuntu, ubuntu_image_waiting, ubuntu_download_failed, ubuntu_release_gone, ubuntu_bad_certificate, ubuntu_certificate_invalid, ubuntu_image_checksum, ubuntu_untrusted. Lima.LocalImage is the seam, Lima.ImageClient the client. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
82f075c5bd |
build(deps): bump pins
scripts/bump.sh's safe bumps, patches and minors: - images: mise 2026.11.10 -> 2026.11.14 (base and the host's, with internal/tools/mise.go's checksums), nix 2.35.6 -> 2.36.0, Docker's buildx 0.39.0 -> 0.39.1 and model 1.2.9 -> 1.2.10 - e2e: the lock's pnpm 12.21.0 -> 12.23.0, bun 1.4.4 -> 1.4.5, codex 0.169.1 -> 0.171.0, opencode 2.3.2 -> 2.4.1, pi 1.5.2 -> 1.6.0; --from's node:24 by its new digest - dev-tools: nilaway to its newest commit's pseudo-version (0.0.0-20261124161746-91ad9bf5d8e6), goreleaser 2.20.3, vale 3.28.1, markdownlint-cli2 0.24.2, whose lock folder moves to .mise/locks/markdownlint-cli2/0.24.2/, zizmor 1.33.1, with mise.lock - ci: the workflows' mise 2026.11.14, jdx/mise-action v5.3.0, amannn/action-semantic-pull-request v6.1.4 The e2e lock keeps Claude Code at 2.1.327: 2.1.328 made its sign-in link much shorter, without the state parameter that the network section's login check reads to answer it, so with 2.1.330 that check and the refresh after it fail. devvm itself never reads the link. mise's and Nix's new checksums match upstream's SHASUMS256.txt and .sha256 files; buildx and model are apt packages from Docker's signed repository. Cursor's CLI stays on 2026.11.17-f532c45: 2026.11.22-e9042b2 is out, and it moves only when named. pflag stays held below 1.1.0 and Node on 24. The new nilaway no longer reports three of agentsave.go's bounds findings, so their lines leave testdata/nilaway-baseline.txt, which nilaway and nilaway:linux fail on while they're stale. The CHANGELOG's Unreleased has the pins line, and the 0.2.0 page a section for them. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
cb7177b32c |
feat(ui): waits for another devvm's lock show a status line; a project folder devvm can't read says so
Lock waits: - platform.LockFile and LockFileShared take a platform.Waiting, called once they find the lock held, never when it's free, whose end they call once the wait ends; LockFileWaiting, LockFileSharedWaiting and their delays (ShareNote, OCINote, WaitNote, groupsNote, makingNote) go. - msg.Waiting makes one from a Reporter's Status and a label; msg.WithStatus and msg.StatusOf carry the run's Status in its context for the two packages that take no Reporter, internal/state and internal/trust, which cli's execute sets; forbidigo keeps StatusOf to them, and AGENTS.md says so. - Every lock that waits shows its own label: vm_state_waiting (a VM's state, its deletion), claims_waiting, layout_waiting, git_lock_waiting, ca_waiting, packages_waiting, rebuilds_waiting, ubuntu_pin_waiting, custom_secrets_waiting, forwarder_waiting, agent_store_waiting, and the waits that printed a line after a delay, which now show theirs as a status line: share_waiting, oci_waiting, image_build_waiting, group_waiting, making_waiting. - An agent's login file's lock (agentlogin's lockLogin, a folder's flock that a VM's proxy holds while it refreshes the login) tries first without waiting and shows agentlogin.File's Waiting (agent_login_waiting) while it waits; secrets fills it from its Reporter, for SaveLogins, Claude Code's logins folder and every File. - The structure test's status-lines rule counts a LockFile or LockFileShared whose waiting is nil as slow work; the build port's record, a file just made that never waits, is listed in statusSites. - Without a terminal, or with -v, a status line draws nothing, so the waits that printed an info line after a delay no longer print it there; the CHANGELOG and the troubleshooting page say so. from.txtar's check that a free conversion lock printed no wait goes, as TestLockOCI checks it. The layout's migration runs under a status line (layout_migrating), only when there are migrations to run. Backend calls outside a launch: TestCommandStatusLines runs devvm ls, ports, size, network, tools, git-protect, history export, stop and rm on a running and a stopped VM and fails on a backend call with no status line showing, with a control that each makes one. A project folder devvm can't open and read (vm_folder_unreadable) was taken for another folder's VM (vm_other_folder, which offers rm and adopt, and adopt went on); the finder now keeps why (target.unread), and every command on the folder's VM, from the folder or a subfolder of it, names the folder and why; devvm rm VM run elsewhere goes by the VM's name as before. platform.UniqueFolderID had no caller but its test: FolderStat.Unique, from the open folder, replaced it; it goes, and its test checks StatFolder's Unique instead. Tests: TestLockFileWaiting (rewritten: called only when held, its end once got or given up, shared too), TestVMLockWaits, TestCheckLayoutWaits, TestCheckLayout (migrations under layout_migrating, nothing shown otherwise), TestLockGroups, TestLockShare, TestMaking, TestLockOCI and the build lock's test (status lines, not info lines), TestLockLogin, TestInitCACancelled (ca_waiting), the status-lines rule's lock cases, TestCommandStatusLines, TestUnreadableFolder (a subfolder of it too), TestStatFolderUnique. Docs: Contributing's CLI page (Status lines) and structure page, the cli and codebase-standards skills (the guards), AGENTS.md's Go conventions, internals/images.md and design.md (the waits), using/troubleshooting.md, using/vms.md (a folder devvm can't read); CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2b176c92b3 |
feat(ui): every slow step shows a status line, and messages and questions never land on it
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]> |
||
|
|
c9005ae4be |
build(deps): bump pins: mise 2026.11.10, Docker 29.10.0, Hugo 0.170.1 and e2e's pins
scripts/bump.sh's safe bumps (patches and minors; no majors or held pins): images (assets/): - mise 2026.11.8 -> 2026.11.10 (base's, and the host's resolving mise) - docker 29.9.3 -> 29.10.0, compose 5.7.1 -> 5.8.0 e2e: - claude 2.1.322 -> 2.1.326, codex 0.167.2 -> 0.169.1, opencode 2.2.7 -> 2.3.0 - pnpm 12.18.0 -> 12.21.0, uv 0.13.7 -> 0.13.9, rust 1.99.1 -> 1.100.0 - ubuntu:26.04 digest 065aa8626841 -> d66b366dac61 - Ubuntu's cloud image release-20261016 -> release-20261108 go: deadcode v0.52.0 -> v0.53.0 dev-tools: govulncheck 1.9.0 -> 1.10.0, vale 3.26.0 -> 3.27.0, hugo-extended 0.169.0 -> hugo 0.170.1 ci: jdx/mise-action v5.2.8 -> v5.2.10, the workflows' mise 2026.11.8 -> 2026.11.10 Hugo 0.170 has no extended edition (one binary, without LibSass, which the site doesn't use): mise.toml's hugo-extended becomes hugo, the docs workflow installs hugo, its release job installs the tag's own tools (an older tag names hugo-extended), and docs/hugo.yaml drops the deprecated hugoVersion.extended. The e2e runner deletes its sandbox's Ubuntu pin when it names a release other than e2eUbuntuRelease (not in a --newest-base run), as devvm keeps a pin it has: without it, moving e2eUbuntuRelease left a cached sandbox on the old release. pinned and ubuntuPin are e2e's one reader of the pin, and TestHarnessRepin covers repin. Image keys change: base and every image above it, the docker layer's included, and the shared tools' images build again. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
0b85f5f557 |
fix(size): a size that isn't a number is refused, never read as 0
Size.Backend dropped strconv's errors, so a VM's size in vm.json that isn't a number, such as "cpus": "four" after an edit by hand, read as 0, the image's, and the VM started with the image's size without a word. Backend now reads each part with the check that took it (settings.CPUCount, settings.GiB, which ParseCPUs and ParseGiB now use), and returns an error naming the key and value. storedSize turns a stored one into size_stored_invalid, naming the VM. Every start (bringUp, before anything runs), a restart's stop (stopToStart, so a running VM keeps running, as a refused proxy start leaves it), devvm size and a remake's check refuse with it; devvm size --KEY sets it again. ParseCPUs and ParseGiB also refuse a number too big for an int or a float64, which for --disk reached Lima as +Inf. Lima's originOf read base's disk with ParseFloat and dropped its error: "NaN", "Inf" and "1e400" passed its check of a size above 0. Only devvm's own Origin writes that step (gibString of BaseDiskGiB), so no user, VM or limactl output reaches it; it now reads it with settings.GiB and fails naming the value. Every other discarded strconv error outside tests goes too: - hostgit.Bool reads a boolean as git does (yes, on, whole numbers) and says when a value isn't one; GIT_CONFIG_NOSYSTEM, which strconv.ParseBool read as false for "yes", uses it, as does the clone's copy of a repo's config (gitBool, which had its own copy). - image.GlibcOlder checks both versions itself and reports ok, so one that isn't a version is never read as 0. - leaktest and state's lock order panic on a goroutine number runtime.Stack doesn't print today, rather than reading it as 0. - cli's test-build overrides fail on a number that isn't one (a test build's panic), the stub limactl refuses a size it can't read, and opencodeMajor's fallback to 0 is explicit. Tests: TestSizeBackend, TestStoredSizeInvalid (a stopped VM and a running one's restart), TestSizeNumbers, new TestParseSizes and TestOriginOfRefuses cases, TestParseUnknownFormat, TestBool, TestUserFilesOf's git booleans, TestGlibc's invalid versions; each fails with its fix reverted. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4d409589bb |
refactor(redact): every secret's value is a redact.Secret, revealed only where it's used
redact.Secret holds a value that lets whoever has it act as the user or
a VM, behind a pointer, so fmt's raw printing of an unexported field
shows only an address. String, GoString and Format print <redacted> for
every verb; MarshalJSON, UnmarshalJSON and MarshalText return
redact.ErrEncode, so a secret is never silently written as a stand-in
(which would lose a login); there's no LogValue. NewSecret ("" is the
zero Secret), Reveal, Empty and TrimSpace are the rest. internal/redact
joins the proxy's standard-library-only depguard group.
Reveal is refused by forbidigo outside tests; each of the 23 call sites
carries a //nolint:forbidigo saying why, and testdata/lint/forbidigo.go
keeps a call the rule must report. The structure test (checkSecrets)
refuses a struct that embeds redact.Secret outside internal/redact and
an interface that declares Reveal() string.
Typed now: proxy.Config.Password (configFile is the wire type, in
Config's order, held to it by TestConfigFile), the server's password,
proxy.Lookup and the cached values, upstream.auth, upstreamPassword,
Upstream.WithPassword's password; backend.NewProxyPassword, ProxyURL,
Confinement.ProxyPassword, BuildProxy.Password; netpolicy.Key and
NetMade.ProxyKey (netMade wire type); settings.CompanyProxy.Password;
secrets.Store.Value, saved, ProxyPassword, Token, Save, save, Get,
SaveKey, Yours.Save, Claude.Env, saveToken, oauthToken; agentlogin
File.Get, SetKey, ClaudeToken, every format's get, setKey and chatGPT,
refresh's refresh token, capture's access, refresh and id tokens, and
the JWT helpers (a login's map stays the wire, through token and
setToken; piKey is piBound); vm.Net.SecretSave, AgentLoginOptions.Key;
ui.UI.Secret. Strings by design: platform.KeychainGet/Set and the
desktop's VNC password.
Tests: TestSecret (unexported and nested fields too), TestConfigFile,
TestV010ProxyConfigs (0.1.0's proxy.json round-trips byte for byte),
TestFixtureStoreGet saves the Linux secret file back byte for byte,
checkV010Logins (login files read, copied and bound without a change),
secretCases, and e2e netNoLeaks, twice in the network section: every
VM's proxy password and the section's values, also as Basic
credentials, in no run log or proxy log, and the passwords in no
ha.stderr.log or serial log. Docs: Contributing's Secrets in the code,
the owners table, the secrets How it works page, design.md's Where
secret values live.
Fixed, found by netNoLeaks: Lima's boot script 07-etc-environment.sh
runs under set -x, so the console logs (serial*.log) kept the VM's
proxy password; redactLog now stars passwords in them as it does in
ha.stderr.log (CHANGELOG, overview, processes and attack-vectors pages).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
b6954e1e11 |
refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
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]> |
||
|
|
aee6340ea9 |
chore(deps): bump assets' pinned downloads and devvm's host mise
scripts/bump.sh, every checksum from upstream's published sums: - mise (base, and devvm's host mise): 2026.11.3 -> 2026.11.8, from the release's SHASUMS256.txt - Docker's buildx: 0.38.1 -> 0.39.0 - Docker's compose: 5.7.0 -> 5.7.1 - nix: 2.35.5 -> 2.35.6, from releases.nixos.org's .sha256 files Up to date: docker 29.9.3, containerd 2.4.2, model 1.2.9, Docker's signing key, direnv 2.38.2, nix-direnv 3.2.0, git-lfs 3.8.1, rustup 1.29.3, crane 0.22.1, omb 94c2977eda06, eza 0.23.5, tealdeer 1.9.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d55476d3e2 |
feat(images): the prelude is one line, so build scripts keep their line numbers
Every script a build runs with bash, devvm's own and the user's layers, now gets the prelude as one line, eval $'…', in place of its #! line, so bash's errors and $LINENO give the script's own line numbers. A script without a #! line is one line further down. - shell.QuoteLine: ANSI-C quoting for bash, on one line of printable ASCII; every other byte as \xHH, so a multibyte locale's lead byte (Shift-JIS, GBK, GB18030, Big5) can't swallow the backslash escaping a quote, and a NUL panics as a caller's bug. image's layer rule allows internal/shell, a leaf. - image.WithPrelude, the one place the prelude and a script are joined (OwnScript calls it), used by base.sh, apt.sh, the built-in layers and features, the user's layers, shared-tools/build.sh and oci/build.sh. Every devvm script has a #! line. A leading UTF-8 BOM goes before the #! check. - A build's exports for a company proxy (lima's proxyExports) and the user's CAs (trust's exports) end in "; ", not a newline, so they share the first line and move no line either; backend.Trust.Env says so. - The stub logs a bash -s script's second line, which is the script's own second line with or without the prelude. - Keys: every build script's bytes change, so base, every image and every shared tool image are built again once; the CHANGELOG's After you upgrade says so with git-lfs, and what VMs say until devvm update, and Breaking has its own heading. - Tests: TestQuoteLine (every byte but NUL, a break-out word, in /bin/bash 3.2 and PATH's bash, in C and each of ja_JP.SJIS, zh_CN.GBK, zh_CN.GB18030 and zh_TW.Big5 that locale -a has), TestQuoteLineNUL, TestWithPrelude's shebang and BOM cases, TestWithPreludeRuns (the real prelude's line gives the prelude back; a layer under set -euo pipefail gets the names, keeps its function and its line numbers, with and without exports before it). - e2e nix: the layer copy no longer adds the prelude itself. - Docs: images.md's prelude section, Customizing's layer bullet, structure.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d349868c31 |
feat(agents): one definition per coding agent, and Cursor's CLI
Every list of the coding agents now derives from internal/agents' registry, one Def each, and Cursor's CLI (cursor-agent) is a fifth agent. The registry: - each agent's login command, login formats and capture on its Def; one message for every agent where each had its own - the agents' table, the README's list and the docs' history lists are generated from the registry (cli.DocBlocks, TestDocBlocks); scripts and Go tests take their lists from it too - each agent's own code lives in a file named for it; the structure test lets only an agent's own files choose by its name, following constants named after an agent - a VM remade by clone on/off keeps no agent's login files (agents.LoginFiles from every Def.Logins; Claude Code's .claude.json stays, as it is also history) Cursor's CLI: - `devvm --agents cursor`, `devvm agent login cursor`, history import and export of ~/.cursor/chats - the proxy captures its login at a GET endpoint, guards a shared host by path, and puts the login in only where the CLI sends it, bound to the CLI's 57 methods - account changes and the agent store are refused in a VM; Cursor's headers and trailers are scanned for tokens - e2e: Cursor's CLI in the network section, its poll behind the fake company proxy Docs: the agents' pages lead with commands, with a How it works page for the agents. Co-authored-by: JB <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6fd1d846d6 |
fix(lima): cache a Linux VM's project folder with 9p's none
Linux's 9p client loses data with Lima's default cache=mmap for a writable share: a stat() during an extending write() takes the host's stale size and writeback drops the data, so files reach the host empty or cut to 4096 bytes even after fsync (Claude Code's Edit sets it off); and on devvm's Ubuntu 26.04 guest kernel, a lock after a write makes the next read return zeros, which breaks SQLite in any journal mode and Gradle's daemon. macOS's vz VMs use virtiofs and aren't affected. - New VMs on a Linux host record cache mode none in a new mount section of vm.json, and their project folder is made and started with it, as is the folder devvm clone off mounts. VMs whose state has no mode (0.1.0's, and every VM made before this) keep Lima's mmap untouched, with no limactl edit, and each launch warns (mount_cache_unchosen) until devvm mount-cache none. - devvm mount-cache [none], with --json: none is the only mode devvm sets, so any other value is a usage error (mount_cache_invalid); a stopped VM gets it in its next start's one edit, a running one after the restart devvm offers. macOS refuses (backend_lacks), and so does a Linux VM whose folder isn't a 9p mount (mount_cache_no_choice). No -g or config.toml key: every new VM gets none. - The start that changes the mode mounts the folder again in the guest, as cloud-init rewrites fstab only after systemd has mounted it, through the logged runner with a minute's limit (output pipes closed a second after), then checks it with mountpoint and findmnt, reading 4 KiB at most and only the last line: a folder left unmounted stops the VM and fails the start before its shell (mount_cache_unmounted), and so does a check that gets no answer (mount_cache_unchecked); one still mounted with the old mode is warned of (mount_cache_remount_failed), any mode but none or mmap named unknown. An interrupt meanwhile, on any tier, leaves a cleanup that stops the VM, the one stop then. A launch into a running VM asks the guest, in words, whether its folder is a mount point, and refuses one that isn't (project_unmounted) or whose check fails or gives no answer (project_unchecked). A stored mmap, from a build before none alone, reads as none chosen, and devvm clone off records none for its new mount; any other mode is refused naming vm.json. - backend: FeatureMountCache (native on Linux, none on macOS, built on project-mount), Want.ProjectCache, Instance.ProjectCache, CacheModes. - lima: mount rewrites keep only the sshfs and 9p settings devvm knows where they differ from Lima's defaults, and drop the rest for Lima to fill in, so lima.yaml never freezes a default; same() compares the cache where devvm sets one. Build VMs' writable output folders (tools, --from) get none. - tools: an EROFS tool image that ends before its superblock does, or is shorter than its superblock says, as a build under mmap could leave one, counts as not built, so the next build makes it again; a build's short output is refused. The fakes' tool images are a page (backendtest.ToolImage). - The limactl stub lists QEMU's vmType, fills in 9p cache defaults on Linux, and answers the remount's check. - Docs: backends/lima (the project folder's cache, when it changes, programs that map files for writing, SQLite), using/limits, using/clone, commands, internals/lima, internals/backends, the design note (both mmap bugs, why none alone, the remount, tool images, the e2e findings), the CLI reference and the cli skill. - Tests: TestProjectCache, TestMountRoundTrip, TestStartSetsProjectCacheOnce (the remount's outcomes), TestCutShort, TestBuiltCutShort, TestGuestMountOptions, TestFilledMounts, TestUpCacheMode, TestWarnMountCache, TestCacheAtNextStart, TestSwitchCache, TestSetMountCache, TestCheckStateCache, the mount_cache CLI test, clone_switch and the 0.1.0 fixture on Linux, and e2e's projectMountCache (findmnt, a stat-while-write loop, SQLite's journals, a shared writable mmap refused, the opt-in switch of an unchosen VM, what mmap does reported, macOS unchanged). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f51e79421 |
refactor(agents): one definition per coding agent (#29)
Each coding agent gets one definition, an agents.Def in a new stdlib-only leaf package, internal/agents, and everything else iterates over agents.Defs: agentlogin's format per login kind, secrets' login kinds, settings' [pass-keys], image.SharedTools, the vm package's store tables and scripts, and cli's help lists. The VM copies of every login file, their bindings, the store's layout, the scripts and the CLI reference stay the same byte for byte, as golden tests made before the refactor show. The agents' guest variables leave base.sh for /etc/devvm/agents.sh, written at every launch, so every image rebuilds once. Messages are merged per agent (login_kept, login_passed, login_withheld, login_oauth_withheld, agent_login_key_only). The structure test's new names rule fails on an agent's name or login kind as a literal outside internal/agents, and literals on one holding an agent's folder. Docs link the supported coding agents rather than listing them, and Contributing gains Adding a coding agent. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
84f1190b04 |
feat(agents): pi, as a fourth coding agent (#23)
Adds pi (earendil-works/pi) as a shared coding agent beside Claude Code, Codex and opencode: --agents pi, devvm tools add pi, the new-VM picker and devvm setup offer it. Its network policy allows pi.dev; base sets PI_SKIP_VERSION_CHECK=1 and PI_TELEMETRY=0 and installs fd-find, so base and every image on it build again once. The agent store mounts and copies pi's settings, with keys redacted as JSON. pi's auth.json is a new login kind: its API keys for Anthropic, OpenAI and OpenRouter become per-VM placeholders the proxy fills in (devvm agent login pi --api-key --provider PROVIDER), and everything else is withheld by default, unless config.toml's [pass-keys] lists the provider. pi's own account logins aren't supported, and pi has no musl build, so a musl VM refuses it (image.ToolDef.GlibcOnly). Its sessions go into devvm history export and import. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8d8da01037 |
feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node, python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json` at its top level suggests it in the new VM's summary, the way `package.json` suggests node. Refs #2. Thanks to @jsskeen-utah for the detailed request. Co-authored-by: Claude Opus 5.5 <[email protected]> |
||
|
|
b3a188712f |
fix(tools): the host's mise trusts the system's and devvm's CAs (#9)
devvm's host mise didn't trust the CAs in ~/.config/devvm/ca, so behind a network that inspects TLS, resolving the shared tools' versions failed with UnknownIssuer and a message to check the connection. The host mise and its download now trust the folder's checked CAs: mise gets them as MISE_EXTRA_CA_CERTS, and on Linux also an SSL_CERT_FILE bundle of the system's roots plus those CAs (SSL_CERT_DIR only when the user set neither variable). On macOS, mise's Sigstore client still needs the CA trusted in the Keychain, as the docs say. A certificate failure now shows tools_untrusted, pointing at the CA docs. Refs #1 Co-authored-by: Claude Opus 5.5 <[email protected]> |
||
|
|
3c4e90da0c |
fix(tools): opencode's backend is named, so mise's registry can't move it to npm (#10)
## What this changes
**The cause.** The pin bump in
|
||
|
|
588ba6f9a1 |
build: bump docker 29.9.3, mise 2026.11.3, rustup 1.29.3, oh-my-bash, tealdeer 1.9.1 and the --from digests
docker 29.9.3, containerd 2.4.2, buildx 0.38.1, compose 5.7.0, model 1.2.9; mise 2026.11.3 (VMs and the host mise); rustup 1.29.3; oh-my-bash 94c2977; tealdeer 1.9.1; e2e's node:24 and alpine:3 digests. Every checksum is from upstream's published sums. bump.sh's value check now knows a Go constant's camelCase *Digest name, which it refused before. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b0b0c86890 |
fix(tools): a tool version counts as published only with its download's checksum
A lock entry's platform with a URL but no checksum counted as a download, and its tool image would have rested on TLS alone. It now counts as unpublished there, so devvm steps back to an older version or says none has a download. Every entry of the locks today has its checksum. TestHasDownload covers a lock without them. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8d44175601 |
refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2545de19f3 |
test(e2e): the Go runner is the entry point, mise run e2e -- FLAGS, and tests/e2e.sh goes
TestE2E already set up the sandbox, slots, locks and flags itself, so the 898-line script only handed over. The run is now `mise run e2e -- FLAGS` (go test -tags e2e from tests/e2e, CGO_ENABLED=0) with the same flags: --only, --from, --clean, --every-feature, --slots, --slot, --newest-base, --golden, plus --reuse. - options: the flags named as the script's options; the hand-over flags (lock-holder, count, total, started, summary) and the ported/unported split are gone. - e2eUbuntuRelease, a const in sandbox_test.go, holds the Ubuntu pin; scripts/bump.sh e2e-ubuntu moves it (get_const), and TestE2EUbuntuPins, bump.txtar and the E2E workflow read it there. - From the script into Go: the OpenSSL-not-LibreSSL host check, and --newest-base's start line and its UPSTREAM DRIFT summary. - The script's leftover bash helpers (perl vm_state, no_leak, ca_*, lima_listens, the retry list, its heartbeat) are gone with it. - mise's e2e:go task merges into e2e; TestCommandLines drops its $D rule. - Docs (contributing, testing, maintaining, internals) and AGENTS.md name mise run e2e; testing.md's "Porting a section" becomes "Adding a section". Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5f7289e6f7 |
feat(cli): devvm upgrade, the newest release the way devvm was installed
devvm upgrade [--check] [--to VERSION] [-f/--force] [--json] installs devvm's newest release the way this devvm was installed, asking first (upgrade_confirm, answered by --force). upgrade is a top-level exception in the cli skill: it acts on devvm itself, not this folder's VM, and it's the name other tools give the verb. It skips the layout check, as a layout a newer devvm wrote is a reason to run it. - install.sh's (<prefix>/lib/devvm/<version>/devvm, which <prefix>/bin/devvm links to): SHA256SUMS and its .minisig over HTTPS, the signature checked against the key built in from packaging/minisign.pub (packaging/key.go embeds the folder; no file, no key, and upgrade_no_key), the archive's SHA-256, unpacked into lib/.<v>.new.<pid>, run (--version), renamed to lib/<v>, the link switched atomically (symlink beside, rename over), run again through the link, rolled back on any failure; then older versions pruned as install.sh does (kept: the one that ran, any a running process names, another upgrade's staging folder). - Homebrew's (a Cellar/devvm/ keg): brew upgrade devvm, asked first, through the run log; --to refused. - Anything else: says how it was installed (a checkout build, go install, a copy elsewhere) and fails. - Already latest says so; a newest release older than this devvm is refused even with --force (rollback); --to installs a named one, older asked about (upgrade_confirm_older). --check and --json install nothing. minisign verification is Go's: ed25519 over blake2b.Sum512 for the default prehashed ED signature (legacy Ed refused), the key ID, the global signature over signature||trusted comment, and the trusted comment "devvm <version>" as scripts/release.sh writes it. Verified against a signature minisign 0.12 made. golang.org/x/crypto v0.58.0 added for blake2b only (approved; depguard allows only golang.org/x/crypto/blake2b); MVS raised x/text to v0.43.0 and x/tools to v0.51.0. mise run vuln: no vulnerability reached; the module-level GO-2026-5932 is x/crypto/openpgp, which devvm doesn't import. New: internal/upgrade (Detect, Source: Latest, Check for the release notice to call, Fetch; ParsePublicKey/Verify; Valid/Compare; Upgrader), internal/upgrade/upgradetest (TLS release server, minisign signer; tests only, a structure layer), fetch.Resolve (where a HEAD's redirects end), fetch.Download's size cap (mise's 256 MiB too). Test-build overrides: DEVVM_REPO_URL, DEVVM_RELEASE_KEY, DEVVM_RELEASE_CA, DEVVM_TEST_VERSION; script command release_server [-badsig]. Security review (security-audit skill, guidance mode, a fresh reviewer): - Prerelease order compared suffixes as text (rc.10 < rc.9), which let an older signed prerelease past the rollback refusal: fixed, semver precedence, with table cases. - No cap on the archive download (a host could fill TMPDIR before the checksum failed): fixed, fetch.Download takes a limit. - Two upgrades at once: prune removed another's staging folder: fixed, .<v>.new/old.<pid> folders are kept while that pid runs. - A failed rollback of the link was silent: fixed, upgrade_rollback_failed names the link and the old devvm, and the new folder stays so the link isn't left dangling. - QEMU's guestfwd names devvm with commas doubled, which the in-use check missed: fixed. - Freeze (a host serving the current version as newest forever): no boundary crossed, inherent without signed expiring metadata; documented in internals/install.md. Checked sound: nothing untrusted runs or unpacks before the signature and SHA-256; versions from the redirect and --to pass Valid before any URL or path; tar takes only regular files in its one folder (no links, subfolders, ..), 512 MiB cap, fixed modes; test overrides are read only by test builds. Tests: minisign (real minisign fixture, tampering, legacy, other key), each install kind against the fake TLS server, bad signature, wrong trusted comment, replaced archive (wrong SHA), bad archives, a new devvm that fails before and after the switch, a failed switch (old kept), a failed rollback, downgrade refused and --to, pruning, Homebrew via a brew script, Check, Latest's failures, Compare; CLI test upgrade.txtar. Docs: getting-started/install.md (Upgrading: how, what it checks, an older release, --json), getting-started/commands.md (This machine row, Upgrading devvm, questions, output for scripts), internals/install.md (devvm upgrade), contributing (release_server), the CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7bdaf8e99e |
refactor: one Reporter for every package's messages and prompts
msg.Reporter is what every package below cli prints and asks through: Info, Say, Note, Warn, Status, Ask, Confirm, Answer, the terminal checks and CanPick, the run log (LogNote, LogWriter, LoggedCmd, WithSteps), Stdout, Stderr, AddCleanup and Interrupted, under the UI's signatures. *ui.UI implements it (a compile-time check in ui), and msg.Fake is the tests': quiet as its zero value, its On funcs and fields record and answer. The six UI interfaces (tools, netpolicy, lima, registry, sshagent, vm) are gone, and the copied output and prompt func fields of tools.Env, tools.Making, gitprotect.Protector, secrets.Store, netpolicy.Proxy, from.Lookup, backend.Review, lima.Lima, sshagent.Agent, vm.Env, vm.SizeChoice, vm.AgentsChoice, vm.LayersChoice, vm.NetworkChoice, vmssh.Forwards, build.Env and sshconfig.Config: each embeds the Reporter. Lima's and the shared tools' Warn, which says where the run log is too, is a method of their own over it; vm's interactive check is a function over it. The pickers (build.Env.Pick, vm.Env's PickFeatures and PickParts, the choices' Pick) and vm.Env.CanAsk stay fields: they carry types of their own or cli's answer. The test UIs of tools, netpolicy, lima, registry, build and vm become msg.Fake. Coverage baselines raised: internal/backend/lima, internal/msg, internal/tools. 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]> |
||
|
|
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]> |
||
|
|
40d6f45296 |
fix: the phase review's findings in --clone, --from's output check and tool builds' CAs
- --clone refuses a symlink anywhere in objects or refs (a pack folder, a loose object's folder), not only at their top, which could copy another repo's objects into the VM. - A worktree's seed push sends its upstream only when it is one ref: a branch.<name>.merge pattern (refs/heads/*) pushed every branch. - The rm/clone off fetch passes --refmap=, so a remote the repo names after the clone's address can't update branches outside saved/devvm/*. - Undoing devvm clone off checks .git (gitprotect Check) before its locks come off, as leftBehind does: a clone VM's .git is never checked again. - --from's converted disk must have its first 1024 bytes zero before the ext4 superblock, so a qcow2 or VMDK header can't sit in front of one; the glibc file is checked a plain file before it is read (a link to a FIFO). - Tool builds get the CAs' variables from the backend (Trust.Env), as image builds' steps do; trust.CAs.Script, the caller-side copy, is gone. - image.isAgent unexported (used only in image). Tests: TestOwnRepo (pack folder, loose folder), TestSeedRefs (a pattern upstream), TestCloneRm (a remote named as the clone URL), TestSetCloneUndo (git_replaced on undo), TestCheckConverted (qcow2 before a superblock, a short disk, glibc a link to a FIFO), TestBuildToolsTrust. Docs: internals/git-protection, using/clone, internals/images, internals/design (the pin's name). Coverage baselines raised (darwin, linux). 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]> |
||
|
|
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]> |
||
|
|
cacbd90498 |
test(tools): the pins test, and tool image keys hash base's mise
base.sh's mise installs every shared tool mise installs, in a build VM made from base, yet a tool image's key didn't hash its version. Now it does: image.MiseVersion reads layers/base.sh's mise_version, and image.ToolFile hashes it for each tool mise installs (not rust, which rustup installs), so a mise bump builds those tool images again. - TestMisePins: base.sh's mise version and Linux checksums equal internal/tools/mise.go's (with the host pins' shape, which it held). - TestE2ELockPins: tests/e2e-mise.lock's first line is shared-tools/mise.toml's SHA-256, and it locks each of its tools with a download for every platform but rust's. - TestE2EUbuntuPins: e2e_ubuntu_release is one release-YYYYMMDD, exported as DEVVM_UBUNTU_RELEASE; bump.sh's e2e-ubuntu lists ubuntu.DefaultURL and moves it; every Ubuntu release tests/e2e.sh and bump.sh name is ubuntu.Series and ubuntu.Version. - TestToolFile: base.sh's mise pin changes a mise tool's key, not rust's, nor the rest of base.sh; TestMiseVersion its refusals. - Docs: internals/images.md and contributing/maintaining.md; AGENTS.md's key line. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ba073c8656 |
refactor(tools): read mise's lock as TOML, and key tool images on what it says
The tools lock was read line by line, as mise writes it, and a tool image's key hashed the tool's entries as written: a mise that wrote the same lock in another order, or with other spacing or quoting, rebuilt every tool image. Now tools.Lock is the lock parsed with BurntSushi/toml (ParseLock), and a tool image's key hashes the entry of the version it installs in a canonical form: its fields as JSON, keys sorted (Lock.Entry). - Lock.Has, Version, Backend, HasDownload and the step back's versionEntry read the parsed lock; a step back replaces the tool's entries and writes the lock again as TOML (withEntry); the lock mise wrote is kept byte for byte otherwise (Bytes). - A cached lock that isn't TOML is resolved again by Versions.Lock; ReadLock, which never resolves, names it as a state.CorruptError with its line. Lock.None is the zero Lock: no lock file yet. - Tests: TestEntryCanonical (reordered, respaced, requoted, commented: the same key; a changed checksum: another), TestLockNotTOML, TestWithEntry; the lock tests read the parsed lock. - Docs: internals/images.md says the key hashes what the entry says. Every tool image's key changes once, so each tool image is built again on its next use. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
74f41b0efb |
refactor(image): one shared-tool table
image.SharedTools, a table of image.ToolDef (name, kind, members, the files that call for it, its installer), is the one list of shared tools. image.Toolchains, image.Agents, GroupTools, IsTool, IsAgent and SortTools derive from it, and so do project.DetectFiles' toolchain markers (the nix layer's own files stay in project), the lock's rust case (image.NoDownload, for a tool rustup installs) and the devcontainer features devvm maps to a toolchain. Tests: TestSharedTools (the views, NoDownload, each member once), TestSharedToolsPolicies (shared-tools' policies are one per shared tool), and TestConfigTools now checks mise.toml's tools against the table's members. The contributing page names the table and what adding a shared tool takes. 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]> |
||
|
|
619570e445 |
refactor(backend): backend.Check, the specs' Validate and the registry's guard
backend.Check(ctx, b) returns the first of a backend's Problems, in place of Check in the Backend interface (Lima's and the fake's go). ImageSpec.Validate and ToolsSpec.Validate hold the build specs' checks Lima made itself: a layer from a container image, a network that isn't a build's, a key that isn't one, a tools format other than the backend's, folders that aren't absolute. ToolsSpec gets Name, what it builds, for the refusal's vm. The registry hands out each backend behind a guard: CreateVM, Start, BuildImage and BuildTools run the spec's Validate and the review's refusal for spec.Features() (VMSpec's, Want's and Confinement's, ImageSpec's, ToolsSpec's) before the backend sees them, without a second warning for an unreviewed emulation let through. Callers' own Require calls stay as the clear error path; the guard is the backstop. Want.Features is new; VMSpec.Features uses it and adds agent-toggle when the VM is made ready for it. backend.As finds a backend's other interfaces behind the guard (KeyFiles, Storage, Locator, Forgetter, UsageReporter, StrayFinder, CacheCleaner). Structure test: execSites lists the 17 files whose 24 exec.Command* calls stay, each with why (they make a command a runner runs, or one that streams, asks on the terminal, outlives the run or carries a secret); a host command made anywhere else fails, as does a listed file making none. guardOwner: a type assertion or type switch to a backend package's type outside guard.go fails (use backend.As). TestRulesFail cases for both. Tests: TestCheck, TestImageSpecValidate, TestToolsSpecValidate, TestGuardRefuses, TestGuardLetsThrough, TestAs; TestFeaturesNeeded gains Want's and agent-toggle; Lima's refuse cases for what Validate owns move to the backend package. Docs: internals/backends.md (the guard behind the first check); contributing's How a backend plugs in (Check, the guard, Validate, As), the structure test's execSites and guardOwner, and the owners table. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
ae0fd533fc |
refactor(msg): names mode is the UI's, read once with each stream's style
A msg.M always renders as its text: String, Error, Parts and Segments no
longer read DEVVM_MESSAGES, and Line is gone. internal/ui reads names mode
in newStyle, with each stream's color, and shows messages as names through
the style (message, segments, line, valueParts). ui.New takes the function
it reads the environment with, so tests make a names-mode UI without
t.Setenv. Messages shown as data go through UI.Text or Table.Text (doctor
--json, ls's image cell, setup's network choices); vm.PickRow.Desc is a
msg.M that cli renders. A config.toml value's refusal keeps its message
(state.CorruptError.Msg, Shown), so fail shows its names in names mode.
Tests: ui TestNamesMode; state TestFiles covers Msg and Shown; Go tests
compare NamesOf or Names, and drop t.Setenv("DEVVM_MESSAGES") outside ui,
msg's TestNames and the testscript runner. The structure test lists
DEVVM_MESSAGES in internal/ui/style.go only; ui.UI's method limit is 47
(Text).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
628dc11c94 |
feat(state): a layout version for devvm's folders, made_by in its records, the golden listing and doctor's leftovers in vms/
The data and config folders each hold a version file (state.Layout, 1). state.CheckLayout runs before every command but help, completion, version and devvm's hidden commands, under version.lock: the same version goes on, a missing file gets this devvm's, an older one runs the migrations in order (migrations(), empty now), and a newer one in either folder refuses with layout_newer; a file that isn't a version fails with layout_unchecked. made_by, devvm's version, is in vm.json's core fields (set when the VM is made, kept by later changes), image records and tool image records. It's passed from cli's devvmVersion through vm.NewEnv, tools.New and build.Env.Version. testdata/script/layout.txtar makes two network-policy VMs with a forwarded port, a link and a secret, and compares every path under the data and config folders with checked-in listings (macOS and Linux). devvm doctor warns about entries in vms/ that aren't VM folders (vms_stray) and VM folders without vm.json (vm_folder_stateless), changing nothing. Tests: TestMigrations, TestCheckLayout, TestCheckLayoutMigrationFails, TestVMFolderProblems, TestSkipsLayout; made_by checks in TestVMRoundTrip, TestImage, TestToolImage, TestUp, the build and tools tests and scripts; doctor's unit test and script. Docs: internals/overview (the layout version, made_by), using/space, using/settings, using/troubleshooting, internals/images, Contributing (changing the state layout). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f6f62d28a |
refactor(state): vm.json, typed state in package sections, changed under the VM's lock
A VM's state is vms/<hash>/vm.json: core fields (version, id, name, alias, image, chain, from, dir, folder, backend, backend_at, created) and one section per package, each a json.RawMessage its owner decodes into its own type (state.Section, state.SetSection), what was asked for at its top level and what devvm made under "made": net (netpolicy), git (gitprotect), ports (the new internal/ports), agent (sshagent), tools (tools), secrets (secrets), and size, clone, devcontainer, desktop and links (vm, internal/vm/state.go). - state.VM.Update takes vms/<hash>/lock (platform.LockFile), reads the file again, applies a change and writes it once; a failed change, or write, writes nothing. VM.Set and its calls are gone; read-modify-write of lists (links, publish, secrets, tools, size, ports) happens inside Update. VM.Claim also holds run/claims.lock, after the VM's own; VM.Create writes a new VM's whole record once, its alias chosen (sshconfig.ChooseAlias) under the claims lock. Reads take no lock. - created replaces "net unset" as unfinished (VM.Finished). - internal/ports: the ports section (forward, host.ssh/proxy/desktop), ports.Used (was netpolicy.UsedPorts), and one Allocator for ssh, proxy and desktop ports under the claims lock (desktop allocated without one before; run/ports.lock and netpolicy's own ports key are gone). - gitprotect: mode recorded before the backend makes the VM (NewMode; clone for --clone, which ls and git-protect share as gitprotect.Mode); made.git_id (platform.FolderID), one git_dirs list for modules and embedded git dirs, delegations, protected; Unlock takes the union of recorded and current git dirs. - links' entries, git dirs, tools and devcontainer commands are JSON lists, not strings in values; the key=value parser is gone. - vm.checkState reads every section of the folder's VM as it's found. - registry.For drops its unused Dirs. - Tests: TestVMRoundTrip, TestVMOtherName, TestVMID, TestVMUpdate, TestVMUpdateTogether (two writers on one VM and on crossed VMs), TestVMClaim, TestVMFailures, TestVMCorrupt, TestChooseAliasTogether, TestUsed, TestSSH, TestChooseTogether, TestUnlockRecorded, TestCheckState, TestChangesTogether, TestChangesAtOnce; testscript's vm_state, json_set with dotted and := keys; e2e's vm_state/vm_set. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4fd373439 |
refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend, Caps, Features, Review/Require, the registry, backendtest.Fake), so another backend is an addition. State from a smolvm VM reads as an unknown backend (backend_unknown_vm, gc_orphans_unknown); nothing migrates it. The image keys of layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images rebuild once. Lima's port forwarder moves off smolvm's files first: newForwarderCmd and forwarderMain from internal/cli/smolvmports.go to limaports.go, and assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder at run time, so no image key changes). Removed: - internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its registry entry, registry.Experimental and backend_experimental. - The decider: backend.Decider/UsesDecider, Confinement.Decider and DeciderToken, internal/proxy/decider.go and its test, the proxy's -decider, -decider-to and -decider-token-file, netpolicy's KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in vm's forwarding and UsedPorts. - backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and agent_unchosen_stop. - vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped). - paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing called (a test helper now). - ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and bump.sh's ubuntu_image, with its part of bump.txtar. - assets/smolvm/ and assets/container/; the no-init-system branches of layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in features/desktop.sh and guest/ca.sh. - Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh, creating_from_image, packing_image, pack_failed, backend_experimental, agent_unchosen_stop; descriptions naming smolvm reworded. - Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a failing or hanging Lima listing instead (the limactl stub's list-fails and list-hangs); the --backend smolvm examples; e2e's --backend smolvm and its section (about 1,130 lines), the smol_* helpers and the link section's backend switch. - Coverage: internal/backend/smolvm's lines in both baselines. - Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm notes (Ports on Lima now holds the forwarder's description), the backends table's smolvm column, every page naming smolvm, the README, the home page's backends art, and AGENTS.md's smolvm rows and gotchas (and the Docker bind-mount gotcha, which nothing refers to). Kept: the docker layer, on Lima; --from's local Docker; --backend, the BACKEND column and setup's backend choice, which the next commit removes. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d8a7d4de7f |
refactor(state): a folder per VM, keyed by its project folder's hash
Every file devvm keeps for a project VM is in one folder, vms/<hash>/, where <hash> is the 14-hex hash of the project folder's path that the VM's name ends with: its state, its own rules (policy), its backend's files (backend/: record.json, key, known_hosts, proxy, ports and the port forwarder's ports.*), what its runs leave (run/: proxy.*, sandbox.sb, started, lifeline.pid, secrets.*, links.*) and its logs (logs/: network.jsonl, proxy.log, links.log). Build VMs keep the same layout in run/builds/<name>/. The top-level run/ holds only what isn't one VM's or must be short: the hashed control sockets, links' link-<hash>.sock/.ctl, the QEMU wrapper and the ports lock. A folder's VM is found by its path's hash (state.ReadHash), with the name and backend its state records, so devvm --backend docker then devvm in the same folder opens the one VM, and a backend's name limit applies to new VMs only. The state records the VM's name and its ssh alias, chosen once at creation (sshconfig.ChooseAlias) and never recomputed. Links' targets match recorded names, aliases and folders (project.Targets). One teardown (vmFolders.teardown) replaces Lifecycle.forget, undoCreate's own list, Leftovers.Forget's, Proxy.Forget and space's leftoverFiles: it stops the proxy and link session, then the pieces outside the folder (clone remote or .git locks, other VMs' links and the group, host keys, the backend's leftovers), removes the folder, and writes the ssh config. Each backend's Delete and Forget remove the VM's backend/ folder (vmssh.Forwards.Forget). A new VM made where an earlier one's folder was left clears it first. devvm space counts an orphan's whole folder as leftover state and the other VMs' logs as network logs. Path builders move into paths: Dirs.VMDir, Dirs.VM and paths.VM's files (secrets' BindingsFile/PolicyFile, netpolicy's run, EventLog, ProxyLog, LinkList, VMPolicyFile, Lima's profileFile, startedFile, forwards.file, vmssh.Forwards.file, links' LinksLog/linksPID, Docker's vmFile and lifeline), ToolLockConfig, ToolLockChecked and ToolsCheckLog; the user's cache folder for Lima's and smolvm's caches is Dirs.UserCache, from HOME, not os.UserCacheDir. Dirs.VMState, LimaVMs, SmolvmVM and DockerVM go. vmname.HashOf and IsHash, project.Hash. The proxy takes the links' sockets' folder (-link-sockets, devvm's run folder) apart from the links' list, which is in the VM's run folder. Tests: a VM made and removed (rm, gc --orphans) leaves nothing under vms/, and with network policy has no file named for it outside its folder (TestTeardownLeavesNothing); a new VM over an old folder starts clean; lookup finds a VM made on another backend with a long folder name and makes no second one (TestLookupOtherBackend, and in docker.txtar); the alias stays put when a second VM shares the folder name (TestChooseAlias, ssh.txtar); every socket fits under a 35-character home with the longest VM name (TestSocketsFit); space counts an orphan's whole folder (TestLeftoverFolders); paths.VM's files; state by hash and name; the proxy refuses a socket in the list's own folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
299ddb1476 |
refactor(state): image records in images/<key>/, rebuild counters per backend and --from, tool image records, cache/
- Image records are images/<key>/record.json (JSON, unknown fields ignored; name, chain, from, digest, libc, built). state.Images lists the folders; AnyImage needs a record.json; RemoveImage deletes the folder. Lima's cache cleaner reads records through state.Images. - Rebuild counters are images/rebuilds.json, keyed by (backend, from as given, name), changed under images/locks/rebuilds. image.Inputs takes them through an image.Rebuilds interface. A rebuild on one backend no longer outdates the others' images, and two --from references that wrote the same counter name (node:24, node-24) stay apart. paths.RebuildFile, RebuildName and unsafeName are gone. - Tool images: <file>.sha256, .target and .idle become one <file>.json (sha256, libc, format, backend, built, idle_since; state.ToolImage). BACKEND and LIBC read the record; the fallbacks (format matching, a VM's target, the current target) go, with toolTargets, vmToolTargets, formatBackend and gc's backendTools (toolsOn does it). Share.IdleFor owns reading idle_since. - cache/ (Dirs.Cache) holds mise/, nix-cache/ and from-digests.json. With the cache gone, from.Recorded takes the newest base record's digest for the reference, so no key changes. - Key check: the rebuild counter is the one input that moved and changes keys (deliberately: per backend and exact from). The --from digest moved to cache/ and stays an input, kept stable by the records' fallback. Records, mise and the Nix cache are outputs. - Tests: state's image, rebuild, digest and tool record tests; image key cases per backend and exact from; build.TestRebuildIsPerBackend; from.TestRecordedWithoutTheCache; cli.TestToolsOn; rebuild.txtar (Docker's and smolvm's rebuilds keep Lima's and the other --from's bases), gc_caches.txtar and from.txtar (a missing cache/); the testscript command json_set; e2e reads the JSON records. - Docs: space, images, settings (retention), internals images, overview, network, security, contributing (json_set). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
da93384f60 |
fix(lint): fetch.Client is its own type, and forbidigo bans http.Transport, os.Create and O_TRUNC
fetch.Client was an alias of http.Client, so &fetch.Client{} got past
NewClient's timeout and HTTPSOnly. It is now a struct only NewClient fills:
Do sends with the client's policy, Transport returns its own transport for
callers to change (ubuntu's file://, the public registry's dialer), and any
other Client fails every request with ErrNoClient, which isn't transient.
forbidigo's HTTP rule also bans http.Transport, and http.Client's Transport
field, outside fetch, the proxy and tests.
The os.WriteFile rule also bans os.Create and os.O_TRUNC, so a
truncate-in-place write outside state needs a nolint saying why. The four
left are not files written whole from memory, or are the standard library
only: tools' check log and a link session's log (a process writes them as
it runs), fetch.Download's file (streamed, removed on failure) and
daemon's pid and status files (one write, which readLine and readStatus
take as missing until its line ends). state's doc says so.
Tests: TestClientMadeByNewClient (nil and zero Clients send nothing and
aren't retried; NewClient's transport is its own); from's and build's
tests use the registry's own client trusting the TLS test server.
Fixture lines: http.Transport, os.Create, os.O_TRUNC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
a134e0d8a6 |
feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's toolchains, coding agents and layers are checked in one picker, under three headings, before the network-policy question; --tools, --agents and --layers (each an exact list, or none) skip it, and a part left out takes its default: the detected toolchains, devvm setup's agents, no layers (a devcontainer.json's features still count). Without a terminal, or with --no-input, the VM gets the defaults and new_vm_gets says so in one line. devvm setup --agents (and its first-run question) chooses new VMs' agents. devvm tools in a terminal opens the same picker for the VM, its layers fixed, and turns the changes into tools add and rm. An image is base and layers only: tools are the VM's tool_names state key. build, rebuild and images rm refuse a shared tool (tool_not_layer), and devvm build builds no tool images. devvm ls gains a TOOLS column and --json tools. gc's --tools is --tool-images, so --tools has one meaning. Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or no_command_like, did-you-mean over commands, msg.Closest), the lacks path in internal/vm/existing.go, and the messages vm_lacks_tools, vm_lacks_layer, layer_is_command, layer_name_command, no_image_for, no_command_or_image*, tools_not_images, tools_not_images_rm, detected, vm_is_now (vm_tools_now), secret_with_image (secret_with_claude). New: ui.Pick takes headed sections with fixed rows, ui.CanPick, vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go), state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents, project.DetectFiles. Image keys are unchanged in form: images never held tools; docker.sh's and nix.sh's comments changed, so those layers rebuild. Docs: the home page's quick start steps, diagram (sandbox.svg), cards and FAQ; README; getting started; using (images' What a new VM gets, coding agents' Running an agent, settings' agents); internals; contributing; the cli skill; AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
497414fdda |
fix(tools): retry the pinned mise's download after failures that may pass
HostMise's download of devvm's pinned mise was a single request, so one dropped connection or a 5xx from GitHub's release host failed the tools lock's resolve. It now runs in fetch.Retry, tried again up to three times after fetch.Transient failures (no answer, 408, 429, 5xx), one second first and doubling; a 4xx, a refused redirect or a checksum mismatch fails at once. - Env.RetryDelay: the delay seam, time.Second from New. - TestHostMiseRetry: two server errors then the file, a 429, and 404 and 403 answered once. - internals/images.md says how the download is retried. Co-Authored-By: Claude Opus 5.5 <[email protected]> |