Files
devvm/docs
w3cjandClaude Opus 5.5 bdc95ef6ee refactor(ports): port forwarding out of the backends, one owner in vmssh
The port forwarder is devvm's on every backend. vmssh (moved out of
internal/backend) holds it, the link sessions, and its one owner,
vmssh.Forwards: the lock, stop and start of a VM's forwarder, which
ports it forwards read from vm.json (ports.Forwarding) each time, the
listed ports a host program has left out (ports_taken), the host key
devvm pins, and the backend's new ForwardTarget (user, key, host
loopback port) and Lifeline. One hidden command, devvm _ports
(cli/forwarder.go, vmssh.Main), replaces _lima-ports.

The backend no longer forwards: SetPorts, Want.Ports, Confinement.Free,
Confinement.HostKey and Confinement.Forwarded go; Lima keeps its own
forwards off and gives ForwardTarget (Lima's ssh port on 127.0.0.1,
Lima's user, _config/user). Lima's Stop and Delete no longer touch the
forwarder, and Lima's Forget goes with the backend/ folder: the
forwarder's files are in the VM's run/ (ports.pid, .status, .lock,
.known_hosts) and logs/ (ports.log), its control socket run/port-<hash>.ctl.
vm starts the forwarder after each start and on devvm ports of a running
VM; devvm stop, rm, gc --orphans and an interrupted start stop it.
vm/ports.go's hand rollback goes: the state changes first, and a
forwarder that can't start only warns. A structure-test layer keeps
backends from importing vmssh.

Tests: TestForwardsStart, TestForwardsRun, TestForwarderMain,
TestSplitPorts (vmssh); TestForwardTarget (lima); TestForwarding
(ports); TestStartPorts, TestSetPortsRunning (vm); testscripts up,
ports, layout, gc_orphans updated. Docs: internals/ports.md,
backends.md, lima.md, design.md (Ports on Lima), overview.md,
using/space.md, contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:19:39 -07:00
..