Files
devvm/testdata/script/ls.txtar
T
w3cjandClaude Opus 5.5 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]>
2026-11-03 11:34:05 -07:00

100 lines
4.1 KiB
Plaintext

# ls: project VMs on every backend, by name, with their status, image,
# shared tools, .git protection, network policy, backend and folder. Images and build
# VMs aren't listed; a project VM named like an image is.
# No VMs: the header alone, and nothing is asked of a backend but its list.
exec devvm ls
cmp stdout header.txt
! stderr .
stub_calls
stdout '^limactl list --json\n\z'
# A folder named img-foo gives a VM named like an image: listed, while
# the image it was made from isn't. No network policy: off.
project img-foo
exec devvm --no-network-policy --no-git-protect
exec devvm ls
stdout '^NAME +STATUS +IMAGE +TOOLS +GIT +NET +LINKS +BACKEND +FOLDER\n'
stdout '^devvm-img-foo-[0-9a-f]{14} +Running +base +- +off +off +- +lima +/\S*/img-foo\n\z'
! stdout '^devvm-img-[0-9a-f]{12} '
# Network policy: on while it runs on the hostagent devvm started (here
# the test's runner, which runs on); started some other way since, or a
# failed self-check, unenforced. Stopped, it starts confined next time.
project net
exec devvm --network-policy --no-git-protect
vm_name NET net
exec sh -c 'echo $PPID > "$LIMA_HOME/$NET/ha.pid"; echo "$PPID 1" > "$NET_dir/run/started"'
exec devvm ls
stdout '^devvm-net-[0-9a-f]{14} +Running +base +- +off +on +- +lima '
# (The exit keeps limactl start sh's child, so its hostagent is sh, soon
# gone: bash 5.2 and newer as sh, Fedora's, runs a last command in sh's
# place, which would make the runner, which lasts, its hostagent.)
exec sh -c 'limactl stop "$NET" && limactl start --tty=false "$NET"; exit $?'
exec devvm ls
stdout '^devvm-net-[0-9a-f]{14} +Running +base +- +off +unenforced +- +lima '
exec limactl stop $NET
exec devvm ls
stdout '^devvm-net-[0-9a-f]{14} +Stopped +base +- +off +on +- +lima '
exec sh -c '{ grep -v ^net_check= "$NET_dir/state"; echo net_check=unenforced; } > "$WORK/st" && mv "$WORK/st" "$NET_dir/state"'
exec devvm ls
stdout '^devvm-net-[0-9a-f]{14} +Stopped +base +- +off +unenforced +- +lima '
# A --clone VM shows clone in GIT, a base from a container image its
# label, and a VM whose creation didn't finish - for what it lacks.
mkdir $VMS/0123456789ab01 $VMS/0123456789ab02
cp $WORK/clone.state $VMS/0123456789ab01/state
cp $WORK/from.state $VMS/0123456789ab02/state
exec sh -c 'printf "devvm-cl-0123456789ab01\ndevvm-from-0123456789ab02 Running\ndevvm-half-0123456789ab03\ndevvm-tools-build\n" >> "$STUB_DIR/instances"'
exec devvm ls
stdout '^devvm-cl-0123456789ab01 +Stopped +base +node,claude +clone +on +- +lima +/p/cl\n'
stdout '^devvm-from-0123456789ab02 +Running +image_from from=node:24 image=base +- +on +off +- +lima +/p/from\n'
stdout '^devvm-half-0123456789ab03 +Stopped +- +- +- +- +- +lima +-\n'
! stdout devvm-tools-build
# Sorted by name.
stdout '\ndevvm-cl-.*\ndevvm-from-.*\ndevvm-half-.*\ndevvm-img-foo-.*\ndevvm-net-'
# --json: the same, the image and what its base started from apart, ""
# for what a VM lacks, and nothing else on stdout.
exec devvm ls --json
stdout '^{\n "version": 1,\n "vms": \[\n'
stdout '^ "name": "devvm-cl-0123456789ab01",\n "status": "Stopped",\n "image": "base",\n "tools": \[\n "node",\n "claude"\n \],\n'
stdout '^ "name": "devvm-from-0123456789ab02",\n "status": "Running",\n "image": "base",\n "tools": \[\],\n "from": "node:24",\n "git": "on",\n "net": "off",\n "backend": "lima",\n "folder": "/p/from",\n "links": 0\n'
stdout '^ "name": "devvm-half-0123456789ab03",\n "status": "Stopped",\n "image": "",\n "tools": \[\],\n "git": "",\n'
! stdout '^NAME'
# Lima can't list (not installed): fails, as a VM's state names it; with
# none, the header alone.
env PATH=$DEVVM_BIN
! exec devvm ls
! stdout .
stderr '^devvm: lima_missing$'
rm $VMS
exec devvm ls
cmp stdout $WORK/header.txt
exec devvm ls --json
cmp stdout $WORK/none.json
-- none.json --
{
"version": 1,
"vms": []
}
-- header.txt --
NAME STATUS IMAGE TOOLS GIT NET LINKS BACKEND FOLDER
-- clone.state --
name=devvm-cl-0123456789ab01
image=base
tool_names=node claude
dir=/p/cl
backend=lima
net=on
mode=clone
-- from.state --
name=devvm-from-0123456789ab02
image=base
dir=/p/from
from=node:24
backend=lima
net=off
git_protect=on