Files
devvm/testdata/stubs/ssh
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

42 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Stand-in for ssh in tests: host git pushing to and fetching from a --clone
# VM. Logs every call to $STUB_LOG, and runs the git command it's given
# here, on $STUB_DIR/vmfs/DIR (the VM's files, as the limactl stub keeps
# them). With $STUB_DIR/ssh-fails, or for anything else, it fails as ssh
# does. A master connection (-M, a VM's port forwarder's) reads the script it's fed, answers it with $STUB_DIR/guest-ports (what listens in the VM, as /proc/net/tcp has
# it) and ".", then waits to be stopped. A link session's master (-M -N -S CONTROL, devvm _links's)
# listens on its control socket until it's stopped, and its -O forward and -O cancel work, but for a
# forward whose ADDRESS:PORT is a line of $STUB_DIR/link-taken, which the VM refuses.
set -euo pipefail
"${0%/*}/stub-log" "$STUB_LOG" ssh "$@"
[[ ! -e $STUB_DIR/ssh-fails ]] || exit 255
if [[ " $* " == *" -M "* && " $* " == *" -N "* ]]; then
ctl=
while (($#)); do [[ $1 != -S ]] || ctl=$2; shift; done
exec perl -MSocket -MIO::Socket::UNIX -e \
'my $s = IO::Socket::UNIX->new(Type => SOCK_STREAM(), Local => $ARGV[0], Listen => 1) or die "$!"; sleep 300' "$ctl"
fi
if [[ " $* " == *" -O "* ]]; then
fwd=
while (($#)); do [[ $1 != -R ]] || fwd=$2; shift; done
IFS=: read -r addr port _ <<< "$fwd"
if [[ -f $STUB_DIR/link-taken ]] && grep -qxF "$addr:$port" "$STUB_DIR/link-taken"; then
echo "Error: remote port forwarding failed for listen port $port" >&2
exit 255
fi
exit 0
fi
if [[ " $* " == *" -M "* ]]; then
cat > /dev/null
[[ ! -f $STUB_DIR/guest-ports ]] || cat "$STUB_DIR/guest-ports"
echo .
exec sleep 300
fi
cmd=${*: -1}
case $cmd in
"git-receive-pack "* | "git-upload-pack "*)
eval "set -- $cmd"
exec git "${1#git-}" "$STUB_DIR/vmfs$2" ;;
esac
exit 255