Files
devvm/testdata/script/setup.txtar
T
w3cjandClaude Opus 5.5 1917072228 refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the
default backend and smolvm stays experimental. The backend architecture
(Backend, Caps, Require, the registry, backendtest.Fake) stays, so
another backend is an addition.

Removed:
- internal/backend/docker, its registry entry and Names/Experimental's
  docker half; devvm _docker-connect and _docker-ports
  (internal/cli/dockerssh.go); assets/docker/unpack.sh.
- Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS,
  DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256
  ldflags vars and the CLI tests' Linux-build archive (linux_release).
- Interfaces only Docker implemented, with their callers:
  backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix),
  DiskUser (ls's and size's disk-over warning, size's disk_used and
  --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover
  (gc --orphans' volumes, networks, containers and images),
  DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and
  vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name.
- The docker layer's runtime on a backend that makes VMs for it:
  vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet
  returns a bool now), the refusals at start and devvm network on, ls's
  "(sysbox)" and --json docker_layer, size_disk_default_unused.
- The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix).
- paths.Dirs.Docker and paths.VM.Lifeline.
- assets/guest/tools.sh's linked-folder branch; services.sh's
  DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd.
- Messages: every docker_* the backend used, docker_layer_runtime,
  net_docker_layer, net_off_docker_layer, committing_image,
  pulling_image, unpacking_tools, disk_over, size_disk_default_unused,
  gc_orphan_volume/_network/_container/_image, docker_connect_failed;
  gc_orphan_elsewhere reworded.
- Tests: docker.txtar, the docker stub's engine (its --from half
  stays), the ssh stub's login-shell branch; e2e's --backend docker,
  --engine, the docker host VM and Docker Desktop runs.
- Release: one GoReleaser pass, no Linux-build pin in the macOS builds,
  no Linux devvm in the Homebrew formula's libexec. Linux builds stay.
- Docs: backends/docker.md and internals/docker.md, design.md's Docker
  notes, the Docker column of the feature table, and every page's
  mentions of the Docker backend, Docker Desktop as one, and Sysbox.

Kept: the docker layer in Lima VMs, devcontainer docker-in-docker,
--from with images only a local Docker has, Docker Hub references.

State written by a Docker VM before this reads as an unknown backend
(backend_unknown_vm).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00

152 lines
5.4 KiB
Plaintext

