banger/internal/daemon
Thales Maciel 16702bd5e1
daemon split (6/n): extract wireServices + drop lazy service getters
Factor the service + capability wiring out of Daemon.Open() into
wireServices(d), an idempotent helper that constructs HostNetwork,
ImageService, WorkspaceService, and VMService from whatever
infrastructure (runner, store, config, layout, logger, closing) is
already set on d. Open() calls it once after filling the composition
root; tests that build &Daemon{...} literals call it to get a working
service graph, preinstalling stubs on the fields they want to fake.

Drops the four lazy-init getters on *Daemon — d.hostNet(),
d.imageSvc(), d.workspaceSvc(), d.vmSvc() — whose sole purpose was
keeping test literals working. Every production call site now reads
d.net / d.img / d.ws / d.vm directly; the services are guaranteed
non-nil once Open returns. No behavior change.

Mechanical: all existing `d.xxxSvc()` calls (production + tests)
rewritten to field access; each `d := &Daemon{...}` in tests gets a
trailing wireServices(d) so the literal + wiring are side-by-side.
Tests that override a pre-built service (e.g. d.img = &ImageService{
bundleFetch: stub}) now set the override before wireServices so the
replacement propagates into VMService's peer pointer.

Also nil-guards HostNetwork.stopVMDNS and d.store in Close() so
partially-initialised daemons (pre-reconcile open failure) still
tear down cleanly — same contract the old lazy getters provided.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:55:28 -03:00
..
dmsnap Extract opstate and dmsnap into subpackages 2026-04-15 16:02:43 -03:00
fcproc runtime sockets: close the local-user race window around control-plane creation 2026-04-20 12:53:47 -03:00
imagemgr Remove image build --from-image; doctor treats catalog images as OK 2026-04-18 15:54:29 -03:00
opstate coverage: medium batch — hostnat runner, store guest-sessions, daemon helpers 2026-04-18 18:03:37 -03:00
workspace remove vm session feature 2026-04-20 12:47:58 -03:00
ARCHITECTURE.md daemon split (5/5): document the service composition 2026-04-20 20:58:53 -03:00
autopull_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
capabilities.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
capabilities_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
concurrency_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
daemon.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
daemon_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
dns_routing.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
dns_routing_test.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
doc.go daemon split (5/5): document the service composition 2026-04-20 20:58:53 -03:00
doctor.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
fake_firecracker_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
fastpath_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
guest_ssh.go remove vm session feature 2026-04-20 12:47:58 -03:00
host_network.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
image_seed.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
image_service.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
images.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images_helpers_test.go coverage: medium batch — hostnat runner, store guest-sessions, daemon helpers 2026-04-18 18:03:37 -03:00
images_pull.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
images_pull_bundle_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
images_pull_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
kernels.go daemon split (2/5): extract *ImageService service 2026-04-20 20:30:32 -03:00
kernels_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
logger.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
logger_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
nat.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
nat_test.go vm state: split transient kernel/process handles off the durable schema 2026-04-19 14:18:13 -03:00
open_close_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
ports.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
preflight.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
runtime_assets.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
snapshot.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
snapshot_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
ssh_client_config.go ssh-config: make the ssh <name>.vm shortcut opt-in 2026-04-20 13:57:26 -03:00
ssh_client_config_test.go ssh-config: make the ssh <name>.vm shortcut opt-in 2026-04-20 13:57:26 -03:00
sshd_config_test.go guest sshd: drop DEBUG3 + StrictModes no; normalise /root perms 2026-04-19 13:40:40 -03:00
tap_pool.go daemon split (1/5): extract *HostNetwork service 2026-04-20 20:11:46 -03:00
vm.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_authsync.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
vm_create.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_create_ops.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_create_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
vm_disk.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_handles.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_handles_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
vm_lifecycle.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_locks.go Move subsystem state/locks off Daemon into owning types 2026-04-15 15:58:33 -03:00
vm_service.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
vm_set.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_stats.go daemon split (4/5): extract *VMService service 2026-04-20 20:57:05 -03:00
vm_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
workspace.go daemon split (3/5): extract *WorkspaceService service 2026-04-20 20:42:31 -03:00
workspace_service.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00
workspace_test.go daemon split (6/n): extract wireServices + drop lazy service getters 2026-04-21 15:55:28 -03:00