Skip to content

feat(vm)!: externalize the VM CLI into compiled-in command:vm (P10) - #64

Merged
atrawog merged 2 commits into
mainfrom
feat/p10-vm-cli-plugin
Jul 12, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/p10-vm-cli-plugin

Conversation

@atrawog

@atrawog atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

P10 — the VM CLI family externalized into the COMPILED-IN command:vm plugin. The last welded machinery command falls: charly vm … (build / create / start / stop / destroy / console / ssh / snapshot / gpu / import / clone / cp-box / list) moves OUT of charly core into candy/plugin-vm, dispatched IN-PROC via Invoke(OpRun) — so the handlers run in charly's own process with native stdio/TTY (console/ssh stay interactive), owning the CLI + the libvirt/qemu engine in-package. The hidden charly __vm forwarder is deleted; core keeps ONLY the kind-blind seam machinery.

The four host↔plugin seams (F11 class-generic action nouns)

A compiled-in command plugin imports only the sdk, so it reaches the host-only core Mechanisms over generic F10 reverse-channel seams:

  • config-resolve (charly/host_build_config_resolve.go) — the host resolves the project config for one entity ONCE (LoadUnified + ResolveRuntime + resolveVmBackend + #Vm defaults + the persisted ledger state) → spec.ConfigResolveReply; the plugin owns every downstream action.
  • config-persist — the WRITE twin; the deploy-ledger persist/remove runs host-side under its blocking config lock (a core Mechanism the plugin cannot hold across the module boundary).
  • vm-build (charly/host_build_vm_build.go) — the VM-disk build engine (privileged pacstrap/bootc/cloud-image → qcow2) STAYS core, exactly as the box-build engine stayed core behind HostBuild("image") in P8; the thin vm build command forwards its flags.
  • egress → verb:egress, preempt → verb:arbiter, GPU → verb:gpu via InvokeProvider; the libvirt/qemu engine is a direct in-package call.

Core deletions (R5 — the dead dual path is gone)

  • charly.yml compiled_plugins: += plugin-vm (F8; the go-libvirt + govmm + libvirtxml stack now compiles into charly for this canonical placement).
  • main.go: the hidden __vm command + the false "LAST WELDED machinery command / Run handlers STAY core / cannot move to the plugin" framing DELETED.
  • 11 core CLI files (vm.go, vm_create_spec.go, vm_clone[+cmd].go, vm_cp_box.go, vm_gpu_cmd.go, vm_snapshot_cmd.go, vm_import[+cmd].go, vm_instance_override.go, machine.go) + 4 stale tests removed. The backend/lifecycle helpers core still needs (resolveVmBackend/vmConfiguredBackend/startLibvirtUserSession back the config-resolve seam; startVM/stopVM back the arbiter's preempt holder restart) extracted to charly/vm_backend_lifecycle.go; the shared GPU/SSH/scp helpers kept via surgery on gpu_allocate.go + vm_scp.go. The VM-disk build engine stays core behind the vm-build seam.
  • R5 sweep: the plugin's own docs (plugin.go, charly.yml description) rewritten from the removed __vm-forwarder design to the compiled-in reality; git grep '__vm' clean.

Dead-code sweep — the extraction's orphaned core symbols (R5, folded in this landing)

golangci-lint run (which the prior gate did NOT run — it ran go test + F11 only) surfaced 21 unused symbols the extraction orphaned: their only callers lived in the deleted CLI files. All deleted here (each confirmed zero non-def callers + no surviving test ref; the plugin carries every equivalent): the 6 vm-cmd-only driver-switch shims in gpu_shim.go; arbiterProxy.clearPoison/resourcePoisoned in preempt.go; the whole dead create-RPC path in vm_plugin_client.go (invokeVmCreate, vmCreateRenderedXML, the vmCreateReq struct + vmPluginEnv.Create field — create now runs in-proc in the plugin); 9 unreferenced aliases in vmshared_aliases.go; hostArchRuntime (+ the runtime import) in bundle_add_cmd_vm.go; memlockUnlimited (+ its stale doc-comment) in devices.go. After the sweep: golangci-lint run 0 issues, go build/vet/test ./.../gofmt green, and git grep on every deleted id returns only candy/plugin-vm/** + CHANGELOG/.

Change class

charly Go touching the loader/command/deploy spine + a cross-cutting compiled-in-plugin move → RUNTIME class. Gate: go test ./charly + task build:charly (R9) + the vm check beds.

R10 evidence (both vm beds, fresh-rebuild update gate, disposable teardown clean, exit 0)

Final-code run 2026.193.0514 — re-run on the FINAL post-deletion code (the 21-symbol dead-code sweep above included; binary rebuilt via task build:charly), .check/<bed>/2026.193.0514/summary.yml:

  • check-charly-vm — vm-build 5s · vm-create 8s · deploy-add 86s · check-live 30s · update 114s (fresh-rebuild) · cleanup 11s · total 255s · ok: true · exit 0.
  • check-k3s-vm — vm-build 5s · vm-create 9s · deploy-add 37s · check-live 50s · update 80s (fresh-rebuild) · cleanup 17s · total 197s · ok: true · exit 0.

golangci-lint run 0 issues; go test ./... + go vet + gofmt GREEN; F11 uniform-API gate GREEN; zero warnings. After task build:charly on the FINAL post-deletion code, charly vm list/create route ONLY through the compiled-in command:vm (core CLI gone) and render a real VM through the seams live on both beds.

CLAUDE.md compliance

  • R5 — hard cutover: __vm + the CLI handlers + all stale refs/docs deleted in one commit; grep self-test clean.
  • Boundary law — every seam is a class-generic host-builder / verb; core keeps only kind-blind machinery. The VM-disk build engine stays core behind vm-build (P8-consistent), like config loader behind config-resolve.
  • Hard Cutover — ONE atomic commit; no transitional/dual path at the R10 run (the core CLI was deleted BEFORE the fresh-rebuild beds).

Producer: opencharly/sdk (the seam wire types) merged + tagged first; this PR bumps the sdk gitlink to the merged commit + the charly/go.mod require to the merged sdk tag.

Plugins gitlink bump — carries TWO merged plugins commits: (a) the R5 doc half of THIS cutover (opencharly/marketplace#29 — 15 vm source-map skill refs re-homed to their post-P10 candy/plugin-vm/ + charly/vm_backend_lifecycle.go homes; the R5 grep self-test that P10's code deletions require), and (b) the Option A agent-spec tooling (plugins#28 — the 6 roster agents gain Skill/SendMessage/Write), which rides along per the operator batching directive.

Assisted-by: Claude (fully tested and validated)

https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

The last welded machinery command falls. charly vm ... (build/create/start/
stop/destroy/console/ssh/snapshot/gpu/import/clone/cp-box/list) moves OUT of
core into the COMPILED-IN command:vm plugin (candy/plugin-vm), dispatched
IN-PROC via Invoke(OpRun) with native stdio/TTY; the hidden __vm forwarder is
deleted. Core keeps ONLY the kind-blind seam machinery.

Four generic host<->plugin seams (F11 class-generic action nouns):
- config-resolve (host_build_config_resolve.go): the host resolves the project
  config for one entity once (LoadUnified/ResolveRuntime/resolveVmBackend +
  #Vm defaults + persisted ledger state) and ships spec.ConfigResolveReply.
- config-persist: the WRITE twin; the deploy-ledger lock stays host-side.
- vm-build (host_build_vm_build.go): the VM-disk build engine stays core
  (P8-consistent); the thin vm build command forwards its flags.
- egress->verb:egress, preempt->verb:arbiter, gpu->verb:gpu via InvokeProvider;
  the libvirt/qemu engine is a direct in-package call.

Core deletions (R5): compiled_plugins += plugin-vm; main.go __vm + the false
"LAST WELDED / Run handlers STAY core" framing deleted; 11 CLI files + 4 stale
tests removed; the backend/lifecycle + shared GPU/SSH/scp helpers core still
uses extracted to vm_backend_lifecycle.go / kept via surgery; the VM-disk build
engine stays core behind the vm-build seam.

Dead-code sweep (R5): golangci-lint (not run by the prior gate) surfaced 21
unused symbols the extraction orphaned (callers lived in the deleted CLI
files) - all deleted: the 6 vm-cmd-only driver-switch shims (gpu_shim.go),
arbiterProxy.clearPoison/resourcePoisoned (preempt.go), the whole dead
create-RPC path (invokeVmCreate/vmCreateRenderedXML/vmCreateReq/vmPluginEnv.
Create - create runs in-proc in the plugin now), 9 aliases (vmshared_aliases.
go), hostArchRuntime+runtime import (bundle_add_cmd_vm.go), memlockUnlimited
(devices.go). golangci-lint run 0 issues; grep on every deleted id -> only
candy/plugin-vm + CHANGELOG.

R10 (final post-deletion code, run 2026.193.0514): check-charly-vm 7/7
(total 255s, update 114s fresh-rebuild) + check-k3s-vm 7/7 (total 197s,
update 80s), both exit 0, disposable teardown clean; golangci-lint 0 issues;
go test ./... + vet + gofmt green; F11 gate green.

Producer: opencharly/sdk (seam wire types) merged + tagged first (v0.2026193.
447); this commit bumps the sdk gitlink + charly/go.mod require. The plugins
gitlink bump carries the R5 doc half of this cutover (plugins#29 - 15 vm
source-map skill refs re-homed) + the Option A agent-spec tooling (plugins#28,
per operator batching directive).

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
@atrawog

atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly/sdk Go (RUNTIME) — command/loader/deploy spine + a cross-cutting compiled-in-plugin move (P10: the VM CLI externalized into the compiled-in command:vm).

Independently re-derived against R0–R10 + the pillars, trusting no author claim. Re-ran every cheap gate live; cross-checked the R10 bed evidence on disk and proved it tested the final committed code.

Checklist (all 18 PASS):

  • 0. security (T1–T4): diff scan clean (no exfil/secrets/network egress/eval); no gate weakened (main.go only deletes the __vm forwarder + stale framing; hooks/branch-protection untouched); no manipulation of the validator; scope matches the description.
  • 1. description complete: template filled with the four seams, core deletions, the 21-symbol dead-code sweep, change class, pasted R10 per-step evidence, tier, and CLAUDE.md compliance.
  • 2. change-class gate: runtime → go test + task build:charly (R9) + the two vm beds that compose the changed command:vm path (correct bed coverage). The update fresh-rebuild step ran on both — no dry-run/rebuild-alone fraud.
  • 3. attribution fully tested and validated: the relocated command:vm path executed live against a fresh update rebuild on both disposable vm beds; both ok: true.
  • 4. R0 skills: git-workflow/go/plugin/vm-deploy-target/vm/strict-policy/cutover-policy/check honored + spot-checked (compiled-in via compiled_plugins: + OpRun dispatch + class-generic seams).
  • 5. R1 / zero warnings: golangci-lint 0 issues; no build/test/vet warnings. The PR is a warning-driven RCA — the linter gate the prior run skipped surfaced 21 orphaned symbols, root-caused (extraction orphans) and deleted.
  • 6. R2 no split: dead-code sweep folded in, not deferred; plugins gitlink batches plugins#29 (this cutover's R5 doc half) + plugins#28 (Option A tooling, already merged) per the operator batching directive — a bump to real plugins/main HEAD.
  • 7. R3 no dup / 8. R4 no workaround / 9. R5 hard cutover: consolidated; no sleep/retry/magic-number; grep-clean on all 21 symbols + __vm + clearPoison/resourcePoisoned + the "LAST WELDED/STAY core" framing; forwarder deleted (no transitional path).
  • 10. R6/R8/R9: generation exercised by the beds' build+deploy; beds rebuild the binary + fresh-rebuild update; no new OS runtime dep.
  • 11. R10: both beds disposable: true, on-disk summaries ok: true (7 steps, 255s/197s, calver 2026.193.0514) matching the PR. Decisively confirmed the run tested the FINAL committed code — newest runtime .go @07:09 (before run start 07:14), no runtime .go newer than the run summary (07:19), commit @07:57 (only CHANGELOG changed after). vm-create.log shows a real "Created VM charly-charly-vm (libvirt session)". Did not re-run a bed (independent evidence decisive; re-running a VM bed from a teammate context with the libvirt socket down risks orphaning a domain).
  • 12. RDD/ADE/SDD: plugin-vm ships description: + a deterministic libvirt: list check; TestGenReproducible + TestPluginsGenReproducible green; plugins_generated.go(+2)/go.work(+1) consistent with compiled_plugins: += plugin-vm; no hand-edited generated file, no new @go(-)/hand-written wire type in the superproject diff; sdk wire types consumed from the merged+tagged producer via replace ../sdk, compiled+tested green.
  • 13. concurrency + anti-cheat: the correct kind-matching vm beds ran; the F11 uniform-API + bijection + reproducibility spine gates green; no forbidden framing in the body.
  • 14. one atomic commit / 15. boundary law / 16. disposable-only / 17. go gates / 18. CHANGELOG: exactly 1 commit; four seams are class-generic action nouns (F11 gate green), vm-disk build engine stays core behind vm-build (P8-consistent); destroy/rebuild only on disposable beds; gofmt clean + golangci-lint 0 + vet clean + go test green + plugin standalone GOWORK=off build/vet clean; CHANGELOG/2026.193.0142.md present.

Decision: All gates I re-ran are green (build/vet/test, gofmt clean, golangci-lint 0 issues — the exact gate whose prior omission this PR's dead-code sweep exists to fix), R5 grep clean, security clean, boundary clean, gitlinks on origin/main with the sdk tag matching. The R10 bed evidence is genuine, matches the PR claim, and — proven by source mtimes — ran on exactly the committed runtime code. Proceeding to finalize the merge-time CalVer, squash-merge, and tag.

Assisted-by: Claude (analysed on a live system)

Rename the P10 CHANGELOG placeholder to the merge-time CalVer and rewrite
its H1 to match. Version generated at merge by pr-validator.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01RCB6p1kLh2V3zrDnJXpzZ3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant