mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
18
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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]> |
||
|
|
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]> |
||
|
|
02ba74e614 |
build(lint): stricter linters, and the fixes they need
golangci-lint now also runs govet's nilness, unusedwrite, hostport and waitgroup analyzers, nilnesserr, durationcheck, canonicalheader, errchkjson, forcetypeassert, contextcheck and gochecksumtype. - errchkjson checks each JSON encoding's error where the value could fail and drops it where errchkjson proves it can't, and reports structs without exported fields; tests may drop theirs. - forcetypeassert holds the code; tests are exempt. - gochecksumtype: agentlogin's format is a sum type (//sumtype:decl), and a switch on one names every case, default or not. - canonicalheader: WWW-Authenticate, X-Request-ID, X-Api-Key. - contextcheck: ctx threaded through carry, peekClientHello and sniOf, and through inject and value, whose cached lookup takes WithTimeout(WithoutCancel(ctx)), so two forbidigo nolints go; openTransparent takes its dialer's ctx. nolints stay where contextcheck can't follow: ReverseProxy's Rewrite, WithoutCancel alone, cobra's cmd.Context, e2e's runner window. - No-behaviour fixes: scrubList for redact's list, the loopback forward's ports kept with its listeners, upgradetest's Key keeps its public key, a CA's leaves read through leafOf. Contributing's Go lint rules lists each one and the sum-type convention. 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]> |
||
|
|
8d44175601 |
refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7bdaf8e99e |
refactor: one Reporter for every package's messages and prompts
msg.Reporter is what every package below cli prints and asks through: Info, Say, Note, Warn, Status, Ask, Confirm, Answer, the terminal checks and CanPick, the run log (LogNote, LogWriter, LoggedCmd, WithSteps), Stdout, Stderr, AddCleanup and Interrupted, under the UI's signatures. *ui.UI implements it (a compile-time check in ui), and msg.Fake is the tests': quiet as its zero value, its On funcs and fields record and answer. The six UI interfaces (tools, netpolicy, lima, registry, sshagent, vm) are gone, and the copied output and prompt func fields of tools.Env, tools.Making, gitprotect.Protector, secrets.Store, netpolicy.Proxy, from.Lookup, backend.Review, lima.Lima, sshagent.Agent, vm.Env, vm.SizeChoice, vm.AgentsChoice, vm.LayersChoice, vm.NetworkChoice, vmssh.Forwards, build.Env and sshconfig.Config: each embeds the Reporter. Lima's and the shared tools' Warn, which says where the run log is too, is a method of their own over it; vm's interactive check is a function over it. The pickers (build.Env.Pick, vm.Env's PickFeatures and PickParts, the choices' Pick) and vm.Env.CanAsk stay fields: they carry types of their own or cli's answer. The test UIs of tools, netpolicy, lima, registry, build and vm become msg.Fake. Coverage baselines raised: internal/backend/lima, internal/msg, internal/tools. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ed70aeae3b |
feat(netpolicy): config.toml's company proxy reaches devvm's own downloads and builds' checks, and VMs without policy warn
config.toml's [proxy] covers the places it missed: - devvm's own requests on this machine (the download of its mise, Ubuntu's cloud image listing, --from's registries) go through it when the environment sets no proxy. settings.CompanyProxy.Route is their transport's proxy: at the first request it looks up the proxy secret, puts it in each URL that names a user, and routes each request as a VM's proxy does (proxy.Upstream.WithPassword, proxy.Upstream.Route, reusing the proxy's NO_PROXY matching). A missing password fails the request with fetch.ErrProxy, which isn't retried; HostMise shows its message. - The mise devvm runs on this machine gets HTTPS_PROXY, HTTP_PROXY and NO_PROXY in its environment (settings.CompanyProxy.Env), with the password in the URL, as mise takes it nowhere else; never in its arguments or a file. With the environment's proxy it adds nothing. - devvm build, rebuild, the remakes' builds and tool builds check the company proxy and its saved password before anything starts (build.Builds' checkProxy, tools.Share.Build), through the one check a new VM and a VM's proxy use: settings.CompanyProxy.Upstream, which netpolicy.Proxy.Upstream now calls. secrets.Store.ProxyPassword owns the proxy_password_missing mapping. - A VM without network policy never gets config.toml's proxy, as the guest would need the password, which never leaves this machine; each start of one while config.toml is the only proxy warns (proxy_needs_policy), naming devvm network on or the shell's HTTPS_PROXY, with a doc link. Wiring: tools.Env.Proxy (its Password set by cli and vm from devvm's secrets), from.NewLookup/NewRegistry/NewPublicRegistry take the proxy, lima.New and registry.New take a *settings.CompanyProxy for Ubuntu's listing. internal/fetch stays standard library only. - Tests: TestUpstreamWithPassword, TestUpstreamRoute, TestUpstreamRouteAuthorizes, TestCompanyProxy, TestCompanyProxyPasswordMissing, TestProxyPassword, TestHostMiseThroughCompanyProxy, TestMiseCmdCompanyProxy, TestBuildChecksCompanyProxy (tools and build), TestRegistryThroughProxy, TestUbuntuThroughCompanyProxy, TestTransient's ErrProxy, and company_proxy.txtar's build, rebuild and no-policy cases. - Docs: network policy's Behind a company proxy and Without network policy, config.toml's [proxy], How it works' Through a company proxy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4fd373439 |
refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend, Caps, Features, Review/Require, the registry, backendtest.Fake), so another backend is an addition. State from a smolvm VM reads as an unknown backend (backend_unknown_vm, gc_orphans_unknown); nothing migrates it. The image keys of layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images rebuild once. Lima's port forwarder moves off smolvm's files first: newForwarderCmd and forwarderMain from internal/cli/smolvmports.go to limaports.go, and assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder at run time, so no image key changes). Removed: - internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its registry entry, registry.Experimental and backend_experimental. - The decider: backend.Decider/UsesDecider, Confinement.Decider and DeciderToken, internal/proxy/decider.go and its test, the proxy's -decider, -decider-to and -decider-token-file, netpolicy's KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in vm's forwarding and UsedPorts. - backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and agent_unchosen_stop. - vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped). - paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing called (a test helper now). - ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and bump.sh's ubuntu_image, with its part of bump.txtar. - assets/smolvm/ and assets/container/; the no-init-system branches of layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in features/desktop.sh and guest/ca.sh. - Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh, creating_from_image, packing_image, pack_failed, backend_experimental, agent_unchosen_stop; descriptions naming smolvm reworded. - Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a failing or hanging Lima listing instead (the limactl stub's list-fails and list-hangs); the --backend smolvm examples; e2e's --backend smolvm and its section (about 1,130 lines), the smol_* helpers and the link section's backend switch. - Coverage: internal/backend/smolvm's lines in both baselines. - Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm notes (Ports on Lima now holds the forwarder's description), the backends table's smolvm column, every page naming smolvm, the README, the home page's backends art, and AGENTS.md's smolvm rows and gotchas (and the Docker bind-mount gotcha, which nothing refers to). Kept: the docker layer, on Lima; --from's local Docker; --backend, the BACKEND column and setup's backend choice, which the next commit removes. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
299ddb1476 |
refactor(state): image records in images/<key>/, rebuild counters per backend and --from, tool image records, cache/
- Image records are images/<key>/record.json (JSON, unknown fields ignored; name, chain, from, digest, libc, built). state.Images lists the folders; AnyImage needs a record.json; RemoveImage deletes the folder. Lima's cache cleaner reads records through state.Images. - Rebuild counters are images/rebuilds.json, keyed by (backend, from as given, name), changed under images/locks/rebuilds. image.Inputs takes them through an image.Rebuilds interface. A rebuild on one backend no longer outdates the others' images, and two --from references that wrote the same counter name (node:24, node-24) stay apart. paths.RebuildFile, RebuildName and unsafeName are gone. - Tool images: <file>.sha256, .target and .idle become one <file>.json (sha256, libc, format, backend, built, idle_since; state.ToolImage). BACKEND and LIBC read the record; the fallbacks (format matching, a VM's target, the current target) go, with toolTargets, vmToolTargets, formatBackend and gc's backendTools (toolsOn does it). Share.IdleFor owns reading idle_since. - cache/ (Dirs.Cache) holds mise/, nix-cache/ and from-digests.json. With the cache gone, from.Recorded takes the newest base record's digest for the reference, so no key changes. - Key check: the rebuild counter is the one input that moved and changes keys (deliberately: per backend and exact from). The --from digest moved to cache/ and stays an input, kept stable by the records' fallback. Records, mise and the Nix cache are outputs. - Tests: state's image, rebuild, digest and tool record tests; image key cases per backend and exact from; build.TestRebuildIsPerBackend; from.TestRecordedWithoutTheCache; cli.TestToolsOn; rebuild.txtar (Docker's and smolvm's rebuilds keep Lima's and the other --from's bases), gc_caches.txtar and from.txtar (a missing cache/); the testscript command json_set; e2e reads the JSON records. - Docs: space, images, settings (retention), internals images, overview, network, security, contributing (json_set). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
da93384f60 |
fix(lint): fetch.Client is its own type, and forbidigo bans http.Transport, os.Create and O_TRUNC
fetch.Client was an alias of http.Client, so &fetch.Client{} got past
NewClient's timeout and HTTPSOnly. It is now a struct only NewClient fills:
Do sends with the client's policy, Transport returns its own transport for
callers to change (ubuntu's file://, the public registry's dialer), and any
other Client fails every request with ErrNoClient, which isn't transient.
forbidigo's HTTP rule also bans http.Transport, and http.Client's Transport
field, outside fetch, the proxy and tests.
The os.WriteFile rule also bans os.Create and os.O_TRUNC, so a
truncate-in-place write outside state needs a nolint saying why. The four
left are not files written whole from memory, or are the standard library
only: tools' check log and a link session's log (a process writes them as
it runs), fetch.Download's file (streamed, removed on failure) and
daemon's pid and status files (one write, which readLine and readStatus
take as missing until its line ends). state's doc says so.
Tests: TestClientMadeByNewClient (nil and zero Clients send nothing and
aren't retried; NewClient's transport is its own); from's and build's
tests use the registry's own client trusting the TLS test server.
Fixture lines: http.Transport, os.Create, os.O_TRUNC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
b4402a74e8 |
refactor: every HTTP client through internal/fetch
internal/fetch (standard library only) owns how devvm reaches the web: NewClient(timeout, HTTPSOnly|SameScheme) on a clone of net/http's default transport, the Client alias other packages name, Retry and Transient/TransientStatus (no answer, 408, 429, 5xx; never a refused redirect, a bad request, a body over its cap or a SHA-256 mismatch), ReadCapped, Open, Get, and Download, which keeps a file only when its SHA-256 matches and leaves nothing on any failure. - from: NewRegistry uses fetch.NewClient(HTTPSOnly); its own NewClient, httpsOnly, errRedirect and transient go; the token GET is fetch.Get; retry wraps fetch.Retry, keeping ErrNotFound and ErrUnreachable. - ubuntu: NewClient is fetch.NewClient(SameScheme) with file:// registered; sameScheme and errRedirect go; fetch is fetch.Retry over fetch.Get. - tools: mise's client is fetch.NewClient(HTTPSOnly); its download is fetch.Download, which checks the pin before the file is kept. - docker: devvm's Linux build is fetched with a client of its own (HTTPS-only redirects, a Client seam on linuxFinder) instead of http.DefaultClient, and retried twice on a failure that may pass or an archive cut short; an archive without a devvm (errArchive) isn't. forbidigo bans http.Client, DefaultClient, DefaultTransport, Get, Head, Post and PostForm outside internal/fetch, internal/proxy and tests; its line in testdata/lint/forbidigo.go fires. internal/fetch is a leaf in the structure test's layers. Tests: fetch's TestRetry, TestRetryUnanswered, TestRetryCanceled, TestTransient, TestRedirects, TestReadCapped, TestDownload; first, characterising the callers, from's TestDigestRetries and tools' TestHostMiseRedirect; docker's TestFetchLinuxRetries. Coverage baselines: fetch 95.2 (new), from 87.1 to 91.3, ubuntu 88.7 to 92.5, tools 87.9 to 88.6, docker 80.8 to 81.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
82566e9010 |
refactor: shell quoting, the VM-name grammar and value patterns each in one place
internal/shell, a stdlib leaf: Quote, QuoteJoin and EnvName. They
replace the 4 shell quoters (lima's shq and shqJoin, docker's shq, vm's
and devcontainer's shellQuote) and the 4 variable-name regexes (docker's
envKey, vmssh's envName, vm's envVarName, devcontainer's envName).
lima's quoting tests move there as TestQuote and FuzzQuote.
internal/vmname, a stdlib leaf below project: Prefix, HashLen, IsVM and
SlugOf. project's vmName regex, IsVM and Prefix go (callers use vmname),
lima's projectVM, docker's hostname parsing and cli's export-name regex
use it. TestImageKey (lima) pinned imageKey before the change;
TestParseExportName covers the export names.
Value patterns exported once: from.IsDigest (lima's idPattern),
image.IsKey (build's keyLike and the keyPattern copies in lima, docker
and smolvm), image.ToolVersion (tools' versionLike) and image.ToolName,
with TestIsDigest and TestValuePatterns. state's featureName stays:
internal/state may not import internal/image.
netpolicy.PolicyFiles names a user layer's policy file only for a part
image.LayerName takes, so an image-name part such as ../x never names a
file outside the user's layers; TestPolicyFiles's ../x cases failed
without the check.
The structure test's owners check gets literals: a non-test string
literal holding '\'' outside internal/shell, or [0-9a-f]{14} outside
internal/vmname, fails, naming the owner. TestRulesFail has cases that
break and keep both. shell and vmname join the leaves' layer, and
devcontainer may import shell. Coverage baselines: shell and vmname
added at 100.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
1cfc8e24f1 |
test: share the stubs sandbox, message checks and recorders across Go tests
internal/stubtest puts testdata/stubs first on PATH with a folder of its own (New, New with only some stubs), reads and writes the stubs' files (Calls, Reset, Touch, Write, Read, Path, Log) and has one ExecRunner. It replaces the stub setups of the Lima, Docker and smolvm backends' tests, vm's --clone tests and platform's Keychain tests, and the backends' own execRunner, reset and touch copies. The structure test holds it to tests and to importing only internal/msg. msg.IDOf and msg.NamesOf replace the names(), isMsg, id and shown helpers and the errors.AsType checks that only read a message's ID or names; msg.Recorder replaces the inline recorders tests set as Info, Warn or Say. backendtest.Stored replaces the four stored fakes with disks. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7929eafaf5 |
fix(msg): every message value renders without control characters
A value a VM made reached the terminal unfiltered wherever a caller forgot msg.Shown, such as the errors passed as err.Error() and a link's name. Four cleaners did the job in different ways: msg.Shown (quoting), ui's printable and oneLine, netpolicy's oneLine and the port forwarder's log (which let C1 through, in UTF-8). msg.Printable and msg.OneLine are now the one cleaner: they drop C0 but newline and tab (OneLine drops those too), DEL and C1, in UTF-8 or as a lone byte. Every message value goes through OneLine as the message renders, in Text, Segments and names mode, so no caller can forget it, and msg.Shown is gone with its 68 calls. The status line, the run log's end and verbose output, Pick, devvm network log, the forwarder's log and a clone's status lines use them too. Tests: TestPrintable and TestValuesArePrintable (internal/msg), the hostile-value segments test, TestLogLimit (internal/backend/vmssh) with C1 in UTF-8 and as a lone byte; TestCheckLinks and TestNewVMOtherRepoAndCommondir expect the cleaned values. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3da0d6b0a6 |
feat(devcontainer): a project's devcontainer.json as input for new VMs
A new VM gets what the folder's .devcontainer/devcontainer.json (or .devcontainer.json) says, on every backend: image as --from (only an image its registry gives anyone, asked anonymously, pinned to that digest, never a registry on this machine or its network), features devvm has layers for (docker-in-docker as the docker layer, node, python, rust, go), forwardPorts as far as the user's ports allow, containerEnv and remoteEnv in the VM's environment, onCreate/updateContent/postCreate commands once and postStartCommand at each start, in the VM as its user. --no-devcontainer skips it; the command line wins. Later launches only warn when the file changed.
Nothing from it runs on or reaches the host: initializeCommand never runs, ${localEnv} and the host-folder variables are refused, builds, Compose and docker-outside-of-docker are refused, mounts, runArgs and privileged ignored. The file is read through os.Root, without blocking, at most 1 MiB. A docker layer only the file asks for still asks about network policy on Docker.
Reviewed with the security-audit skill (FuzzParse, design note); e2e: project 69/0, docker linux 135/0, smolvm 131/0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
4bbd35a24b |
refactor(ui): make the UI an instance only cli holds
internal/ui has no package state: ui.UI holds the streams, terminal flags, run log, status line, cleanup stack and interrupt flag, and its functions are methods. ui.Main makes the run's UI on devvm's own streams, owns signals, recovers Die and runs the cleanups; ui.New makes one on other streams. cmd/devvm passes it to cli.Execute, and every cli command gets it through its constructor. Only cmd/devvm and internal/cli import internal/ui (a depguard rule). Each other package defines the small UI interface it needs, which its constructor takes, filling fields tests set: - gitprotect.New, secrets.NewStore, from.NewLookup: a warn func - ubuntu.New: LoggedCmd, Note - netpolicy.NewProxy: Note, Warn, Ask, Confirm, StdinIsTerminal; its log lines drop control characters themselves (oneLine) - sshagent.New: Info, Note, Warn, LogWriter - tools.New: Info, Warn, LogNote, Status, LoggedCmd, AddCleanup - lima.New, smolvm.New: Info, Warn, LoggedCmd (their Runner's Run), WithSteps, AddCleanup, Interrupted; lima LogNote and ubuntu's too - backends.Registry: lima's and smolvm's - vm.NewEnv: all of the above, Say, Stdout, Stderr; Env has Stdout, LogNote, LogWriter, LoggedCmd, AddCleanup, Interrupted fields - build.Builder: Terminal and LogNote fields - sshconfig.New: its caller sets what it prints and asks ui's tests build their own UI over buffers and run in parallel; other packages' tests use small fakes; cli's unit tests a UI over buffers. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7fcac40758 |
refactor: test seams on structs, not package vars
Tests set fields; no test outside internal/proxy and internal/ui assigns a package var. - backend.Review: Unreviewed and Warn, with Require and Allowed as its methods; Registry embeds it, set by backends.Registry (a test build reads DEVVM_UNREVIEWED); build.Builder.Review, sshconfig.Config.Review, and Tools.Build takes the review with the backend - netpolicy.Log: Path and Tick (NewLog), with Write and WriteBlocked; Proxy.Terminal for Choose and SelfCheck - vm.Env.Terminal, sshconfig.Config.Terminal - cli: setup's terminal check and backend picker are fields of setup; versionOf takes the release's version - from.Registry.RetryDelay, ubuntu.Finder.RetryDelay, lima.Lima.OCIWait - msg's tests use real messages, not entries added to docs and specs The tests these free run in parallel. AGENTS.md: test seams are fields; internal/proxy's globals and internal/ui's process-wide state are the exceptions. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
0aec2ece89 |
feat(from): base images from Docker and OCI images
--from IMAGE (default $DEVVM_FROM) starts base from a Debian-, Ubuntu- or Alpine-based container image instead of Ubuntu's cloud image, for new VMs, build and rebuild. base is keyed by the image's digest, looked up once per build and recorded per reference; existing VMs keep their own (from_ignored). - internal/from: ParseRef (registry_ref, with a fuzz target), Valid/ Check (bad_from), Pinned, Name, Recorded (from_digest), Registry.Digest (manifest HEAD, anonymous Bearer token from an https realm only, timeouts, size caps, retries; ErrUnreachable/ErrNotFound), Lookup.Refresh (refresh_from_digest: registry, else Docker's ID, else the recorded digest with a warning), DockerID, DockerRunning. - build.Builder: From and Lookup; Inputs/Key/Chain with the recorded digest; spec.From for base; records keep from and digest on every image above a --from base; rebuild counters per from; building_image_from. - lima: convert (oci_base): devvm-oci-build from Ubuntu's image with only <tmp>/vm (rw) and oci/ (ro) mounted, confined to the internet, runs oci/build.sh; docker save plus exportIs for images only Docker has; checkConverted (regular files, gnu/musl, cmdline charset, raw ext4); base created with --set .images (disk, kernel, cmdline, initrd); the temp folder, build VM and the OCI build lock (lockOCI, pid, stale takeover, oci_waiting) go however the run ends. - cli/vm: global --from flag, state from=, builders with the VM's from in open, update, remove. - Messages: building_image_from, bad_from, from_ignored, from_unreachable, from_not_found, from_cached_unreachable, from_cached_not_found, no_digest, docker_only, exporting_docker, docker_export_failed, docker_image_changed, oci_waiting, converting_in_vm, converting, convert_failed, convert_bad_output; doc links to from.md. - Copied: oci/ (build.sh and README edited: comment, docs link), testdata/stubs/docker; limactl stub gains oci/build.sh outputs and interrupt-on. - Converted: from.bats (registry_ref, registry_digest token, 1/2, https realm, refresh per tag, Docker-only, offline, no Docker, pinned, moved tag, cached keys, build flow, docker save, Ctrl+C, steps, failures, bad outputs, record, export check, lock) as Go tests and from.txtar; oci.bats (libc_for, missing architecture, crane pins) as oci.txtar; cli.bats --from parse_args and project.bats --from input checks. - e2e: from section (--from tier, or --only from): node:24 Debian 12 node+python+claude, alpine:3 musl tools and Docker on OpenRC, base from ubuntu:26.04, no Docker needed. Left out: features, an image only Docker has. - Docs: from.md; images, commands, lima, contributing, index; CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |