mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
151
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
00e5ea59f4 |
feat(cosign): the run, which makes and publishes each release CI hands over
devvm-cosign's run (Cosigner.Run), its command (cmd/devvm-cosign, Main) and the maintainer's commands, devvm-cosign retry, ack and failed. CI's token can only read the repo, so CI hands each build over as a workflow artifact, and only the co-signer, and the maintainer by hand, can make or publish a release. For each release CI handed over that it hasn't published, oldest first, from the newest successful run of the pinned release workflow for each tag, of this repo's own: - its version is newer than the newest it signed, or one it signed, with the same SHA256SUMS; an older one is an alert, as a replay, until the maintainer acks it, unless it was published before the state began; - CI's artifact is staged (stage/, which no build can reach) and checked: SHA256SUMS, CI's signature with CI's key and devvm-release <version>, and exactly the files it lists, each with its SHA-256; its files are deleted before the build and downloaded again after a match, so none of CI's bytes is on disk while a container could be live; - a run builds once, so the podman service, which lives for the run, lives for one build, and anything that escaped a container is gone before the next build's host git and release.sh run; the next release or base waits for the next run; - the build's finished files go in a folder of the state's src/, which release.sh copies to and the co-signer reads, where no container can swap a file or the folder; - the tag's commit has to be the commit CI's run built, and the co-signer's own build has to match every file and SHA256SUMS; it renders the tap's formulas itself from the tag's template and the signed SHA256SUMS (formula.go, as release.sh's formula function does), and the build's own formulas have to be the same bytes, so neither builder's container decides what Homebrew installs. The formulas and the notes, the tag's CHANGELOG.md entry, are kept in kept/<v>/ with their SHA-256s in the state, and checked again before the tap; - it signs, makes the draft itself, titled devvm <version> with the tag's notes, and uploads SHA256SUMS, both signatures and CI's files, each hashed as it's sent, keeping an asset only when its size and GitHub's digest are right and deleting any other; - while the bridge lasts it waits for the old key's signature on the draft, failing each run so the maintainer hears of it, and downloading nothing again while it waits; - it publishes only when the draft is exactly what it made, its tag, title and notes (but for line endings and the space at either end), and its assets by ID, size and digest, and the tag still names the tag object its rebuild checked; then checks the published release again, and finishes the tap. Alerts and refusals: - init records the highest release ID GitHub showed and the drafts there were then; IDs only go up, so any release published since that isn't a draft the co-signer made is an alert, whatever its tag or version, by <tag>#<ID>, so another release of an acked tag is alerted on again; each run also reads GitHub's latest release, wherever the list puts it. - A published release that differs from what it checked, its own draft published without it seeing the answer that then doesn't check out, and a tap formula newer than any release it signed, by tap:<formula>@<version>, are alerts; the tap is updated only for a release it published and checked after. - A rebuild that doesn't match is a refusal, which isn't downloaded or rebuilt again, even for CI's run again; devvm-cosign retry <tag> lets the next run rebuild it once more. Nothing retries on its own. - Every run fails (exit 1) while an alert or refusal waits, until devvm-cosign ack or retry. A run records in last-failure.txt that it started, then what failed, or removes it when it succeeds; devvm-cosign failed, which the units' OnFailure= runs for any failure, a killed or timed-out run's or a config that won't load included, runs notify, the maintainer's command, with it on its stdin, a fixed environment and a minute of its own, whatever ended the run's context. Bases go the same way, from the newest successful run of the base workflow on main, made at the index's commit and never GitHub's latest. Main makes the process non-dumpable (prctl PR_SET_DUMPABLE 0) before anything else, so no process of its user can read its memory, where the keys and token are, and reads the keys from systemd's credentials when CREDENTIALS_DIRECTORY is set. A run empties the build folder's work/ and the state's stage/ and src/ in place, never making them again. Tests, each fix reverted once to see it fail: TestPublishedBySomeoneElse (a release published by someone else, whatever its tag or version, the same tag again after an ack, a draft from before init published since, and GitHub's latest past where the list stops; one from before the state left alone), TestOneBuildPerRun (the build's files in the state, none of CI's on disk during the build, and the next release left for the next run), TestFormulas (a build's formula of its own; a kept formula changed on disk), TestRenderFormula, TestPrereleasePublished (a tap formula newer than any release signed), TestDraftChangedBeforePublish (a swapped file, a retag, other notes), TestTagMovedBeforePublish, TestAlertAfterPublish and TestLostPublishChecked, TestMismatchSignsNothing (a failure every run, and retry), TestReplayedOlderVersion (an alert, then acked), TestNotify, TestLegacyBridge (a failure every run, with no download), TestRunPagesReleases, TestInitPaged (init past ten pages of bases, which fails with a page check that stops at its first unfinished entry), TestRunsChecked, TestArtifactChecked, TestUploadChangedOnDisk, TestBaseIndexChecked (a re-signed base on a 61-day snapshot), TestBasePublishChecked, TestBasePublishedElsewhere (an expired base still counts in checkBehind), TestWorkEmptiedInPlace, TestCommandLine (retry and ack read no key file), and on Linux TestUndumpable. A build that fails, rather than differs, is built again at the next run, but the third failure in a row refuses it, with a report holding the last failure (buildFailed), so a build that keeps failing no longer takes every run's one build and holds up each newer release and base; retry builds it again, and a build stopped with its run isn't counted. Refusing rather than rotating past it keeps releases oldest first, as versions only go up, and keeps the failure in front of the maintainer through held and notify. buildRelease and buildBase are the build and its comparison, apart from what's recorded. And GitHub's latest release has to be the one init saw or one the co-signer published, not one of its own older than another it published: anything else is an alert, latest:<tag>#<ID> (staleLatest), as the install script's default downloads it; so is the one init saw, once it's older than one the co-signer published. The co-signer makes a release GitHub's latest only when it's newer than every release it published, so publishing an older release after a newer one, as when the old key signs the newer draft first, never moves the latest back itself. And a release's run counts only when a tag's push started it (PushEvent, which the structure test's nameFree lets name "push"). Tests, each failing before its code: TestFailingBuildRefused, TestBaseRefused's base that keeps failing, TestLatestChecked, TestOlderReleaseNotLatest, TestRunsChecked's run by hand. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1bd598c791 |
feat(cosign): ReleaseBuild, the co-signer's own build of a tag
ReleaseBuild rebuilds a release with the co-signer's own devvm: a new clone of its checkout at its pinned commit (checked clean), the tag and main fetched into it, the tag's SSH signature checked against the pinned signers (VerifyTag), the tag naming itself and its commit on main, then the clone's release.sh --tag with those signers as git's allowedSignersFile, so release.sh checks the tag again. Nothing of the tag's runs on the host. - The clone, its git config and allowed signers and release.sh's log go in Src, the state folder's src/, which no build's container can reach, as release.sh and git run from it on the host; only release.sh's TMPDIR, where its containers work, goes in Work, the build folder. A container that could write the clone could otherwise edit release.sh as bash reads it, or set gpg.ssh.program or a filter in its .git/config for git to run on the host. release.sh's download cache, which only it reads, on the host, goes in the state folder too, so nothing that escaped a container can plant a link for its next download. - Build returns Built: the checked tag, its tag object's ID, and the tag commit's Homebrew formula template (packaging/homebrew/devvm.rb) and CHANGELOG.md, read with git before release.sh runs, so no build's container can change them. The co-signer renders the tap's formulas and the release's notes from them and the signed SHA256SUMS. - The checkout is root's, so git reads it as the co-signer's user only with it named safe on its own command line: its worktree for git status, and its .git for a clone, whose upload-pack checks that path. A full run on Fedora under the units found the clone refused with the worktree alone; TestCheckoutNamedSafe holds both. - git runs with no system or global config, no hooks or fsmonitor, no replace objects, files and HTTPS alone, an environment of its own and its output capped. - The structure test's commandsFree is now keyed by the command, then the file, so build.go may run git and no other guarded command; its execSites and statusFree entries, and the owners table, say why. Tests: TestReleaseBuild (the template and changelog read, then a stub release.sh that deletes the clone's .git, as a build could, and says where it ran: its script in Src and its TMPDIR in Work, which fails with the clone in Work, reverted once to see it; the tag object), the existing refusals (an unpinned signer, off main, a dirty or moved checkout, a lightweight tag, a tag naming another, release.sh failing), TestCheckoutNamedSafe, and TestRulesFail's "another command in a file commandsFree lists for git", which fails with commandsFree keyed by file alone (reverted once to see it). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5ad326e13c |
feat(cosign): the co-signer's parsers of outside input, and their fuzz targets
The first of devvm-cosign's code, the parts that read what CI and GitHub
send, so they can be reviewed apart:
- sshsig.go: git's SSH tag signatures (OpenSSH's SSHSIG over the tag
object's payload, namespace git, Ed25519 alone), checked against the
tag signers the co-signer's own config pins (VerifyTag, ParseSigner,
AllowedSigners); the payload split at the last armor header, as git's
parse_signed_buffer does, and a tag naming itself and a commit.
- manifest.go: SHA256SUMS (ParseSums), base-index.json (ParseIndex),
each with its files and the trusted comment's subject, and release
versions as release.sh orders them.
- A base's index is refused when its Ubuntu snapshot is more than
maxAge old (the config's max_snapshot_days, 60 by default) or ahead
of now, whether or not it's rebuilt: the co-signer re-signs an
unchanged base with a new serial and expiry, so the expiry alone
can't keep users off an old base, and a stolen CI base key could
otherwise keep them on one snapshot for as long as it signs.
- The expiry is the last day the index is taken, in UTC, as the
field's comment says: refused from the start of the next day.
- Neither manifest may list a manifest's or a signature's name
(SHA256SUMS, base-index.json, *.minisig), so a listed file can never
stand in for the co-signer's signature.
- indexSubject reads an index's subject whatever its times, so a base
the co-signer signed counts in checkBehind however long ago it
expired.
- Fuzz targets: FuzzVerifyTag, FuzzParseSums, FuzzParseIndex.
- Guards: depguard's cosign rule (the standard library, BurntSushi/toml
and internal/minisign alone); the layers "only cmd/devvm-cosign runs
the co-signer" and "the co-signer imports only internal/minisign";
signatureFree's internal/cosign/sshsig.go, another project's format,
and the owners table regenerated.
Tests: TestParseIndex (a 60-day snapshot taken, 61 days, ahead, bad or
none refused; expiring today taken, yesterday refused), TestIndexSubject,
and the existing parsers' tables. Each fix was reverted once to see its
test fail: the snapshot bound (TestParseIndex, TestBaseIndexChecked) and
the expiry's day (TestParseIndex).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
51e4c795e4 |
refactor(structure): the layers in devvmLayers, a pure move
devvm()'s layer list moves, unchanged, into a function of its own, devvmLayers, so devvm() stays within revive's function length when the co-signer's two layers join it in a later commit. Nothing else changes: git diff -w shows only the move. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f3052e5a8e |
feat(upgrade): releases checked by two of three release keys, bridged from the old key
devvm upgrade and install.sh accept a release's SHA256SUMS when any two
of three release keys signed it (CI's, the co-signer's and an offline
recovery key's), each in SHA256SUMS.<role>.minisig, checked only against
its own role's key, with the trusted comment devvm-release <version>
compared exactly; one signer counts once. While releases bridge from it,
the old release key's single SHA256SUMS.minisig (devvm <version>) still
passes alone, so 0.1 and 0.2 keep upgrading and --to/--version can
install them; install.sh now checks that key's trusted comment too.
The keys themselves aren't made yet, so packaging/keys holds none and
install.sh's three key lines are empty: a devvm built so checks each
release with the old release key alone, and a release that only the
release keys signed is refused. Releases go out as before, signed with
the old key, until the keys are made and added, all three at once.
- internal/minisign: the one owner of signature checks (moved from
internal/upgrade): ParsePublicKey, PublicKey.Check (comment always
compared), Role (CI, Cosign, Recovery), Kind (Release, Base),
Kind.Comment, SigName, KeyFile, Keys/NewKeys/Keys.Check (two of three,
distinct keys and key IDs). minisigntest/ signs for tests. Stdlib and
blake2b only (depguard), a leaf; FuzzCheck, FuzzKeysCheck,
FuzzParsePublicKey.
- The structure test's signatures rule: outside internal/minisign no
code calls ed25519/rsa/ecdsa's Verify functions or imports blake2b,
but signatureFree's files (ubuntu/pgp.go, proxy/nixcache.go).
- internal/upgrade: Source.Keys, checkSums (signatures.go); the bridge
in legacy.go (checkLegacy, legacyKey, Source.Key); FuzzSumOf.
- packaging/keys/release-{ci,cosign,recovery}.pub, none yet;
packaging.Key ("" without one). TestReleaseKeys (checkReleaseKeys:
none, or three distinct minisign keys, none the old key),
TestCheckReleaseKeys (fixture keys from minisigntest),
TestInstallScriptKeys (checkInstallScriptKeys: one line per role,
empty without keys), TestReleaseRefusesPlaceholders (no key in keys/
marked PLACEHOLDER).
- scripts/release.sh (a tag, --check, --tag; never a snapshot) needs
none or all three of packaging/keys' release keys. With none,
install.sh's release_<role>_key lines are empty or missing; with all
three, each is a minisign key, distinct, not the old release key, not
marked PLACEHOLDER (placeholder), and equal to its install.sh line.
- install.sh checks with minisign -VHQm: prehashed signatures only.
- The structure guard also flags dot imports of the verifier packages
and calls of x509's CheckSignature* method names.
- install.sh: release_<role>_key lines, download_signatures (a role's
signature only when the script has its key), check_signature,
signed_by_two, check_legacy; plainer warning without minisign, with
the commands to check by hand.
- Tests: signatures_test.go (TestFetchWithoutReleaseKeys among them),
upgrade.txtar (-legacy, -keys, and the keys built in, none),
install.txtar (stub minisign with -Q; NO_KEYS), install_minisign.txtar
(real minisign), release.txtar (none, nolines, nokeyline, old, marked
and the rest); DEVVM_RELEASE_KEYS override.
- Docs: internals/install.md, using/upgrading.md, maintaining.md's
Release keys, structure, tests, testing, SECURITY.md, CHANGELOG,
releases/0.2.0.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
d001f7be0f |
build(release): every release builds to the same bytes on any machine
The signing design's first phase. The same tag, built by two builders, now gives byte-identical archives, source tarball, install.sh, SHA256SUMS and formulas. - scripts/release.sh builds every file but the signature in one container, release_image (Debian's buildpack-deps:trixie-scm, pinned by its index's digest), under podman or Docker (DEVVM_RELEASE_RUNTIME), on this machine's processor. The image and the code that runs in the build's container (_build) are the built commit's copies, so a tag builds the same from any checkout; a commit whose release.sh pins no release_image is refused. Everything outside the build's container is the checkout's: the tag's checks, the downloads, the modules' container, the checks on what the build wrote, and the signature. - The build has no network (--network none). The Go modules come first, in a container of their own, the only one with the network, which runs only the checkout's code: its release_image, its release.sh _modules and the Go its mise.lock pins, given only the commit's go.mod and go.sum, read-only, and downloading from proxy.golang.org alone (GOVCS=*:off, GOWORK=off). The checkout's Go rather than the commit's, so a commit can't pick an old Go with a known flaw for the step with the network, and rather than refusing a commit whose Go is older than the checkout's, which would refuse every old tag once mise.lock moves on, though rebuilding old tags is what --tag is for; go.sum pins the module files, so the bytes don't depend on which Go downloaded them. A commit whose go.mod needs a newer Go than the checkout's is refused before anything runs. Every module path the commit's go.mod names is looked up on Google's proxy and checksum database, which the docs say. The build reads the modules read-only as a GOPROXY's files (file:///mod). - Every container runs with --cap-drop ALL, --security-opt no-new-privileges, --pids-limit 8192, --memory 8g and --entrypoint bash, so a setuid file in the commit's image gives no privileges under a rootful runtime, root in it can't chown, a fork bomb or a runaway allocation stops at the container's limits, and the image's entrypoint never runs; Go and GoReleaser are unpacked with tar --no-same-owner. Both runtimes take both limits; rootless podman applies them on cgroups v2 with the pids and memory controllers delegated, as systemd does, and CI's runner needs the same. A full build peaked at 330 processes and 1.8 GiB under Docker Desktop on 10 CPUs. Neither runtime can bound a bind mount's disk use, so the docs say that a running build can fill the temp folder's disk until the time limit. - Each container is named for its run (devvm-release-<the temp folder's suffix>-<n>), so no other run's container, even one left over, has the name, and it's removed (rm -f, then its client ended, then rm -f again): after two hours (DEVVM_RELEASE_TIMEOUT seconds) by a watchdog, and as soon as release.sh stops early. The client runs in the background, so Ctrl+C (INT), a closed terminal (HUP) and kill (TERM) run release.sh's traps at once, which exit through the EXIT trap that removes the container; in the foreground, bash would wait for the client, and the client for the container's PID 1, bash, which ignores them. After kill -9, the watchdog, which outlives release.sh and ignores INT and HUP, removes the container and the temp folder. - Go and GoReleaser are the built commit's mise.lock downloads for linux-arm64 or linux-x64, kept in ~/.cache/devvm-release by SHA-256 and checked before each use, as is the modules' Go from the checkout's mise.lock. A URL has to start with https://dl.google.com/go/ or GoReleaser's releases/download/, can't hold .. or %, which curl decodes (so %2e%2e can't be ..), and goes to curl as --url's value (a lock URL of -K<file> was curl options, run on the host); file:// only from the folder that DEVVM_RELEASE_TEST_FILE_URLS names, which only the tests set, and only when it exists and isn't /. curl: HTTPS redirects only, 30 s to connect, 15 minutes, 1 GiB. A lock with two entries for a tool, or two downloads for the platform, is refused. - The build's repository is new (git init --template=), holding only the commit and, for a tag, the tag, fetched into a pack: no other branches, tags or objects of the maintainer's, no hardlinked files the container could write, and origin set to devvm's GitHub URL, which GoReleaser needs and nothing fetches. Go stamps the binary from the tags it finds, so it finds only the release's. - The container runs as root under a rootless runtime and as you under a rootful one, from the runtime's info (podman's Host.Security.Rootless, Docker's security options), never its name; a runtime that doesn't answer stops the build. Inside: umask 022, TZ=UTC, LC_ALL=C.UTF-8, GOTOOLCHAIN=local, -mod=readonly, no git config but safe.directory, and Go's caches in a container-local folder (Docker Desktop's share lost files that parallel module downloads renamed). - The build writes its files to /out, a mount of its own that it can't swap for a link. Before anything is copied, signed or kept, the folder has to be the one release.sh made, not a link, and everything in it a file or a folder, never a link, yours, and neither setuid, setgid, sticky nor world-writable, and 2 GiB at most, counted as read (sparse files whole) and read no further. The files are then copied to dist/, never moved, as yours with mode 0755 or 0644. minisign signs outside, after the containers are gone. - release.sh --commit COMMIT builds any commit as --head does, with its VERSION; release.sh --tag TAG builds a tag as its release, with its checks, unsigned, to compare with a published SHA256SUMS. An unsigned build never replaces a dist/ that holds SHA256SUMS.minisig, and a build signed with a test key never replaces one whose SHA256SUMS verifies with the checkout's packaging/minisign.pub, the release key. - .goreleaser.yaml: builds_info and every file's info set owner and group root, mode 0755/0644 and the commit's time. - scripts/repro-check.sh [COMMIT | TAG] builds twice with the checkout's release.sh, so no commit's code runs on the host directly. Build 2 fetches from a repository with a stray tag, v0.0.0-stray, at the commit, and runs under Docker where build 1 runs under podman when both are installed (root against your user); every platform archive's files have to be root's with mode 0755 or 0644 (tar -tv). A build that leaves no release fails, whatever its exit status. CI's repro job runs it under the runner's podman and Docker, with a 45-minute limit. The docs say that building a commit runs its code, in a container only as isolated as the runtime keeps it, so an outside commit is built only with the maintainer's go-ahead, and that rebuilding an old tag needs proxy.golang.org to still serve its modules. - scripts/bump.sh release-image moves the container's digest, the SHA-256 of the index it fetched, after checking the index lists linux/amd64 and linux/arm64; TestBumpCoversPins finds the pin. - Tests: release_head.txtar, publish.txtar and the new repro_check.txtar run the scripts through podman and docker stubs and a mise.lock of file:// tarballs. New cases: -K, http://, another host, .. and a percent-encoded .. in a lock URL refused before curl runs, file:// refused without the switch, with it set to 1, to a folder that doesn't exist, to / and from another folder, curl's bounds, two go entries, the build's repository's tags, refs, objects, hardlinks and origin, a stray tag kept out, the image and build code taken from the commit, a commit with no release_image, each runtime's user (rootless and rootful podman and Docker, podman behind docker, no answer), both containers' run lines (security options, limits, entrypoint, --network none, mounts), each container's name its run's (the stub checks it against the run's temp folder), the modules' container getting only go.mod, go.sum, Go and the checkout's release.sh, in the checkout's image, with the checkout's Go, a go.mod newer than the checkout's Go refused before any container, and the build reading its modules; refused output: a link in it, the output folder swapped for a link, a mode 4755, 2755 or 0666 file, a mode 1755 or 0777 folder, a sparse file a byte over 2 GiB (a file of another user's needs root to test, which the test says); a mode 0600 file copied as 0644; a build past DEVVM_RELEASE_TIMEOUT removed by name; release.sh sent INT, HUP and TERM mid-build, ending within 10 s through its trap, and kill -9, each leaving no container, process or temp folder; an unsigned --head and --tag refused over a signed dist/, and a test-key build over a release-key one; --commit never running the commit's host code, --tag's unsigned build matching the signed SHA256SUMS, and repro-check catching a build that records its user, archives that aren't root's, and a release.sh that builds nothing; bump.txtar covers the platform check. Each fails with its fix taken out, which was checked for every fix of the third review: the name, the limits, the test-key refusal, %, the folder's existence and /, the size cap, setgid, sticky, the signal traps, the EXIT trap's removal, the watchdog's removal after kill -9, the client in the background (in the foreground, INT took 60 s), the checkout's Go and the Go version check. Proof, with a throwaway commit whose _build probes its container and leaves a mode 4755 copy of bash and a mode 0666 file in /out, built by this release.sh under Docker Desktop on an arm64 Mac, and under rootful Docker and rootless podman on x86_64 Fedora: every build ran with CapEff and CapBnd 0, NoNewPrivs 1 and no network, couldn't write /mod or rename /out, and was refused before anything was kept; rootful Docker refused its chown to root. The same image under the old run line, on Fedora's rootful Docker: CapBnd a80425fb, NoNewPrivs 0, and proxy.golang.org reachable. Real builds of this commit, stopped 20 s into the build's container: under Docker Desktop, INT, TERM and HUP ended release.sh within 3 s (exit 130, 143, 129) with no container left at once, and kill -9 left the container running for the watchdog, which had removed it and the temp folder 5 s later. The same on Fedora under rootless podman (INT, kill -9, TERM, HUP) and rootful Docker (INT, kill -9). Afterwards no devvm-release container or temp folder was left on either machine. repro-check on this commit, a prerelease (no devvm.rb), agreed on all eight files on the Mac (Docker Desktop, both builds) and on Fedora (rootless podman as root, then rootful Docker as cj), and the two machines' printouts were the same. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
20f97b10eb |
feat(vm): a new VM's tools resolve while its image builds
A first run resolved the tools' versions, downloading devvm's own mise first, only after base had built: 10 s on the mini, 5 s on fedora, in series. Neither needs the other, so create now starts Versions.Lock in the background as an image starts to build (resolveWhile's start, which build.Env.Building calls once an image is found unbuilt and its features are chosen) and waits for it after, cancelling it when the build fails. When every image is built already, nothing starts in the background, and Files resolves in the foreground with its status lines as before. While the build runs, the resolve says nothing, as the build has the terminal: a held Reporter keeps its messages, shows no status line and refuses every question as without a terminal, and its commands' lines in the run log are tagged resolve. Once the build ends, done releases it: what it held is said, what it does from then on shows, and devvm waits under resolving_tools when it's still running. done returns its error, so a failure is said once and the launch doesn't resolve again. A VM whose lock is already there reads it at once. TestHeld, TestResolveShowsAfterBuild and TestBuildingCalled fail when held shows a status line, when the wait shows none, and when Building isn't called. Docs: images.md's Versions. 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]> |
||
|
|
326660d748 |
feat(fetch): resumable downloads that survive cuts and stalls
fetch.Resumable downloads a large file into <path>.part and keeps it
across failures and runs: each retry asks only for the rest (Range, with
If-Range once the server named a strong ETag or Last-Modified, and
Accept-Encoding: identity, so no gzip changes what a range counts), a
try that reads nothing for Stall ends and is tried again, and Tries
tries in a row that bring nothing fail it, as do 100 tries in all, with
the wait doubling up to a minute. The file is kept at its path only once
its SHA-256 checks out; a part that doesn't is fetched again from
nothing, once. A server that ignores the range (200), has nothing past
it (416) or answers it from another byte starts the part again.
- A part that's already the whole file, as a run killed before its
rename or a try that failed after its last byte leaves it, is kept
without another request, where a range past its end would get a 416
and start it again.
- A failure that trying again in this run won't mend (a 403, a proxy
that refuses) keeps the part for the next run; only 404 and 410
(fetch.Gone) and a file over Limit take it with them.
- A part that can't be written, or a whole file that can't be renamed
into place, is ErrWrite, never tried again, and the part's hash and
length count only what the file took, so a short write can't put them
out of step.
- Content-Range is read strictly (parseContentRange, fuzzed), and a
length over Limit fails as ErrTooLarge.
- The structure test's status-lines rule counts a
fetch.Resumable{…}.Download as a request; structure.md says so, and
its internal/fetch row names Resumable.
Tested in a synctest bubble on memnet against a server that cuts,
stalls, hangs, answers 403, 404 or 410, ignores the range or answers it
from byte 0, cuts after the last byte, behind a proxy that refuses, with
a part that can't be written, a whole part left by a killed run and a
file that can't be renamed into place (TestResumableWholePart,
TestResumableRenameFails).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
962c183117 |
fix(agents): imported opencode history brings no automations, approvals or resumed turns
An export of opencode's history held what opencode 2.4 acts on without asking, so a hostile VM's export could run commands in the VM that imports it (opencode v2.4.1's source): its automations (automation), each a trigger and a shell command that it approved once and never asks about again (core/src/automation/shell.ts); the requests you said always to allow (permission, which Permission.evaluate turns into allow rules); each session's own rules (session_v2.permission, a Permission.Ruleset); the subagents' jobs (job), the queued messages (session_inbox) and the suspended sessions (session_v2.time_suspended), which its service starts or resumes when it starts (core/src/session/execution/restart.ts), with the session's agent's own rules, explore's allowing shell; a project's commands (project.commands), whose start command it runs with bash -lc for each worktree (core/src/worktree.ts); and its git repositories in its data folder (snapshot, repos, worktree), whose config can name a clean filter or core.fsmonitor that its own git update-index runs (core/src/snapshot.ts, git.ts). opencodeClean now empties the tables opencodeUnattended picks (automation, permission, job, session_inbox, and any whose name starts so), sets the columns opencodeNulled picks to NULL (time_suspended, commands, in any case), keeps only the deny and ask rules with a text action of every permission column, each written again from what sqlite3 read, so a key written twice can't keep an allow effect for JSON.parse (opencodeAllowRules), drops every view, and fails its check on a generated column (opencodeHidden). Its check counts each and must print 0, so a sqlite3 without JSON leaves the database out. A view, an upper-case column, a generated column and a duplicate key bypassed the first version, as the security review showed. opencode's HistoryOwn now names its background service's registration on every channel and the files written beside it (service-*.json, service.json.*, service-*.json.*) and its git repositories (snapshot, repos, worktree): an export leaves them out and an import never writes them, while a VM made again keeps them. The import's clean-up loop expands each as a pattern; TestHistoryImportScript holds every skip to a path's plain characters. Tests that failed first (fedora's gate): TestOpencodeCleanSchema (automation and permission emptied, a session's allow rule gone), TestHistoryImportRuns and TestHistoryExportRuns (service-local.json, the handoff's and the registration's temporary files); TestOpencodeCleanSessionRules fails closed without the statements. The review's additions: TestOpencodeCleanSchema (job, session_inbox, a suspended session, a project's commands), TestOpencodeCleanSessionRules (a key written twice, a non-text action, an upper-case column), TestOpencodeCleanHidden (a view, a generated column), and the git folders in the export and import tests. The review's docs fixes across the stack land here too: the changelog's What to do steps, the release page, the coding agents page, How it works and the design note. A kept rule whose resource is missing or isn't text gets "*", as opencode's Permission.Rule needs one, and the check also counts a rule that isn't in the rebuilt form, so a copy whose rules weren't rebuilt fails closed. A stack-wide review's last docs fixes land here: devvm rm deletes opencode's worktrees with the VM, so the changelog has a What to do step to commit their work first. The export's and the import's scripts, which the stack doubled, now go on the VM's input (onInput): a line with the script's length, the script, then the import's export. In the command's arguments, quoted for ssh's shared connection, macOS's ssh failed to start the session (mm_send_fd: sendmsg: Message too long), which the mini's e2e hit, the export first and then the import. The VM reads exactly that many bytes (dd bs=1) and runs the script only when it read them all, so an input cut short runs nothing (TestOnInputCutShort), and the script gets the rest as its input. TestHistoryScriptsOnInput holds every argument under 4 KiB; TestHistoryExportRuns and the import's runs use onInput too. The stub guest takes such a script off its input (inputScript), matches its switches and files() against it and keeps an export's and an import's in history-export.sh and history-import.sh, which history, history_import, rm_vm, existing_agents and layer_add read. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
47593e21ab |
fix(proxy): NormHost keeps an address's trailing dot, its IPv6 zone's, and Public calls no zoned address the internet's
NormHost dropped one trailing dot from any host, so an IPv6 address whose zone is "." (::1%.) became ::1%, an empty zone, which netip reads as no address. The proxy refused both forms (HostOK), but a partial clone's promisor warning (privateHost) no longer saw ::1%. as private, as FuzzPromisorHostSite found. NormHost now leaves an address as it is, its dot included, so every judge reads such a host as the zoned address it is. Public now calls no address with a zone the internet's: netip's prefixes never contain a zoned address, so the ranges alone missed, for example, a zoned documentation address, which --from's registry check took as public. No VM could reach anything through such a host: every way in (CONNECT, absolute-form requests, a transparent connection's Host and its TLS server name) refused it with 400 before any lookup or connection, on every tier, the broker refuses a lookup of it and a connection to a zoned address, and no rule or NO_PROXY entry names one. Tests: TestZonedHostsRefused sends each zoned and empty-zone host through CONNECT, plain HTTP and the transparent path on the open, internet, allowlist, none and loopback-allowing tiers, checking each refusal is the proxy's own where net/http lets the request through, with a control on each path that [::1] itself reaches the dialer where allowed; it passed before the fix too, and fails when HostOK takes a zone. TestNormHost, TestBrokerLookup, TestBrokerDial, TestInternal and TestPublicAddr gain zoned cases; FuzzHostSites' splitSite and policySite list the new divergence (zoneDot), and FuzzPromisorHostSite lists a zoned address now counting as private; its crash input and the zoned-unspecified one ([::%[]:) are added. design.md's list of the host readers' differences names both. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
947decb301 |
fix(vm): VMs get the host terminal's COLORTERM (fixes #54)
limactl shell asks ssh to send COLORTERM (SendEnv), but its session rides Lima's shared ssh connection (ControlMaster), opened without it, and the master filters a session's environment by its own SendEnv, so the variable never reached the VM (lima-vm/lima#2208, #1481). Closing that connection would end every session and the VM's SSH agent relay, so devvm now sets COLORTERM in the command it runs in the VM instead: - backend.ShellOpts and ExecOpts get ColorTerm. Lima's Exec runs `cd D && export COLORTERM=<quoted> && exec argv`, and its Shell, with a ColorTerm, runs `sh -c 'export COLORTERM=<quoted> && exec "$SHELL" --login'`, as limactl shell does without a command; without one, the argv is as it was. colorTerm (lima) quotes the value with shell.Quote and links Lima #2208, so it can go once Lima sends it. - vm's colorTerm is the one allow-list: only truecolor and 24bit pass, anything else or none is "". target.shell (devvm's shell) and AgentLogin.loginOpts (an agent's login on a terminal) fill it from Env.Getenv; no other command in the VM gets it. - devvm's ssh config entries add `SendEnv COLORTERM`, so plain ssh by name (ControlMaster no) sends it: the e2e showed the base's sshd has AcceptEnv COLORTERM. It adds to a Host *'s SendEnv. Tests, each failing without the fix: TestExecAndShellColorTerm (lima), TestColorTerm (vm: the shell's and the login's value for allowed, near-miss and injection-shaped values), testdata/script/colorterm.txtar (the stub limactl's argv for the shell and an agent's login), ssh.txtar and sshconfig's pinned lines, and e2e: a fresh VM's first shell, a login shell on a terminal in the folder (24bit, and none for another value) and ssh devvm-web. The structure test's dynamicScripts lists both new built scripts. Docs: Managing VMs, ssh access by name, How it works' Lima (A shell's colors) and security (the ssh entries), and CHANGELOG Fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2de3e31a6c |
fix(vm): devvm ports shows a status line as it restarts a running VM's forwarder, and every lock's wait is tested for its label
Lock waits: - Tests record the label of each lock's wait that had none, the lock held as by another devvm and the wait ended by a cancel, a deadline failing one that shows nothing rather than hanging: git_lock_waiting (TestGitLockWaits; .git protection's Serial is gitSerial, so a test can reach it), packages_waiting and rebuilds_waiting (TestImageLocksWait), ubuntu_pin_waiting (TestPinOriginWaits), custom_secrets_waiting (TestYoursLockWaits) and forwarder_waiting (TestForwardsLockWaits). - A test build's locks panic on a nil platform.Waiting (platform.CheckWaiting, which the root's run calls in every test build beside state.CheckLockOrder), so the CLI tests and e2e catch a nil wait the structure test can't see, such as a zero agentlogin.File's; a msg.Waiting given a nil status shows nothing and stays review only. msg.Waiting with no status gives a wait that shows nothing, never nil; platform.NoWait is the Waiting of a lock that never waits (the build port's record, which passed nil), and the status-lines rule holds it to statusSites as it does nil (TestCheckWaiting, TestWaiting, the rule's NoWait case). - forbidigo refuses syscall.Flock and unix.Flock outside internal/platform, internal/proxy/rotate.go, the stubs and tests (testdata/lint, both). - TestLockFileWaiting runs in a synctest bubble and checks the wait shows while held, not before (its counters under a mutex, which the race detector needs, as only the file's lock orders them). Status lines: - TestCommandStatusLines runs the setters too: devvm ports LIST and ports add, size --cpus, network open, allowlist, transparent off and on, learn and allow, git-protect off and on, ssh-agent off. It found devvm ports on a running VM starting its forwarder again (ssh and a command in the VM) with no status line; that step now shows ports_restarting. The folder named twice: - vm_folder_unreadable's why was the open's error, the folder's path in it; folderUnreadable gives the system's reason alone when the error is about the folder itself (TestUnreadableFolder checks the whole message). - platform.OpenNoLinks and StatFolder return a link on the path as an fs.PathError about the folder too (ErrLinkOnPath still matches), so that case names it once as well (TestStatFolderUnique). Docs: Contributing's CLI page (status lines) and structure page, the codebase-standards guards; CHANGELOG (devvm ports' status line). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f80fd2df60 |
fix(vm): devvm agent save applies all or nothing under the login lock; a lock's wait and a walk end with their context; a link to the home folder counts unless only root can change it
All or nothing: - devvm agent save goes through devvm agent import's undo journal: each plan's files are written into a staging folder of the agent's store (saver.stage, newStage, the import's .devvm-import- name, swept by the next import or save), then put in place (applyPlan: each file renamed in, the one it replaces kept aside as a hard link, folders made, what a folder no longer has moved aside, seeds and kept entries left), and the .claude.json subset saved last with secrets.SaveLogins, which holds the login's lock. A failure after the first change puts every agent's store and the login back; an undo that fails too says so (agent_save_undo_failed) and keeps the staging folder. - applyStages (and stageSet) is what both commands apply through; importStage is now storeStage, pruneIn takes an fs.FS, and pruneFolder moves a folder's leftovers aside. pruneStore and applySettings go. - A file in the VM where the store has a folder, or the other way round, fails the save before anything changes (agent_save_store_folder, agent_save_store_file; sameKind), where the stage would have replaced it without the diff showing; storeFiles reads such a path as empty. Contexts: - platform.LockDir flocks a folder, polling until ctx ends as LockFile does (waitLock is their shared loop); agentlogin's lockLogin is it, so the lock is the one an older devvm's proxy takes. LockLogin, LockFolder, File.CaptureRequest, Capture, SetKey, Remove and secrets.Store.CaptureRequest take a ctx. A capture whose reply the endpoint has given is saved with agentlogin.AfterReply's context, the exchange's without its end and bounded by two minutes of its own, so the exchange's deadline never loses a rotated login while a refresh or a save holds the lock, and a stalled holder never holds it for ever (File.Capture, secrets.Store.Capture, its loginsDir included). - safefile.Walk takes a ctx and stops before each folder and batch once it ends; readSettings, followLinks and follower.copy pass theirs. - LockFolder's comment said its lock was another than a login file's in the same folder; it's the same (.claude.json's), and says so. Links while a state can't be read: - homeHops exempted every link on the way to the home folder, on the claim that no project folder can hold one, which --unsafe-folder breaks. rootOnly exempts a link only when every folder above it, up to /, is root's, has no group or other write bit and the system says you can't write it (platform.Writable, access(2), which counts ACLs and FUSE), and devvm doesn't run as root. The structure test lets internal/agentlogin import internal/platform and counts platform.LockDir in its status-lines rule. Tests that fail without their fix: TestAgentSaveApplyFailsWhole (a rename and the login failing), TestAgentSaveUndoFails, TestAgentSaveLoginLock (waits under agent_login_waiting; Ctrl-C leaves the stores as they were), TestAgentSaveKindChanged, TestAgentImportHomeBelowALink, TestCaptureOutlivesItsDeadline, TestClaudeCaptureOutlivesItsDeadline, TestWalkCancelled, TestLockLogin (synctest: a deadline and a cancel). New: TestLockDir (synctest, and a plain flock's lock), TestRootOnly, TestWritable, the status-lines rule's LockDir case. TestStoreOpsRefuseLinks checks openStoreDir in pruneStore's place. Docs: internals/agents.md (saving, the staging folder, links to the home folder), using/coding-agents.md, Contributing's CLI and structure pages; CHANGELOG. 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]> |
||
|
|
b04a1a9f12 |
fix(vm): agent import walks within its bounds, takes turns at the store, applies all or nothing, and refuses links while a state can't be read
The bounded walk: - fs.WalkDir read each folder whole before the import's entry bound applied, so a VM whose project folder is in an agent's folder could make the walk hold millions of entries. safefile.Walk walks as fs.WalkDir does (order, SkipDir, SkipAll, errors) but reads each folder 256 entries at a time, counting every entry it reads against a safefile.Bound, and stops with ErrTooMany before fn sees the folder; it also stops at a folder more than 128 deep or a path past 4,096 bytes, so a deep chain can't make the walk quadratic. - readSettings walks the agent's folder through the folder opened one folder at a time (h.safe), whose FS now opens folders to list them (rootFS.openDir: no follow, no blocking, the folder Lstat saw or ErrSwapped), so a link or a FIFO swapped in for a folder fails the walk. follower.copy walks each link's target the same way; the walks of all links read at most linkMaxWalked (80,000) entries in all, those left out for the bounds included. - The structure test's status-lines rule counts safefile.Walk as a walk. The store's lock: - paths.Dirs.AgentStoreLock (agents.lock in the data folder), held by lockStore, under a status line (agent_store_waiting) while it waits: devvm agent import from its staging to its logins, devvm agent save's writes, and a start's clean of a seed's folder (cleanSeeds, now with ctx), which takes it only once it finds something to take out and looks again under it. - devvm agent save plans again under the lock and saves nothing when the store changed since it showed the diff (agent_save_store_changed), rather than write over an import. All or nothing: - After staging, apply moves aside what it replaces or prunes into the staging folder's replaced folder (a file kept as a hard link, so it's still replaced in one rename), notes the folders it makes, and keeps each change's undo. The logins are saved all or none (secrets.SaveLogins, which reads each file it replaces first, puts them back on a failure, and holds each login's lock, agentlogin.LockLogin, as the proxy does while it refreshes one). - A failure after the first change undoes every agent's changes, going on past an undo that fails; each store it couldn't put back keeps its staging folder, named with it (agent_import_undo_failed). - An interrupted run's cleanup waits on the stage's mutex for an apply that started, and an apply after the cleanup took the staging folder out puts nothing in place. Links through states devvm can't read: - While any VM's state can't be read, the import leaves out every link out of an agent's folder and an agent's folder or login whose path leads through a link, but the links on the way to the home folder itself, naming the state (agent_import_link_unread_state), where before it followed them with only a warning (projectFolders.chosen, with throughVM's check). Tests that fail without their fix: TestWalkBound (fs.WalkDir as the control), TestWalkDepth, TestWalkAsWalkDir, TestWalkErrors, TestRootFSOpenSwapped (a FIFO), TestAgentStoreLock (import, save, a seed's clean), TestAgentSaveStoreChanged, TestAgentImportApplyFailsWhole (a rename and a login failing, files and folders swapping kinds), TestAgentImportUndoFails (two agents, the second's undo failing), TestAgentImportInterruptedApply, TestSaveLogins, TestAgentImportLinksUnreadState (a link out, a linked folder and its login, a login behind a link), TestAgentImportLinkWalked. TestRootFS and TestCleanSeeds* follow the new FS and ctx. paths.Dirs is allowed 63 methods (largeTypes), for agents.lock. Docs: using/coding-agents.md, internals/agents.md, using/space.md, internals/overview.md, Contributing's structure page and the owners doc, the codebase-standards guard for bounds; 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]> |
||
|
|
da872a6550 |
fix(vm): a renumbered folder's volume is checked until it's read; folder identity is read once
When a boot numbered a project folder's disk anew and its volume couldn't be read at that launch (diskutil failing or slow), recordFolder recorded the new device with the old volume, and from then on the identity matched byte for byte, so no launch compared the volume again: a copy of the disk with a volume ID of its own, mounted at the folder's path later, would have kept the VM. It now records the folder unchecked (state.VM.SetFolderUnchecked, vm.json's folder_unchecked), so each launch looks the volume up again; Env.keepsVolume compares it while the record is unchecked, as for a renumbered one, refusing another volume (vm_other_folder), and the first lookup that finds the recorded volume clears the mark (folderRecord). A move matches an unchecked record only on its volume (here.same), and a move whose lookup fails keeps the recorded volume, bound to the inode and birth time a move keeps, unchecked (recordMove). On Linux, where the volume is read in the process (volumeFree), every launch compares it, so a Btrfs snapshot or a ZFS clone mounted at the folder's path is another folder even on the original's device; after a volume's UUID changes, devvm adopt gives the folder its VM again. The finder's sameFolder and madeFor share one body (madeForOpen), and the folder is opened once: platform.SameOpenFolder is SameFolder for a folder StatFolder already read, platform.RecordedAs is its exact match, and keepsVolume, recordFolder and here.same take that read rather than open the folder again (here's id and unique are its stat's). madeFor, which the checks that ask which VM mounts a folder use, falls back to the folder's stat when it can't be opened, as when code in a VM that mounts it took away its read permission, so no VM hides from clone_repo_mounted or project_in_vm_folder that way. recordFolder compares again under the state's lock with the same folderRecord. The structure test's folder-ids rule now finds a map literal keyed by a folder's identity whose type is a named map type of the module's, a generic one included, or elided in a map's or a slice's literal whose elements are maps. Docs: a Btrfs rollback at the folder's path, or a volume's new UUID, needs devvm adopt; a Mac volume that ignores ownership makes every folder yours to the offer's check; the unchecked mark and Linux's check at every launch (internals, overview's vm.json fields). Tests: TestUncheckedOnAnotherVolume, TestKeepsVolume, TestRecordFolder (unchecked, then checked), TestRecordFolderUnderLock, TestRecordMoveVolume, TestMovedFrom (unchecked), TestMountedByUnreadableParent, TestSameFolder (SameOpenFolder, RecordedAs), folder-ids' named, generic and elided map cases, and fixture_v010_renumbered's unchecked steps on 0.1.0's state. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
bb0df957a0 |
fix(doctor): a broken VM state hides no other VM's warnings; Cursor's account services refuse more changing verbs
doctor's policy warnings (netpolicy.NotRules) listed the VMs with state.VMNames, which fails whole for one state it can't read, so one broken vm.json made doctor skip every VM's policy warnings. So did devvm network's warnings about every VM (allowlists for -g, and OtherBinaries). They now use state.ReadableVMs, the VMs whose state reads, which leaves the broken one out and the rest in; VMNames stays strict for what must count every VM, such as ports. A VM folder doctor can't read got two warnings, vms_unreadable from state.VMFolderProblems and vm_state_broken from vm.StateProblems; VMFolderProblems now leaves it to the latter, which names the VM and why. cursorChanges, the verbs refused in Cursor's DashboardService, AutomationsService and BackgroundComposerService, gains merge, fork, write, pin, unpin, rerun, confirm, request, release, acquire, activate, deactivate, notify, make, open, ensure, park, copy, bulk, advance, abort, wake, snapshot, seed, reply, opt, hand, fail, use, skip, decide, unshare, undelete, unpublish, unprepare, unresolve, enroll, unenroll, upgrade, suspend, switch, duplicate, dismiss, deregister, deliver, decline, convert, close, append, execute, provision, mutate, inject, finish, finalize, reassign, reinstall, reject, renew, reorder, reparent, replace, resend, rmdir, report and record. Each was checked against all 1,463 methods of those services in 2026.11.17-f532c45, read and not run: every one of the 102 methods they match changes something, none only reads, and the CLI calls none (Submit, Resolve, Check, Batch and the like stay off, as their methods read or the CLI calls them). fixture_v010_logs' capped.sh loop and network.txtar's sleeps around the squatting proxy now wait with wait_until. Tests: TestNotRules and TestOtherBinaries (beside a state that can't be read), TestVMFolderProblems, doctor.txtar (an unreadable VM folder, one warning), TestCursorChangingVerbs. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4ccdbf8125 |
fix(vm): folder identity's last checks: a renumbered folder keeps its volume
From the volume UUID commit's security review. A folder at its own recorded path on a disk numbered anew (platform.SameFolder's renumbered case) must now also be on the volume its state records, when both are known (platform.KeepsVolume): the finder checks it (finder.sameFolder, Env.keepsVolume, so a launch refuses with vm_other_folder) and so does recordFolder under the state's lock, so a copy of the disk with a volume ID of its own mounted at the folder's path is another folder. A volume that can't be told leaves the device's rule, as for a state that records none. mountedBy and mountsRepo keep the check without volumes (madeFor), which errs towards warning. hereOf reads the folder's identity, uniqueness, owner and volume from one open folder (platform.StatFolder, now with Owner), so the folder checked as the user's is the one matched and recorded. StatFolder is one function for macOS and Linux (folderstat_unix.go) over each system's openFolder, which SameFolder's renumbered case uses too, in place of openFolderID and darwin's copy. devvm ls and devvm space look volumes up through the run's Env (Env.FolderOf, Inventory.List(ctx, e)), each mount once a run, in place of diskutil for each VM; FolderOf, parentVolume and movedAway go. FolderDevice is unexported (folderDevice), so only platform reads a device; OnRecordedDisk takes a record without a device as on any disk. The folder-ids rule tracks names assigned from such names, however many steps on, and maps keyed by an identity, indexed or in a map's literal, without counting a struct literal's field; its loop is sitesWhereIn, shared with sitesWhere. The hdiutil e2e check makes sure macOS gave the disk a new number, attaching up to three images first, and is skipped when it never does. The design notes say who can forge a volume ID and what it gets them. Tests: TestKeepsVolume, OnRecordedDisk without a device, TestRenumberedOnAnotherVolume (a launch and recordFolder), TestListLooksUpVolumesOnce, StatFolder's Owner on both systems, the folder-ids rule's new cases, and fixture_v010_renumbered.txtar (another volume at its own path refused with nothing recorded; ls calls the moved folder gone by its recorded volume, where it said not_connected). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ba510eec1f |
feat(vm): a folder moved across a restart keeps its VM, by its volume
A project folder's identity was its device, inode and birth time, and since #60 a folder at its recorded path matched on another device. A folder that moved while a restart gave its disk another device number matched nothing, so plain devvm made it a second VM, and folderOf took a renumbered disk for an unmounted one ("not connected"), so movedAway was false too. Each VM's state now records the folder's volume, which no renumbering changes, as folder_volume, "<kind>:<value>:<ino>:<btime>", bound to the folder it was read with (platform.VolumeOf, RecordedVolume): macOS's volume UUID from diskutil (platform.VolumeUUID, only for the mount point and device read from the folder opened with no link, its answer checked against both), Linux's f_fsid on ext4, Btrfs and ZFS (StatFolder, read from the open folder); none on a read-only volume or a snapshot, or elsewhere. state.VM's folder is unexported: Folder(), FolderVolume() and SetFolder(id, vol), the one writer, which creation, adopt, a move and recordFolder (renumbered's successor, at each launch) use; a launch records the volume of a VM made before, once it can (1 s at a launch, 5 s at an adopt or a move, one failure a run stops the rest, through Env.Volumes and its run's cache). moveHere matches a moved folder by its volume, inode and birth time (platform.MayHaveMoved, MovedFolder), looking the volume up only once the rest matches, with the identity it matched and records both read from the folder opened with no link (hereOf), and folderOf compares the parent's volume where the state records one (platform.OnRecordedDisk), through Env.folderState for a move or an rm. The folder-ids rule now also reads Folder() and FolderVolume() calls, FolderDevice, locals assigned from any of them, switches and strings/slices comparisons. An older devvm keeps folder_volume as it is (checked with 0.1.0's own reader in a temp copy of its tree). A rename keeps the inode, so the binding stays right; when an older devvm adopts another folder for the VM, or a move across volumes copies it, the binding names another inode, so the record names no volume and is recorded again. DEVVM_VOLUME stands in for diskutil, and for Linux's f_fsid, in test builds (VolumesOnly). Tests: TestFolderOf (not connected after a renumbering), TestMovedFrom (moved and renumbered, and a split between the read that matched and the one recorded), TestRecordFolder (made, a VM made before at its next launch, a failed lookup, a renumbering keeping the bound volume), TestVolumeOfCache, TestVolumeOf, TestMovedFolderAndRecordedDisk, TestStatFolder(AndVolumeUUID), TestPlistStrings, the folder-ids rule's new cases, fixture_v010_renumbered.txtar (0.1.0's VM records its volume, then moved and renumbered it's offered, never a second VM), and e2e's projectRenumbered (hdiutil, macOS) and the project section's volume check. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b5f3899f1a |
test(vm): smaller 0.1.0 cases
fixture_v010_small.txtar runs what changed since 0.1.0 on its frozen state, in smaller cases: - devvm ports on 0.1.0's records of app's port forwarder (its pid and status, no list of what it forwarded) says nothing is held, taken, past the limit or refused. - A proxy port 0.1.0 chose on one of the ports only VMs' ssh may have (its proxy port moved onto the sandbox's first ssh port) moves at app's next start, off the list, and the proxy's config listens there. - On Linux, that start gives the guest's connections to the proxy the capped devvm _qemu connect, to that port, with app's own run/proxy.slots, where a 0.1.0 start had the two-argument form. The limactl stub now records the start's DEVVM_GUESTFWD ($STUB_DIR/start-guestfwd-<name>, empty when unset), as it records the start's agent, with its unit test, and the structure test's envSettings lists the stub as a reader of DEVVM_GUESTFWD. - app, stopped, holds none of its listed ports: scratch lists 3000 too and forwards it, and app, started again, says scratch has it (ports_held, held_by in devvm ports --json) and that a program here has another port it lists (ports_taken), never the limit or a refusal. While it runs, devvm ports names each reason its forwarder's record gives (ports_taken, ports_limit, ports_refused, each its own port), and none for an older devvm's three-line record (reasons.sh judges only a run on the record as it wrote it, trying again when app's forwarder, waiting on scratch's port, replaced it). - #52's leftover, a state as 0.1.0 wrote it for a folder named x--y before Lima refused the name (built from app's 0.1.0 state: its name and alias with the run of separators, the folder's path, no created time or start), is read as no VM and replaced by the folder's VM. - After a boot that numbered the disks anew and a move of app's folder, devvm adopt VM moves app to the new path, and its launch starts it there. Found, not changed: a moved folder on a renumbered device isn't taken as the VM's folder (platform.SameFolder matches another device only at the recorded path, as a copy keeping the inode and birth time sits elsewhere), so devvm there, without adopt, makes a second VM for the moved folder, saying nothing of the first, whose folder is gone; devvm adopt VM is the way back, as the docs say. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2c0a894a1c |
fix(vm): a project folder's VM works after a boot renumbers its disk
macOS numbers its disks' devices in the order they appear at boot, so after a restart an unchanged project folder's identity (dev:ino:btime) can have another device. The finder then refused its VM as made for an earlier folder (vm_other_folder), a stopped VM's start refused it as replaced (project_folder_changed), and the next .git check called it replaced (git_replaced). platform.SameFolder is now the one comparison of two folder identities: the same ID, or at the same path the same inode and birth time on another device. On another device the ID must also be the one read from the folder opened at the path with no link followed (OpenNoLinks, then fstat and fstatfs on it: openFolderID), on a file system whose IDs are their folder's alone, so a link swapped in while the caller read the ID can't pass a copy's (a snapshot's, a cloned disk's) off as the folder's. A folder at another path (moved) matches only exactly. platform.Renumbered says when the record needs the folder's ID as it is now. The finder's sameFolder, here.movedFrom, gitprotect's protectRepo and the strict conversion's checks use it. A start records the project folder's identity as it is now under the VM's state lock (renumbered, in bringUp) before the backend mounts it by Want.ProjectID, so vz's /.vol/<dev>/<ino> mount names the current boot's device, in the one limactl edit; folderChanged's checks after it then compare exactly. A .git check that accepts a renumbered .git records its current identity. The move's check stays exact, as both its IDs are read in one run. The structure test's folder-ids rule fails on == or != on a field named Folder or GitID, or a call of FolderID or folderID, outside internal/platform and tests, unless exactFolderIDs lists the function with why: the agents' and exports' Folder paths, recordMove's unchanged-state check and folderChanged. Tests: TestSameFolder (platform), TestRenumberedFolder (vm), TestReportsRenumbered (gitprotect), a renumbered vz case in TestProjectMountByInode (lima), existing.txtar's renumbered folder, and fixture_v010_renumbered.txtar on the frozen v0.1.0 state, through the new renumber script command and stubtest.Renumbered. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
069f646e80 |
test(structure): an io.ReadAll outside tests reads through an io.LimitReader
The structure test's read-limits rule fails, outside tests, on an io.ReadAll whose reader isn't an io.LimitReader made in the call, unless unboundedReads lists its function with why; a listed function that has none fails. Four are listed: the status line's tail of the run's own log, which only that run writes, and the three test stubs' reads of the standard input devvm under test writes and closes. readCases breaks it on a renamed io import, a reader limited before the call and a read in a function literal. It shares dropped-errors' walk and table check (siteRule, sitesWhere). Named as the guard in codebase-standards' Bound what you don't control and rules.md, and in Contributing's structure test. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f9c02c1c5c |
build(lint): a file a VM can write is changed through what opened it
forbidigo refuses os.Chmod, os.Chtimes, os.Chown, os.Lchown and os.Truncate in internal/proxy, internal/vmlog and internal/vmssh, outside tests: a change by path follows a link a VM swapped in after the open. The two sites today, the proxy's SSH agent relay socket and the link session's sockets, chmod a unix socket devvm has just made in its own folder, which only its path can set; each says so in a nolint. The safefile rule widens to internal/vmlog, which has no open of its own, and to the proxy's rotate.go and nixcache.go, whose three opens to write or lock say why in their nolints. testdata/lint breaks the rule once for each function and keeps the descriptor's own methods. Named as the guard in codebase-standards' Treat what a VM can write as hostile and rules.md, and in the checks on owners. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
bd09e883d5 |
test(structure): a Wait's or a strconv parse's error assigned to _ fails
The structure test's dropped-errors rule fails, outside tests, on a function that assigns a Wait's error, or a strconv parse's (Atoi, the Parse functions, Unquote, UnquoteChar, QuotedPrefix), to _, unless droppedErrors lists it with why; a listed function that drops none fails. None is listed today. errorCases breaks it on each shape: an assignment, both of a process's Wait results in a goroutine, a renamed strconv import, a var and an if's init. Named as the guard in codebase-standards' Never fail silently and rules.md, and in Contributing's structure test. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1793353dd9 |
feat(proxy): Linux confines the proxy's child with Landlock and seccomp
Before it reads a byte of the VM's, devvm _proxy-child confines every thread of itself through proxy.confineSelf on Linux: no_new_privs (syscall.AllThreadsSyscall), Landlock from ABI 2 (TSYNC from ABI 8) to its logs folder, the Nix cache and the resolver's files (never /, the home folder or one that holds it), binding no TCP port (ABI 4), scoping signals and abstract sockets (ABI 6, or ABI 6/7 with erratum 2), refusing named unix sockets (ABI 9) and UDP but to port 53 (ABI 10); then a hand-written classic BPF seccomp filter, installed with TSYNC, that refuses with EPERM AF_UNIX socket/socketpair, listen, io_uring, ptrace, process_vm_readv/writev, pidfd_getfd, a file's mode, owner, xattrs and times by its path (chmod, fchmodat, fchmodat2, chown, lchown, fchownat, the six xattr calls, utime, utimes, futimesat, utimensat with a path), truncate, the keyrings (add_key, request_key, keyctl), prlimit64 on any pid but 0, setpriority, ioprio_set, sched_setaffinity, sched_setscheduler, sched_setparam, sched_setattr, inotify_init, inotify_init1, inotify_add_watch, fanotify_init, fanotify_mark, execve, execveat, fork, vfork, unshare, setns, bpf, userfaultfd, perf_event_open, clone for anything but a thread or with a namespace's flag, and clone3 with ENOSYS; it kills a foreign architecture's call or an x32 number. fchmod, fchown, ftruncate and utimensat on a descriptor stay. It checks the confinement holds, then proxy.checkConfined, and that it still reads the host's addresses, within 2 seconds, or fails the start. A kernel without Landlock or seccomp leaves that part out; the child runs and says so. The broker sets itself undumpable (PR_SET_DUMPABLE 0). The Nix cache marks a file used through its descriptor. The broker's start, and its life with the child, take a reset of the socket (ECONNRESET, Linux's end of a socket closed with frames unread) as the child's end, as EOF is (socketEnded, TestHandshakeChildGone). Built on the Seatbelt item's shared owner, proxy.Confinement: - internal/landlock (new, stdlib only, Linux build tags): Self, Result, Floor, ABIPorts/ABISignals/ABIUnix, ErrUnsupported; landlock_linux.go (resolverFolders, refusedFolder, homeFolder), filter_linux.go (filter, asm, encode, archOf), seccomp_linux.go, self_linux.go (Self, check, refused). - internal/proxy: confineSelf on Linux calls landlock.Self; landlockConfinement words it (By landlock, seccomp; Why no-landlock-or-seccomp, no-landlock, no-seccomp, landlock-below-abi4, landlock-signals; full from ABI 6 with seccomp and scoped signals); confineChild takes the child's needs and returns an error, bounded by confineWait (within, confineWith); checkConfined only where Landlock or Seatbelt confines files; confineStarted; IO.confine required, set by ChildMain alone; hostAddrs.check; touch_linux.go and touch_other.go (touchFile, undumpable); IO.dumpable for tests. - devvm doctor: netpolicy.Unconfined's Linux warnings (proxy_unconfined_no_kernel, _no_landlock, _no_seccomp, _old_ports, _old_signals). - Tests: TestFilter and TestFilterBytes (an interpreter of the program's bytes, amd64 and arm64, and the assembler's refusals), TestSelf (a real confined child: outside file, ssh-like unix socket, listen, bind, signal, chmod, chown, setxattr, utimes, truncate, a keyring, unshare, exec, clone3, and new threads, fchmod, ftruncate and futimens kept), TestKernel, TestCheck, TestRights (refusedFolder), TestArchNumbers, TestLandlockConfinement, TestConfineWithin, TestCheckConfined, TestConfineStarted, TestRunChildOn, TestUnconfined; network.txtar; e2e network's Landlock, NoNewPrivs and Seccomp check. - CI: a nocgo job (CGO_ENABLED=0) for internal/landlock and internal/proxy. - Structure test, depguard, goroutineSites; docs: the child's sandbox, processes (and its why-Go note on unsafe), design (the network row's loopback follow-up on Linux, other processes and /proc without Landlock), doctor's checks, troubleshooting, attack vectors, Contributing, the proxy's README, AGENTS.md, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
aeea3135b2 |
feat(proxy): the proxy's broker and its child
A VM's proxy runs as two processes, as design.md's "The proxy's broker"
says: devvm _proxy, the broker, which keeps what only the host should
do, and devvm _proxy-child, which reads the VM's network and can be
confined by the follow-ups.
- wire.go: the protocol over one socketpair (close-on-exec from the
start: SOCK_CLOEXEC on Linux, ForkLock elsewhere), length-prefixed JSON
frames of at most 2 MiB, unknown fields refused, bytes as base64, one
descriptor on a frame's first bytes (SCM_RIGHTS, MSG_CTRUNC breaks the
rules), wire types for every secret (redact.Secret at once).
- broker.go: newBroker, the start (handshake: version 1 and each side's
executable's SHA-256, within 4 s), the answers (value through lookups,
kept 30 s or 5 min, a failure 5 s, dropped when the bindings change;
file by number; link connected by the broker and passed as a
descriptor; token exchanged by the broker), each by something in its
own config, with caps 1/8/4/256; live: the lifeline closes the socket
and kills the child 6 s later, SIGTERM stops it within a second, a
child that ends ends the broker, a rule broken stops the child.
- child.go: the start (startOf), the child's server (newChildServer),
the broker as hostSide over the socket (brokerClient), runChildOn;
ready only after it reads the host's addresses (kept: the last good
read), roots and time zone loaded first.
- process.go: Main(ctx, ...) and ChildMain; the child spawned with
/proc/self/exe on Linux, PR_SET_PDEATHSIG from a locked thread
(daemon.Cmd.DieWithThread), descriptors 3 and 4, and TZ, SSL_CERT_*
and GODEBUG with updatemaxprocs=0 alone; run/proxy-child.pid and
run/proxy.confined ("none" until the follow-ups); KeepLogs in the
broker. ChildMain refuses to start unless descriptors 3 and 4 are a
unix socket and an IP one (checkInherited): run by hand, without
them, those numbers can be the Go runtime's own, which closing
crashed it (signal_recv: inconsistent state).
- capture.go: a captured token request goes to the broker
(captureToken, exchanger), so a login's real tokens never enter the
child; an error reply passes up to 1 MiB, longer gets 502.
- watched.go: the child stats each changing file and asks the broker
for it once it changed, keeping the stamp of what the broker read.
- rotate.go: proxy.log rotated by both through its descriptor, under a
lock of a description of its own; OpenLog opens a log never through a
link, one link, yours, replacing what a child left in its place.
- nixcache.go: the trim and its count through a safefile.Root, nar/
only as a folder, links deleted as themselves; reads never through a
link; the lock tried for 5 s (ErrNixLocked, nix_cache_locked).
- daemon: Cmd.Err, Files, Env, DieWithThread; Handle.Kill, Exit;
WritePID.
- netpolicy: Proxy.Stop also stops a child that outlived its broker
(run/proxy-child.pid, _proxy-child -for); proxy.log opened with
OpenLog; a refused launch keeps a running VM only while both run.
devvm network log and lock read the event log through safefile.
- vm, vmssh, vmlog: links.log and ports.log opened with OpenLog, read
through safefile, trimmed only as a regular file with one link.
- backend: the build proxy's logs in a logs/ folder of their own.
- cli: _proxy-child; _proxy waits for its child on a signal
(StopsItsOwn); the child reads none of devvm's folders (no
makePrivate); ui.Files.
- Tests: FuzzBrokerFrames, the frames' rules, the handshake and the
pair's end in synctest bubbles, the caps, the broker naming its own
alone, the client over a real socketpair with a passed descriptor,
ChildMain, TestInheritedSocket and proxy.txtar's child run by hand,
the frozen 0.1.0 configs starting a broker and child,
two writers rotating once, planted links, FIFOs and hard links; the
testscript runner stops _proxy-child too; e2e: broker and child, their
arguments, descriptors and environment, stop, SIGKILL either, planted
files in the logs folder and the Nix cache, build proxies gone.
- Review fixes: the lifeline closes the socket and starts the kill's
timer before logging; every log lock (proxy.log's, the event log's
rotation) is tried without blocking for 200 ms (flockWithin, which the
Nix lock shares), then written without or the rotation skipped; a
copied log's rotation streams at most twice its limit from a line's
start (copyFrom, copyAtomic); a reply too long to send goes as
too_long; kept token headers capped at 1 KiB; the child gives up on a
request whose context ended, dropping its late reply and holding its
slot until then; a write deadline on the start frame; errors reach the
child as codes (not_found, refused, busy, too_long, failed), their
text in the broker's log; FuzzFrameStreams, and FuzzBrokerFrames
writes from a goroutine; nix_cache_locked links to How it works.
- Docs: processes, network, overview, design (with threat rows for the
logs' locks and a log made huge), troubleshooting, the proxy's
README, structure, testing; CHANGELOG.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
9c74dac11e |
fix(logs): a VM's logs are held to their caps while it runs
internal/vmlog owns every log a VM can drive but the proxy's own: Limit (moved from vmssh's logLimit, with Allow for the link session's warnings), Capped and Trim for ports.log and links.log while they run, and KeepVM, which the VM's proxy (proxy.IO.KeepLogs, Config.VMLogs from backend.Run.Logs) and a Lima build run on the serial consoles' and the hostagent's logs: redacted as they grow (redact.FileFrom), so a reboot in place can't leave the proxy password there, and rotated past 10 MiB, counting what a log holds past the hole its writer left (platform.DataStart). The proxy's http.Server logs through its own limited log, and its copied log counts what reached it as stderr; the build proxy's log is held as a VM's proxy's is. git-pins.jsonl has a cap. Run logs take at most 256 MiB together, never the newest or a live run's. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
90a64a44d1 |
fix(races): lock order checked, sandboxes' own ports, pins that meet a rename, daemons' groups stopped
- state: test builds and tests check the state locks' order (state.held, CheckLockOrder): a second VM's lock, a VM's lock under the claims lock, or a lock taken again panics before waiting. - platform: PinBeneath opens the path again when a rename takes the file away before move_mount (ENOENT), so the keeper no longer reports a false lost pin (TestPinsInNamespace's 'f lost / f pinned-again'); TestPinWhileRenamed. - daemon: Proc.Stop signals the process group (SignalGroup), so forwarders' and link sessions' ssh masters and relays end with them; ui.UI.StopsItsOwn makes _ports and _links wait for their ssh on an outside SIGTERM. - vm: gc --orphans and devvm space count forwarders' leftover control sockets (vmssh.ControlGlob). - CLI tests: each sandbox claims a block of ports below devvm's range and the ephemeral range (claimPortBlock, /tmp/devvm-test-ports); free_port, the fixtures' ports and DEVVM_SSH_PORTS come from it, and the sandbox's devvm chooses from its own range (DEVVM_PORT_RANGE override). Fixtures' forwarded ports and settings ports are rewritten too (FIXTURE_PORT_<port>). - netpolicy and vm tests: the fake proxy's stop waits for its reap, and fake daemons run until the test ends, not 30 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
19f9900b86 |
fix(sshagent): a VM reaches its SSH agent only through its proxy's relay
OpenSSH's ssh-agent answers every request a forwarded connection sends, so a VM that forwarded your agent or devvm's own (shared by every VM that uses it) could remove all its keys (ssh-add -D), lock it with a password of its own (ssh-add -x) or add keys without bound, denying the agent to you and to the other VMs. Checked with a throwaway sshd and ssh-agent: all three succeed over ssh -A. Each VM's proxy now relays the agent its start chose on a socket of the VM's own (paths.Dirs.AgentRelay, run/agent-<hash>.sock, mode 600), and the VM's backend, devvm's own connections and the ssh entries for editors name that socket. The relay passes on only SSH_AGENTC_REQUEST_IDENTITIES, SSH_AGENTC_SIGN_REQUEST and the [email protected] extension (so destination-constrained keys keep their constraints), answers everything else with SSH_AGENT_FAILURE, reads messages whole up to OpenSSH's 256 KiB, carries at most 16 connections and closes one idle for 2 minutes. A filtering relay rather than an agent per VM: it covers your own agent too, needs no copy of a key or a passphrase per VM, and fronts hardware and app-held keys. - proxy: Config.Agent/AgentSocket (checked together, absolute), the relay in agent.go, listened before the proxy says it's ready; its accept loop backs off after an error that leaves the listener open (EMFILE), 5 ms doubling to 1 s, logging the first. - daemon: AcceptRetry, vmssh's acceptRetry moved to the stdlib-only package the proxy already imports, so the relay, the port forwarder, the link session and a login's forward share one owner. - netpolicy: Prepare takes a start's agent; a running VM's proxy keeps its start's agent from proxy.json (relayedAgent); Stop deletes the relay's socket. - structure: paths.Dirs may have 62 methods (AgentRelay); the relay's goroutines in goroutineSites. - sshagent: Made.Relayed, which RecordStart sets on every start of this devvm's whose choice forwards an agent, one without SSH_AUTH_SOCK included, and ReachOf(st, start): a relayed start gets the relay (or none while it's down), a start devvm didn't record (one outside devvm) gets none, or its proxy's relay, and only an older devvm's recorded start keeps the raw agent until its next start (runningConfinement, finder.inspect, sshconfig). - vm: LeftoverSockets also finds a killed proxy's relay socket for devvm gc --orphans and devvm space. - Tests: relay filter, wiring through Main, bounds and idle close, real ssh-agent/ssh-add/ssh-keygen through the relay, Prepare's relay, RecordStart/Relayed, sshconfig entries, vm agent tests, ssh_agent.txtar, an outside start in ssh_agent.txtar, and e2e checks that the VM can't remove, lock or add to your agent, nor the VM or an editor's connection remove devvm's agent's keys. - Docs: processes (the SSH agents, listeners), ssh, attack-vectors, security, design, lima, overview, space, structure, proxy README, AGENTS.md, CHANGELOG Fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f37c70a5cd |
fix(bounds): bound what a VM can make the host hold
Five bounds, each with a test that failed first. Long downloads,
WebSockets, slow streams and SSE are never cut: every bound is on what a
connection holds, never on how long it lasts.
- _qemu connect (Linux): each guest connection to the proxy was a host
process with no cap. Connect now takes one of connectMax (256) slots,
lock files in the VM's run/proxy.slots (paths.VM.Proxy(".slots")),
each process about 7.7 MB, so about 2 GB per hostile VM. A connection
past them gets an HTTP 503 (connectsFullReply) and closes before it
dials; QEMU's stderr says qemu_connects_full at most once a minute,
decided under full.lock so refusals at once say it once. A VM started
before keeps the two-argument form, unbounded until its next start.
No idle timeout or byte bound: the proxy bounds what each carries.
TestConnectSlots.
- The VM proxy (limits.go):
- maxConns (2048, twice maxConnects so a CONNECT still gets its 503
first) counts a connection from its first request with the VM's
password (conns.admit, via httpServer's ConnContext); a request past
it gets 503 and the connection closes. Connections without the
password wait in a pool of maxWaiting (128) where a new one closes
the oldest, so holding connections can't take a VM's room (a host-speed flood still slows it
through the accept queue: listed in design.md).
- maxRequests (2048) requests upstream at once, plain HTTP's and
intercepted tunnels' (requests.take), 503 past it: per-tunnel
HTTP/2 streams alone allowed ~100,000 upstream connections.
- each limit logs once a minute at most (everyMinute).
- httpServer adds IdleTimeout (10 min); a 407 closes its connection;
handleHTTP's WithoutCancel is replaced by whileHeard, which ends a
plain HTTP request once its client has stopped sending and goneWait
(1 min) passes with nothing written, so half-closing clients still
get answers that keep coming; quiet WebSockets aren't cut.
- heardWriter.Unwrap: plain ws:// upgrades got 502 (pre-existing) and
get 101.
- No ResponseHeaderTimeout: non-streaming LLM requests wait minutes
for headers, and a waiting client is counted.
Tests: TestProxyLimitsSet, TestProxyConnectionBounds,
TestProxyConnectionLimit, TestProxyWaitingConnections,
TestUpstreamRequestLimit, TestUpstreamRequestLimitIntercepted,
TestPlainWebSocket,
TestPlainHTTPEndsWithClient.
- serveOne (intercepted tunnels, transparent HTTP, the 403 page) takes
maxHeaderBytes (64 KiB) always, not 1 MiB, and HTTP/2
MaxConcurrentStreams streamsMax (100, not 250). TestServeOneHeaderLimit,
TestServeOneStreamsLimit.
- Accept loops (forwarder, link session, login forward) retried nothing
or at a fixed 100 ms: vmssh.acceptRetry backs off from 5 ms to 1 s and
logs the first error of a run, ending only when the listener closes or
ctx ends. TestAcceptRetry, TestForwarderAcceptRetries,
TestLinksAcceptRetries.
- The login callback (LoopbackForward) carries at most
loopbackConnsMax (16) connections, an ssh each.
TestForwardLoopbackLimit.
Docs: processes, network, ports, lima, design (threat rows),
attack-vectors, the proxy README, CHANGELOG Fixed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
1b8fd8a639 |
test(lifecycles): synctest bubbles for the relays, the forwarder, the links, the proxy and the daemon's stop
Timeouts, graces and closes are tested in testing/synctest bubbles on the
bubble's fake clock, to the moment, instead of sleeping and polling on the
real one, with stand-ins in memory behind seams that are fields. Each kind
keeps one real-process test. No behaviour change: each seam's production
value is what the code did before.
Seams:
- vmssh: sshRelay{grace, start} carries a relay (pipeSSH's body, as
pipeSSHFor was); start is execSSH in production.
- vmssh: Links.Listen (listenSocket unless set), for the links' sockets.
- proxy: egress.connect, the dialer for allowed far ends (a net.Dialer
with its 15 s timeout, set in newServer).
- daemon: Proc.Alive (Alive unless set).
- proxy: httpServer, the proxy's http.Server as run serves it, which the
tests' memServe shares.
New test-only package internal/memnet (standard library only): Pipe, whose
connections half-close, buffer 64 KiB and have deadlines, and Network,
listeners by address with Listen, Dial, DialContext and SetDeadline. The
structure test keeps it for tests and a leaf, depguard keeps it standard
library only, and its AfterFuncs are in goroutineSites.
Bubble tests:
- relay: TestRelayGrace (silent and talking, closed and half closed),
TestRelayGraceSlowClient, TestRelayGraceWriteError,
TestRelayCancelEndsBlockedWrite, TestGraceTimer (exact grace).
- forwarder: TestForwarder, TestForwarderAliveOnEnd, TestForwarderOnly,
TestForwarderGap (reports exactly Gap apart), TestForwarderGivesUpSilently,
TestForwarderClosesConnections (now also its stuck relay's ssh and slot).
- links: TestLinks, TestLinksSessionLost, TestLinksCap,
TestLinksEndStuckRelays (memSSH; relays end at the next sync on removal,
master replacement and target change), TestLinksList.
- proxy: TestTunnelHelloDeadline (EOF at exactly helloTimeout),
TestTunnelHelloStall (and a hello whole a moment before the deadline),
TestTunnelAddressSplitHello, TestConnectLimit, TestCloseConns,
TestCloseConnsWaitsBounded (close gives up at exactly closeWait),
TestSpliceEnds, TestSpliceEndsWhenItsClientCloses.
- secrets: TestSecretLookupFailuresNeverCached (hung lookups cut at
lookupTimeout, cancelled, failed and empty ones never cached; a request's
end doesn't cancel a lookup; the TTL to the moment).
- daemon: TestProcStopWaitsForTheEnd, TestProcStopKillsOnlyItsOwn,
TestProcStopKillsAfterWait (fakeProc), TestFollowLifeline.
- TestCursorReplyScans uses httptest.NewTestServer.
Kept on real processes and the real clock: TestPipeSSHGrace,
TestPipeSSHGraceSlowClient, TestPipeSSHGraceWriteError,
TestForwarderEndsStuckRelay, TestLinksBurst, TestSpliceKeepsAnEarlyAnswer,
TestProcStop.
Docs: Contributing's Tests has Time and lifecycles; structure.md, _index.md
and AGENTS.md name memnet.
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]>
|
||
|
|
cc94465400 |
test(leaktest): goroutine leak checks, and the leaks they found
A new internal/leaktest, standard library only, so the proxy's and the daemon's tests use it too (depguard's proxy rule allows it, and the structure test holds it to tests and to importing nothing of devvm's): - leaktest.Main(m), in TestMain: once the tests pass, every goroutine's stack (runtime.Stack), a settle of 5 s, then a failure naming those still running, but the standard library's own that outlive every test (allowed: signal.Notify's loop, an HTTP client's idle connections); then Go 1.27's goroutineleak profile, which fails on any goroutine blocked for good. - leaktest.Check(t), first in a test: its own goroutines, followed by parent through those still running, and by which ran before it, never by ID (each thread takes a batch of IDs). Main runs in proxy, vmssh, daemon, desktop, ui, vm, backend/lima, platform, cli and gitprotect (main_test.go, or the TestMain they had). Check runs in TestLinksEndStuckRelays (replacing its NumGoroutine count), TestForwarder, the desktop relay's serve helper, TestRunChild, TestPinWaits, and the proxy's new close tests. The structure test's goroutines rule (internal/structure/goroutines_test.go): goroutineSites lists every function outside tests that starts a goroutine, with a go statement, a wait group's Go, or time's or context's AfterFunc, function literals in package-level vars included, as "file: Func", with its waiter, or "detached: " and why nothing waits. A new one fails until listed, a listed one that starts none fails, and a package that starts one fails until its tests call leaktest.Main. Leaks it found, each fixed with a test: - The proxy's close left its connections running: http.Server's Close neither closes a connection a handler took (a CONNECT's tunnel, a WebSocket upgrade ReverseProxy takes) nor waits for a handler. conns (conns.go) holds every connection the listener accepted (track) and counts every handler (handle); serve calls closeConns once Serve returns, which closes them, closes any accepted after, and waits up to 5 s for the handlers. splice also ends when its client's connection can't be read (closed, reset), rather than half-closing the far end and waiting on it; a failed write to the server (one that answered early and closed) still lets its answer through. Tests: TestCloseConns (a tunnel and an upgrade), TestConnectAfterClose, TestSpliceEndsWhenItsClientCloses, TestSpliceKeepsAnEarlyAnswer; the tests' listen closes as the proxy does, and the fake upstream closes its target once its client's end comes. - platform's runChild left its signal-passing goroutine blocked on a channel signal.Stop never closes; it now closes it and waits (TestRunChild). - platform's WaitExit and WatchFolders blocked in poll(2) and read(2), which closing their fd from the stop doesn't wake on every kernel (Debian's didn't), and a retried call could land on a reused fd. They now wait in Go's poller (pollable), which the stop wakes (TestPinWaits, with a wait stopped before its process ends). Docs: Contributing's tests page (Goroutine leaks), the structure page (the goroutines rule, goroutineSites, the layers, the packages), the Go lint rules' depguard line, the proxy's shutdown in How it works' processes page and the proxy's README, and AGENTS.md. Coverage baselines: internal/leaktest's line on both systems, netpolicy's raise on macOS. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4e925492ca |
fix(proxy): every host is read in one form, proxy.NormHost, guarded by the structure test
Every check that judges or compares a host now reads it through proxy.NormHost (internal/proxy/host.go), which also holds HostOK, splitHostPort, hostASCII and asciiEqualFold: a host of printable ASCII is lowercased in ASCII alone and loses its one trailing dot; any other host stays as it is, so HostOK refuses it and no Unicode fold makes another name match. A host with two trailing dots or more, or a dot after a closing bracket, keeps them, so NormHost is idempotent and reading a host twice can't turn evil.test.. into evil.test. A proxy.Host is what the matchers take (rule.matchHost, noProxyRule.matches, local, sniMatches). Brackets are strict (hostAddr): HostOK, Host.Addr and splitHostPort take an address bare or an IPv6 address in one pair of brackets, never a stray bracket ([[::1]], 1.2.3.4]) or brackets around a name or an IPv4 address ([evil.com]:443, [1.2.3.4]:443), which get 400. Migrated: splitHostPort, sniMatches, sniHost, parseHostRule, the policy's rulesFor, quiet, byName and coversOn, secrets.forHost, parseNoProxy, route and local in internal/proxy; netpolicy.RiskOf, Tickable and sameRule (devvm network rm and the duplicate check, so a Kelvin sign never names the rule with a k); secrets.CheckHost; from.publicHost (a name HostOK refuses isn't public); agentlogin.claudeHost; vm.urlHostPort and privateHost. vm.urlHost (cloneseed.go) keeps its own reading: it's a remote's ssh host, which ssh lowercases and keeps the trailing dot of, to find a VM's alias. Differential fuzz targets keep a frozen copy of each reader as it was and allow only the decided differences: FuzzHostSites (proxy), FuzzRiskSites, FuzzCheckHostSite, FuzzPublicHostSite, FuzzClaudeHostSite and FuzzPromisorHostSite. A rule line is the same rule or no rule exactly as before, so a broken deny stays a broken deny. TestFixtureHosts reads the frozen v0.1.0 state's secrets.policy, secrets.json and links.json hosts and finds them unchanged. The structure test's new hosts check refuses, outside host.go and tests: Trim, TrimLeft or TrimRight with a cutset holding ".", TrimSuffix or CutSuffix with "."; ToLower, ToUpper, EqualFold and the TrimFunc family on an argument named for a host; and a conversion to proxy.Host of anything but a literal. Exceptions are by file and function, each with why (request.go:trimDots, cloneseed.go:urlHost, cloneworktree.go:safeIndexPath, cloneconfig.go:transportHelper, lima/start.go:machines.fillPassword). It doesn't see slicing, strings.Map or variables not named for a host. The owners doc, the proxy README, structure.md, design.md (One form of a host), network.md and safety/network.md say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
89f26c5771 |
docs(site): draw the diagrams at build time with pele, no Mermaid JS
The docs site's 18 mermaid blocks are now drawn as SVGs before Hugo
builds the site, by docs/render-diagrams.mjs with pele 1.13.0, and
inlined by a render hook, so no page loads Mermaid's 5.5 MB script.
- docs/render-diagrams.mjs: finds each mermaid block in docs/content,
draws it with pele in Departure Mono at 14px (a measurer from the
font's metrics), and writes <key>.svg and <key>.json (its size) to
the git-ignored docs/.build/diagrams. pele draws edge labels,
messages and notes at round(14 * 0.875) = 12px with no option, so the
measurer gives that text its 14px width and the script rewrites
font-size="12" to 14 on each small-text group (pele-edge-labels,
-notes, -boxes, -frames); a guard fails on any such group without
font-size="12", or small text outside them, and a self-check, run
whenever there's something to draw, renders an edge label, a message
and a note and fails unless pele measured them at 12 and wrote their
group with font-size="12". It also fails on a diagram without
accTitle and accDescr, or on an indented block. A newline after each
</text>, outside any text element, lets the search index see labels
as separate words; screenshots of all 18 are byte-identical with and
without it. (Newlines between a label's tspans would move centered
lines, so a label's own lines stay joined in the index.)
- Caching: a block's key is sha256(salt + "\n" + text)[:16], the salt
being sha256("pele <version>\n" + the script's text)[:16], written to
diagrams/salt. The script keeps every drawing already there, draws
only missing ones (written to .tmp and renamed), prunes files no key
names, and touches the folder. docs:diagrams has sources (the pages,
the script, package.json, the lock) and outputs (the folder), so mise
skips an unchanged run, and runs npm ci only when the lock's SHA-256
differs from docs/node_modules/.devvm-lock-sha256. An unchanged run:
0.45-0.75 s before, 0.02 s now (0.09 s forced); one diagram changed:
0.09 s. CI's check job caches ~/.npm keyed on the lock; the Docs
workflow, which publishes, keeps no cache.
- docs/package.json and package-lock.json pin pele 1.13.0
(sha512-Ie8UKY9x00MsuR3jO6AzUwzK2Z6MIV3Tf4EDdITiuk8Uaz8K7g0R082WqsqNaSU8DdgkrRvZThzhit83mi/uiw==).
- docs/layouts/_markup/render-codeblock-mermaid.html: in place of
Hextra's hook, reads the salt, computes the key from it and .Inner,
inlines the SVG from assets/diagrams (hugo.yaml mounts .build/diagrams
there), sets the wrapper's contain-intrinsic-block-size to the
diagram's height and --devvm-diagram-width to its width, and errorf's
when a drawing or the salt is missing. layouts/_partials/scripts/
mermaid.html and params.mermaid go.
- custom.css: .devvm-diagram with content-visibility: auto, and pele's
--pele-* variables from the palette (subgraphs, lifelines and notes in
the border color). A diagram wider than the text reaches into the
article's right padding (1.5rem, 3rem from 768px) as far as it needs,
then into the left padding for the rest, so it never covers the table
of contents; wider than both, it scrolls. From about 1010px no diagram
scrolls, the four wide ones included (proxy checks 751px, agent store,
VM states, SSH agent); at 900px five scroll. With the table of
contents shown, the proxy checks take 48px on the right and 31px on
the left.
- mise.toml: docs:diagrams, which docs and lint:docs depend on.
docs.yml: the next and release jobs install node and draw the
diagrams; the release job only when the tag has the script, so older
tags still build.
- scripts/bump.sh: bump_pele, named only, replaces bump_mermaid: npm
install --save-exact --ignore-scripts in docs, then mise run
docs:diagrams, whose self-check catches a pele that changed how it
draws small text. TestBumpCoversPins finds docs/package.json's
dependencies (npm:NAME); bump.txtar tests --check and the install.
The header and hextra's note say the mermaid render hook replaces
Hextra's mermaid hook, so check it still has that name.
- Every diagram gets an accTitle and accDescr, which pele makes the
SVG's title and desc (aria-labelledby, aria-describedby). Staying
safe's columns are written in reading order, as pele lays subgraphs
out from left to right. The proxy checks' description names every
branch, and a hand-placed <br> keeps "CA)" off a line of its own.
- AGENTS.md: the one Node script; no other build script is JavaScript,
and no other npm package is installed outside mise's tools.
Contributing's docs, tools and
maintaining pages describe the drawing, the caching, the margin, the
task and the bump.
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]> |
||
|
|
1ecd1faa73 |
build(nilaway): mise run nilaway against a triaged baseline, an advisory CI job, and two crashes it found
nilaway is pinned in mise.toml at its newest commit's pseudo-version (it has no releases); bump.sh's dev-tools moves it, and TestBumpCoversPins covers it through mise.toml:tool:*. mise run nilaway runs scripts/nilaway.sh: devvm's own packages, not the tests or their helpers (stubtest, backendtest), compared with testdata/nilaway-baseline.txt, the findings triaged as false positives, each with its group (checked, bounds, mapkey, nilsafe), keyed by file and trace without line numbers, one line for each finding, compared as multisets. It exits 3 on a new finding, a key found more often than the baseline has it included, and 1 when nilaway can't run, when a finding in its output can't be read, or when a baseline line is stale or malformed. TestNilawayBaseline checks each case with a stand-in nilaway. CI's nilaway job is continue-on-error: it warns on new findings and lists the new and stale ones, then every finding, in the run's summary, failing when the script exits 1. The first run reported 83 findings, 69 without the test helpers. Two were real: - agentlogin.Restore sliced above[1:] for a settings file that is one JSON string holding a placeholder, where above is empty, and devvm agent save panicked. - agentlogin's readJSON returned a nil map, with no error, for a file that is null, which the Codex and opencode captures then wrote to. It now refuses it as not a JSON object. The other 67 are the baseline. Both fixes get a CHANGELOG Fixed entry. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c63f9a3340 |
fix(links): relays end with their link, their master or 30 s after their client closes
A relay's ssh (-W) ends only when the VM's sshd ends its channel, so a
VM that ignored EOF could keep a relay, its ssh process and one of its
owner's 256 slots:
- A link's removal closed only its listener, so its open connections
went on until the target's master or the session ended. The same held
for connections through a target master replaced when the target
started again, and for a link whose address and port named another
target at the next sync.
- While a forward or a link lasted, a relay whose client had closed its
side stayed for as long as the VM liked.
Each relay now gets its own context, which a link's removal, its
master's replacement or end, and its target's change cancel, as a
forward's close already did (
|
||
|
|
940f1e2d88 |
chore(scripts): bump.sh moves every pin in the repo, and a guard for new ones
scripts/bump.sh now covers every pinned version, so release prep is one command, grouped as --check prints them: - shared-tools: cursor (only when named), Cursor's CLI pinned in assets/shared-tools/mise.toml, checksums computed from the downloads - e2e: e2e-curl, tests/e2e/transparent_test.go's curlImage by digest - go: go (newest patch: go.mod, docs/go.mod, mise.toml, mise lock), go-minor (only when named), go-mods (direct modules, go get and go mod tidy; a next major's path only reported), deadcode (mise.toml's task) - dev-tools: mise.toml's tools but go, through mise lock - ci: ci-mise (jdx/mise-action's version follows base's mise), actions (uses: by tag commit from gh api, then actionlint and zizmor) - docs: hextra (go get and hugo mod tidy in docs/), mermaid (only when named) --check prints each pin's group and whether a bump is a patch, minor or major. With no tools named, bump.sh applies patches and minors only: never a major, a held pin or a named-only tool; naming an images or e2e tool still applies its major, and e2e-tools always does. Holds come from .github/dependabot.yml's ignore list (pflag < 1.1.0) and bump.sh's own (node on its major). The header lists every pin as "# pin KEY TOOL", or "-" and a reason, and says why the pins outside the scanned files are left (install.sh's Lima, the Homebrew formula, testdata, vendored files). TestBumpCoversPins in internal/structure scans assets/, mise.toml, both go.mod files, the workflows, tests/e2e-mise.lock, tests/e2e's consts and docs/hugo.yaml offline, and fails on an uncovered pin or a stale line. The Pins workflow gets mise and a token for the new checks, and its issue lists outdated pins under their groups. testdata/script/bump.txtar covers the new groups with stubbed upstreams, and caught newest_of failing on an empty list. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6c36850251 |
feat(cursor): devvm cursor opens this folder's VM in the Cursor editor
devvm cursor is devvm code's twin for Cursor, the editor. It gets the folder's VM ready as devvm host does, then runs `cursor --remote ssh-remote+HOST DIR` in devvm's place, with the SSH agent devvm started with. Without `cursor` on PATH it fails with no_cursor_command, naming the host to connect to. Cursor's Agent and your sign-in (from CJ's manual check with a real login): recent Cursor runs Agent in the editor's server in the VM, which holds your Cursor sign-in in memory only (no token on disk, in any environment or command line) and calls Cursor from the VM. Cursor's `cursorAgentHost.remoteInferenceRoute` is application-scoped, so it's read only from the user settings on this machine; with it set to "always", Agent's own requests go through the Cursor app here, while the VM's server still talks to Cursor. - vm: Code and Cursor share openRemote; vm.CursorCommand names the editor's command, apart from the CLI agent's agents.Cursor. After LookPath finds `cursor`, devvm reads Cursor's user settings on this machine (platform.AppSettingsDir: Application Support on macOS, $XDG_CONFIG_HOME or ~/.config on Linux) through safefile.Read, 1 MiB at most, read-only, as JSON with comments, and warns with cursor_agent_in_vm unless the route is "always". It never fails on the file. - sync.sh: Cursor's ~/.cursor-server/data/Machine/settings.json gets VS Code's remote.autoForwardPorts, git.terminalAuthentication and github.gitAuthentication off, in one loop over both editors' files. devvm doesn't write the route there, since Cursor ignores it. - structure: nameFree lets a literal that is an agent's name stand in one file, with its reason, and fails when it frees nothing. - cli: cursor.go (--ssh-config, --here, --parent), registered beside code; cursor_failed, no_cursor_command, cursor_agent_in_vm and their doc links; ssh_host_info names Cursor too; the cli skill's judgment note: an editor's command is a bare verb named after the editor's. - Tests: host_code.txtar (cursor, its full-name host, the missing command, the warning and no warning once the route is set), guest.txtar, TestCursorAgentWarning (always, absent, other values, no file, broken JSON, too long, a FIFO, the XDG path; never written), e2e network: devvm cursor passes the editor only the host and folder, a fake editor sign-in on this machine reaches neither the VM's home, its processes' environments nor the proxy's logs, and a Cursor login in the store reaches the CLI's methods while the agent store's are refused. - Docs: SSH and editors (commands first; "Cursor's Agent": it runs in the VM with your sign-in, the user-settings line, what it doesn't cover, open only VMs you trust; if Tab doesn't work on the allowlist tier, devvm network allow api3.cursor.sh), the agents page's Cursor notes, Commands, attack vectors, design, the home page, CHANGELOG, generated CLI pages. Reviewed adversarially before the push: the settings read (size, FIFOs, links), the warning's wording and when it fires. Researched with PR #44's design as reference only. Co-authored-by: JB <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8da71a01bb |
refactor(from): --from's registries judged by proxy.Public
internal/from had its own copy of the internet-address judge (publicAddr, nonPublic) with a shorter table than the proxy's: no NAT64 or 6to4 decoding and none of IPv6's special ranges, so a registry at 64:ff9b::10.0.0.1 or fec0::1 passed it. - publicOnly and publicHost ask proxy.Public; publicAddr and nonPublic go. internal/proxy is the standard library only, so from may import it. - forbidigo refuses netip.Addr.IsPrivate outside internal/proxy, as a second judge would drift; testdata/lint breaks it once, and the owners' table in Contributing's structure page names proxy.Public. - TestPublicAddr checks publicHost and publicOnly, with NAT64, 6to4, site-local and documentation rows. - A CHANGELOG Fixed entry. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
99f57d4003 |
fix(proxy): 6to4 judged by its IPv4 address, and more special ranges internal
A 6to4 address (2002::/16) passed the floor as public even when the IPv4 address in it was private, and Teredo, IPv6's documentation, discard-only, benchmarking, ORCHID, SRv6 and IPv4-translated ranges, and IPv4's documentation ranges and 192.88.99.0/24, counted as the internet. - withIPv4 (was nat64): the IPv6 ranges that carry an IPv4 address, NAT64's and 6to4's, each with its site's prefix length (6to4's /48); embeddedIPv4 (was nat64IPv4) reads either. - hostAddrs.internal: the host's own address first, then the 6to4 site of any of its own addresses (its LAN's), then the embedded IPv4 address; hostAddrs.own, the address map, replaces has. - rule.matchAddr: a 6to4 address matches as its IPv4 address for a deny alone, as 6to4 goes through relays anyone may run; NAT64 still matches for both. - notPublic gains 2001::/32, 2001:db8::/32, 3fff::/20, 100::/64, 2001:2::/48, 2001:10::/28, 2001:20::/28, 5f00::/16, ::ffff:0:0:0/96, 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 192.88.99.0/24. - Tests: TestInternal's rows, TestInternalOwn6to4, TestSixToFourAllowsNot, TestResolveSixToFourName, a 6to4 deny in TestAddressDenyAppliesToNames; the learning tests' public address is 93.184.215.14 now, as 203.0.113.5 is documentation's. - The structure test's table name, the proxy's README, network.md's range list (with Teredo under a broad IPv6 allow), attack-vectors and safety/network, and a CHANGELOG Fixed entry. 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]> |
||
|
|
52bb0f467b |
feat(clone): a --clone VM gets the repo as it is here
A --clone VM's clone is now seeded with a snapshot, not git push, and gets everything a working copy has. devvm clone fetch brings it all back, and devvm rm and clone off check it before deleting. - Refs: every branch, tag and notes ref, and a detached HEAD. - Uncommitted changes: staged, unstaged and untracked files; files skip-worktree by hand get the index's version, named. - Operations in progress (merge, rebase, cherry-pick, revert, bisect) and the stash; a stash's untracked part goes as its own branch. - The repo's settings and hooks, sent as settings only where they live in the repo (husky); ORIG_HEAD never goes. - Partial clones, with their promisor remote, and messages per network tier when it can't be reached. - Initialised submodules, nested ones too, each with a clone of its own; a submodule's own folder is refused as a top-level --clone. vm.json gains an optional `submodules` field. - Git LFS both ways: objects hash-checked, written under os.Root with no link followed, a question past 2 GiB; the filter is set only in the clone's repos; git-lfs 3.8.1 in base, pinned by SHA-256. - rm and clone off keep the VM when anything the VM has didn't come back, and name it. - Every shell script embedded in Go is shellchecked. - clone.md is a guide that leads with commands; TestUserPageProse covers it and coding-agents.md. After you upgrade: base and every image on it build again once, for git-lfs. Fixes #40, reported by @Josuesp1620. Thanks to @dhruv1220 for #42, which found the cause (receive-pack refusing a shallow push); its receive.shallowUpdate setting stays in the VM's repos. Co-authored-by: Dhruv Arora <[email protected]> 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]> |
||
|
|
2b49967b4e |
chore: CI time zones, test isolation from the repo, a flaky test and the agents page (#45)
Upkeep: CI, flaky tests, dead code and the coding agents page. - test: tests never run git on the repo they're run from. A git that runs the tests (a hook, git rebase --exec) sets GIT_DIR and friends, and the tests' plain git followed them into the real repo's config. Every test's git now runs through internal/stubtest (Git, GitEnv, NoGitRepo), the structure test enforces it, and the whole suite passes with GIT_DIR pointing at a decoy repo that stays untouched. - ci: two test jobs instead of three: Linux in America/Los_Angeles (DST) and macOS in UTC, with lint on both, since golangci-lint checks only the runner's OS's files. - test(e2e): accept Codex 0.167's wording for an API-key login. - test: internal/safefile's swap-after-look branch is tested on purpose through a seam, so its coverage no longer depends on a race (97.7% every run). - test(fetch): TestRetryUnanswered's "no answer" comes from a listener that keeps its port, so a parallel test's server can no longer take the freed port and answer in its place (Linux reuses ports at once). - refactor(proxy): the test-only policy.decide and policy.byRequest move to the tests; the proxy already judges a host from one read of the rules (rulesFor). - docs(agents): "Pasting images" moves down the coding agents page, before History, and its run of paragraphs becomes commands and lists, every fact and anchor kept. Gate and coverage pass on each commit; e2e `network` and `project` pass on Linux (251 passed, 4 macOS-only skips). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> |