# setup: the default backend, base's features, and new VMs' size and
# network policy (all asked in a terminal, which Go tests cover; without
# one, the backend, size and network policy aren't asked and the features
# are kept, or every one until they're chosen; --backend and --features
# without asking), each saved in settings.json. A new choice of features
# says base rebuilds, and once images are built that devvm gc deletes the
# old ones.
env SAVED=$DATA/settings.json
# Kept: none chosen; no backend or size asked.
exec devvm setup
stdout '^==> base_features_none$'
! stdout base_will_rebuild
! stdout default_backend
! stdout 'size_question|size_defaults'
! grep '"backend"|"size"|"agents"' $SAVED
grep '^ "features": \[\]$' $SAVED
! stdout default_agents
! stderr .
! stub_calls
# Unchosen: every feature.
rm $SAVED
exec devvm setup
stdout '^==> base_features features=cli-tools fzf omb$'
! stdout base_will_rebuild
# --features, in the order features run; nothing built yet.
exec devvm setup --features omb,fzf
stdout '^==> base_features features=fzf omb$'
stdout '^==> base_will_rebuild$'
! stdout gc_old_hint
! stdout default_backend
grep '^ "features": \[\n "fzf",\n "omb"\n \]$' $SAVED
exec devvm setup --features fzf,omb
! stdout base_will_rebuild
# Built: a new choice rebuilds base, and gc deletes the old one.
exec devvm build base
exec devvm setup --features none
stdout '^==> base_features_none$'
stdout '^==> base_will_rebuild$'
stdout '^gc_old_hint$'
exec devvm build base
stdout '^==> building_image image=base key='
exec devvm gc --force
stdout '^gc_image image=base key='
# A name that isn't a feature changes nothing.
! exec devvm setup --features fzf,nope
stderr '^devvm: no_feature feature=nope features=cli-tools desktop fzf omb$'
! stdout base_features
exec devvm setup
stdout '^==> base_features_none$'
# The default backend: only it, unless --features is given too.
exec devvm setup --backend lima
stdout '^==> default_backend backend=lima$'
! stdout base_features
grep '^ "backend": "lima",$' $SAVED
exec devvm setup --backend lima --features fzf
stdout '^==> default_backend backend=lima$'
stdout '^==> base_features features=fzf$'
! exec devvm setup --backend nope
stderr '^devvm: backend_unknown backends=lima, smolvm name=nope$'
grep '^ "backend": "lima",$' $SAVED
# New VMs' size is devvm size -g's, and without a terminal nothing asks
# for it or for new VMs' network policy. Flags for a new VM are devvm
# [IMAGE]'s alone, so setup doesn't take them.
! exec devvm setup --cpus 2
stderr '^devvm: flag_unknown command=devvm setup flag=--cpus$'
! exec devvm setup --memory 8
stderr '^devvm: flag_unknown command=devvm setup flag=--memory$'
! grep '"size"|"network"' $SAVED
# --features none chooses none; --features '' is refused, and changes
# nothing.
exec devvm setup --features fzf
! exec devvm setup --features ''
stderr '^devvm: flag_blank flag=features$'
grep '^ "features": \[\n "fzf"\n \]$' $SAVED
exec devvm setup --features none
stdout '^==> base_features_none$'
grep '^ "features": \[\]$' $SAVED
# The network policy saved for new VMs: off makes one without it.
exec devvm network -g off
project off git
exec devvm --no-git-protect
vm_name OFF off
catg $OFF_dir/state
stdout '^net=off$'
cd $WORK
# --agents: the coding agents new VMs get, without asking; none for none.
# An agent that isn't one is a usage error, with a did-you-mean.
exec devvm setup --agents claude,codex
stdout '^==> default_agents agents=claude codex$'
grep '^ "agents": \[\n "claude",\n "codex"\n \]$' $SAVED
exec devvm setup --agents none
stdout '^==> default_agents_none$'
grep '^ "agents": \[\]$' $SAVED
! exec devvm setup --agents cladue
stderr '^devvm: unknown_part_like flag=--agents given=cladue like=claude$'
stderr '^usage_help command=devvm setup$'
! exec devvm setup --agents node
stderr '^devvm: part_other_flag flag=--agents given=node other=--tools$'
grep '^ "agents": \[\]$' $SAVED
# A new VM made without a terminal gets setup's agents, and says so.
exec devvm setup --agents codex
project agents git
exec devvm --no-network-policy --no-git-protect
stdout '^==> new_vm_gets layers=none tools=codex vm=devvm-agents-[0-9a-f]{14}$'
vm_name AGENTS agents
catg $AGENTS_dir/state
stdout '^tool_names=codex$'
cd $WORK
# What config.toml sets wins over settings.json, and devvm setup's flags
# can't change it: refused, naming the file and the key, with nothing
# saved.
cp config.toml $CFG/config.toml
! exec devvm setup --backend smolvm
stderr '^devvm: set_in_config file=\S*/config/devvm/config\.toml key=backend$'
! exec devvm setup --features omb
stderr '^devvm: set_in_config file=\S*/config/devvm/config\.toml key=features$'
! exec devvm setup --agents claude
stderr '^devvm: set_in_config file=\S*/config/devvm/config\.toml key=agents$'
grep '^ "backend": "lima",$' $SAVED
grep '^ "agents": \[\n "codex"\n \]$' $SAVED
# Without a terminal, setup keeps config.toml's features, saying so.
exec devvm setup
stdout '^==> setup_in_config file=\S*/config/devvm/config\.toml key=features$'
! stdout base_features
exec devvm doctor --json
stdout '"backend": "smolvm",\n "backend_source": "config.toml",'
rm $CFG/config.toml
# An unreadable choice stays for you to fix.
cp bad.json $SAVED
! exec devvm setup
stderr '^devvm: setup_failed reason=\S*/data/devvm/settings\.json: features: not a feature''s name: "Not_A_Feature"$'
cmp $SAVED bad.json
-- config.toml --
backend = "smolvm"
features = ["fzf"]
agents = ["opencode"]
-- bad.json --
{"features": ["Not_A_Feature"]}