Repository navigation
K5 lane A: vm+k8s status collectors → plugin-substrate - #135
Conversation
…substrate
Moves charly/status_collect_vm.go + status_collect_k8s.go into
candy/plugin-substrate's existing OpStatusCollect seam, following P14a's
pod+local pattern. vm reaches candy/plugin-vm's verb:libvirt over
InvokeProvider (a real cross-plugin call, first use of this pattern from
plugin-substrate); k8s re-hydrates the resolved-project envelope over the
already-proven HostBuild("resolved-project") seam (candy/plugin-bundle's
OpCompile precedent) and resolves its own kind:k8s template in-package.
Deploy-tree enrichment for vm stays host-side (mirrors pod's own split) as
the new Collector.enrichVmRow. android is deliberately deferred (deeper
deploy-cone coupling, its own fold). Net: -268 LOC from charly/ core.
Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
…or move golangci-lint run ./... on charly/ surfaced 2 unused symbols left behind by the vm-collector move to plugin-substrate (both dead only because the deleted charly/status_collect_vm.go was their sole consumer): domainInfo (charly/vm_plugin_client.go, superseded by the plugin's own domainInfo copy) and the libvirtSessionSocket alias (charly/vmshared_aliases.go — vmshared.LibvirtSessionSocket is now called directly from the plugin; libvirtSessionSocketWithProbes, still used by vm_backend_lifecycle.go, is untouched). Zero golangci-lint issues on both touched modules after this fix. Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
The CHANGELOG's "Net core LOC" table was written before the follow-up golangci-lint dead-code fix (f7d84c5) landed. Corrected -268 to the true -276 LOC, adding vm_plugin_client.go/vmshared_aliases.go to the before/after table. Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
…-test) git grep for the deleted charly/status_collect_vm.go turned up one more stale reference: vm_backend_lifecycle.go's header comment still listed it as a resolveVmBackend consumer. The K5 vm status collector no longer calls resolveVmBackend at all (it gates on vmshared.LibvirtSessionSocket() directly and reaches candy/plugin-vm over InvokeProvider) — corrected the comment rather than just renaming the stale filename. R5 grep self-test now clean: git grep for both deleted filenames returns only this PR's own plugin-substrate files (which legitimately share the same base name) and CHANGELOG history. Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
Fresh PR-validator pass on a fresh worktree: rebuilt task build:binary and ran the check-group (VM substrate) and check-k8s-deploy (VM+k8s substrate) disposable beds concurrently against dab137b — both PASS with a genuine fresh-rebuild cycle (7/10 steps, ok: true throughout, exit 0). Finalizes the merge-time CalVer 2026.197.2024 -> 2026.197.2100 and upgrades the tier to fully tested and validated now that the R10 gate has run. Assisted-by: Claude Code Claude Sonnet 5 (fully tested and validated)
charly/pr-validator: PASS — fully tested and validatedIndependent fresh-worktree validation (unique worktree, never reused; V-133 acting as fresh PR-validator per project process). Re-derived everything from scratch — did not trust the author's own pasted claims. Non-runtime standards — all clean
R10 disposable bed roster — run concurrently, both PASS (fresh worktree
|
# Conflicts: # candy/plugin-substrate/status_collect.go # charly/status_collector.go # charly/status_substrate.go
…pre-history CHANGELOG/2026.197.2024.md was this branch's own copy of #135's placeholder CalVer entry, carried over from before this branch stacked on #135 and was later rebased/merged onto post-merge main. #135's fresh pr-validator already renamed it to CHANGELOG/2026.197.2100.md at merge time (and upgraded its tier to "fully tested and validated" after running the full disposable-bed R10 roster) — that file is already in main. This branch's stale duplicate, byte-identical apart from the superseded CalVer/tier, is dead weight and is removed here rather than left for review to catch. Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
… plugin-substrate Completes the status-collector generalization (the 3rd and final substrate after vm+k8s, #135): moves charly/status_collect_adb.go's android device collector into candy/plugin-substrate, following the exact vm/k8s pattern. This deletes the last SubstrateCollector in-proc registrant, so charly/status_substrate.go collapses to a bare CollectOpts data-carrier — the SubstrateCollector interface, collectorFactory, substrateFactories, and registerSubstrate are ALL deleted, and collectFlat's worker-pool concurrency fan-out is gone entirely. Net -214 additional LOC from charly/ core (combined -490 with #135 for the full 3-substrate move). Rebased onto #137 (K3 alias-dissolution). During independent validation, a genuine test-isolation defect was found in TestCollectAndroidStatus_Rows (it reused the real committed check-android-emulator-pod bed name and called the real, un-mocked containerRunning, so it nondeterministically failed under concurrent host state) — routed back to the author, fixed at the root cause (containerRunning is now a swappable var, the test stubs it, the fixture uses a test-only name), and re-proven by running the test with a real, identically-named container deliberately up on the host. The vm/k8s/pod/local collapse is proven via the R10 disposable-bed roster (check-group + check-k8s-deploy, both green with fresh-rebuild cycles); the android collector via a real live invocation against the genuinely declared check-android-emulator-pod bed. The live-running-emulator proof remains an environmental host/image block (rootless-podman fuse limitation + missing gsettings-desktop-schemas), independent of this PR. Assisted-by: Claude Code Claude Sonnet 5 (fully tested and validated)
…-orphans → plugin-status/plugin-substrate Moves charly/status_nested.go's declared nested-deployment-tree pre-resolution into candy/plugin-status/nested_tree.go, and charly/status_reap.go's ReapOrphansCmd (charly reap-orphans) into candy/plugin-substrate/command_reap_orphans.go. Both were previously framed as "cannot cross the process boundary" — disproven by the already-merged android status collector (#135/#136): every dependency (deploykit.LoadBundleConfig, MergeDeployConfigs, ClassifyTarget, ResolveDeployChain) is already sdk-portable. sdk/schema/status.cue narrows #StatusSubstrateRequest/#StatusSubstrateReply: nested/roots no longer cross the host<->plugin wire. CollectOpts drops the now-dead Nested/Unified fields. The vm-liveness probe in reap-orphans replaces a core-private registry accessor with Executor.InvokeProvider (F10 peer-to-peer dispatch). status_collector.go's remaining residue does NOT fold in -- verified genuine blocking dependencies (the core registry itself, T-55's K4 shared-resolver territory, core-private helpers with no sdk-portable equivalent) -- stays UNTIL-K5 as tracked migration inventory. Three-repo cutover, landed in order: sdk#63 (wire narrowing) merged first, plugins#80 (skill doc sync) merged second, this PR's gitlinks bumped to both real merged SHAs and re-verified with a clean assembled build. R10: check-commands-local PASS (6 steps incl. a fresh-rebuild cycle), exercising charly status/status --json/reap-orphans end-to-end through the narrowed wire seam, with the new reap-orphans-runs check step independently confirmed to have executed and passed. Assisted-by: Claude Code Claude Sonnet 5 (fully tested and validated)
Summary of changes
K5 wave, Lane A (the first ready-now cutover of the check/status/validate +
seam-death wave). Moves the
vmandk8scharly statussubstratecollectors out of
charly/core intocandy/plugin-substrate's existingOpStatusCollectseam, following the exact pattern P14a already used forpod+local:charly/status_collect_vm.go→candy/plugin-substrate/status_vm.go.Lists
charly-*libvirt domains by reachingcandy/plugin-vm'sverb:libvirtover the host'sInvokeProviderreverse leg — a realcross-plugin call, the first time
plugin-substratereaches ANOTHERplugin this way. The deploy-tree enrichment (SSH-port/network from a
matching
target:vmentry'svm_state, read from the PER-MACHINE~/.config/charly/charly.yml) stays host-side — mirrors the podsubstrate's own live/enrichment split — as the new
Collector.enrichVmRowincharly/status_collector.go.charly/status_collect_k8s.go→candy/plugin-substrate/status_k8s.go.Re-hydrates the resolved-project envelope over the already-proven
HostBuild("resolved-project")seam (the exact compositioncandy/plugin-bundle'sOpCompilealready runs in production — no newmechanism invented) and enumerates every declared
target:k8sdeploynode. Resolving the referenced
kind:k8stemplate needs no cross-pluginhop:
plugin-substratealready implements the k8s substrate-templateresolve (
resolve.go), so it's an in-package call. No CUE schema changewas needed —
spec.ResolvedProjectRequest{Dir: ""}already defaults toos.Getwd()host-side, exactly whatNewCollectoralready relies on forthe SAME project projection (a compiled-in plugin shares the host
process's cwd).
charly/status_collector.go:collectFlatnow fans pod + local + vmOpStatusCollect(onlyandroidremains onthe in-proc
SubstrateCollectorregistry — its collector merges PROJECTis deliberately deferred to its own fold rather than rushed here).
collectSubstratenow threads an in-proc reverse-channel executor ontothe Invoke ctx (mirrors
bundle_compile_seam.go'scompileViaPluginexactly) so the plugin can reach
HostBuild/InvokeProviderfor itself.status_collector.go/status_substrate.go/plugin.godescribing vm/k8s as still-host-side/K5-gated were swept inthe same commit (R1 claim-keyed sweep).
(
k8sDeployEntries/k8sImageRef/k8sSpecFor/vmStatusFromDomainState/collectVmStatuswith a mocked domain list) now live incandy/plugin-substrate; the deploy-enrichment test(
TestEnrichVmRow, covering the cases the deletedTestVMCollector_Collectused to) now lives in the newcharly/status_collector_test.go, since that logic stayed host-side.Change class
charly-or-sdk Go (no sdk schema change was needed, so this ischarly-core + one candy module).
How R10-tested — exact gate, commands, and pasted output
/charly-check:check"R10 gate bychange class" —
go build/go vet/go teston both touched modules +task build:charly(R9 freshness) + a live invocation of the changedrunner. The FULL disposable-bed roster for this cross-cutting change
(
check-pod/check-k3s-vmand any vm/k8s-composing bed) is explicitlyDEFERRED to K3/K4/K5 wave consolidation, per the orchestrator's
(team-lead's) stated sequencing for this parallel multi-lane program —
not yet run against this exact commit. This PR should not be merged
until that roster runs green, OR the orchestrator explicitly authorizes
landing at this evidence tier for this specific lane. Flagging this
explicitly rather than overclaiming.
N/Aat this commit — deferred to wave consolidation(see above). Not yet run.
task build:binaryrebuiltbin/charlyfromthis source;
charly versionreflects this build (CalVer derived fromthis commit's timestamp per
pkg/arch/calver.sh); content-marker check(
strings bin/charly | grep -c "reach host reverse channel|fetch resolved-project envelope|..."→ 14 matches) confirms the new code isactually compiled in, not just present in the source tree.
./bin/charly status --jsonagainst this worktree's own project(which has real, currently-running check-bed deploys on this host).
Output (abbreviated, full JSON is 60+ rows):
collectVmStatusreachedcandy/plugin-vm'sverb:libvirtover a genuine cross-pluginInvokeProvidercall and correctly listed 3 REAL, currently-runninglibvirt domains on this host;
collectK8sStatusreachedHostBuild("resolved-project")and correctly resolved 1 realtarget:k8sdeploy's tree-presence + kubeconfig context (vm-k3s-vm).Exit code 0. Zero regression against the pre-existing 57
localrows(untouched code path). The graceful-degradation path (no libvirt session,
no k8s deploys) is unit-tested (
TestCollectVmStatus_DegradesOnListError,TestK8sDeployEntrieswith an empty map) but not separately exercisedlive in this run, since this host DOES have live domains — the happy
path is what ran live.
N/A— this change does not touch the loader/discoverwalk, the deploy ledger, the podman store, the resource arbiter, or a
build lock; it only changes which process gathers status-collection rows
in a single-invocation, read-only command with no shared mutable state
across concurrent invocations changed by this diff.
Attribution tier
analysed on a live system— a live invocation of both changed code pathsran against REAL running deployments (3 libvirt VMs + 1 k8s deploy) and the
output is pasted above, but the fresh-rebuild-on-a-
disposable:true-targetR10 bed roster has not yet run against this exact commit (deferred to wave
consolidation per the orchestrator's sequencing — see the R10 section
above). Not inflating to
fully tested and validatedsince that specificgate hasn't run yet.
Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)Harness rulebook compliance
/charly-check:check(charly status / disposable beds),/charly-internals:plugin(the boundary law +HostBuild/InvokeProviderseams),
/charly-internals:go(Go source map),/charly-internals:go-quality(gofmt/vet),
/charly-internals:git-workflow(this landing sequence) allloaded before touching code.
development, neither dismissed as a flake: (1) the initial
collectVmStatusran its own libvirt-socket availability short-circuitBEFORE the mocked domain list in
TestCollectVmStatus_Rows, so the testfailed with 0 rows instead of the expected mock data — RCA'd to the
test-environment's absent real libvirt socket, fixed by making the
availability gate a swappable
libvirtSessionAvailablevar (mirroringthe existing
listLibvirtCharlyDomainsswap pattern), not by looseningthe test. (2) A live-smoke-test row count changed between two runs
(3 vm rows → 1) — RCA'd via
virsh -c qemu:///session list --allBEFORE assuming a regression: this is a SHARED multi-agent host, and the
domain set had genuinely changed (another concurrent teammate's bed
activity), confirmed by
virshitself showing the same new domain set —not a bug in this change.
go build/go vet/go test/golangci-lintall report zero warnings on both touched modules (see Clean architecture
below for the 2 dead-code hits found + fixed).
(moving
android) is named explicitly above, with its reason (deeperdeploy-cone coupling — merges PROJECT + PER-MACHINE config), not silently
dropped — it is tracked as the natural next K5 sub-lane, same theme,
same wave.
faithful port (same field names, same enrichment split as the pod
substrate already established) — no new pattern invented where an
existing one (P14a's pod/local split,
bundle_compile_seam.go'sreverse-channel threading) already covers the shape.
test fix (above) is a proper swappable-var fix, not a loosened assertion.
left as shims);
git grep -n "status_collect_vm\|status_collect_k8s" charly/ candy/returns nothing outside this PR's own commit message /CHANGELOG context (verify on the pushed branch). Stale
"vm/k8s/android...K5-gated" comments swept in the same commit (listed
above).
git status/git diff --statchecked before everydestructive action; no
git rm -rf/checkout -- <path>used —git rmonly on the two files being intentionally deleted.path execute live?" above) — the full disposable-bed roster is deferred
to consolidation, flagged honestly, not claimed done.
N/A— this change does not touchContainerfile generation or OCI labels.
task build:binaryrebuilt from thisexact source; content-marker check confirms the new code is in the
binary (see above); no new runtime OS dependency introduced.
(
TestCollectVmStatus_Rows/_DegradesOnListError,TestK8sDeployEntries/TestK8sImageRef/TestK8sSpecFor/TestK8sTreeRoot/TestCollectK8sStatus_TreePresenceAndContext,TestEnrichVmRow) that would FAIL without this change (they exercisethe new plugin-side functions and the retained host-side enrichment
directly). The disposable-bed fresh-rebuild gate is the deferred piece
— see R7 above.
compiled-in plugin reach
HostBuild("resolved-project")andInvokeProviderfor a peer plugin from a NEW call site) was verifiedagainst the LIVE, already-working
candy/plugin-bundleprecedent beforewriting any code, then proven again with the live
charly status --jsonrun above — not accepted from the skill/code alone. ADE:
N/A— nocandy
plan:/description:changed. SDD:N/A— no.cueschematouched (confirmed unnecessary, see Summary).
left in scope for vm/k8s specifically (android is a named, separate,
next sub-lane of the SAME wave, not a deferred remainder of THIS piece).
concrete-kind (vm/k8s) status-collection bodies move OUT of
charly/core into their owning plugin candy, reached only via the generic
HostBuild/InvokeProviderenvelopes; no new concrete-kind knowledgewas added to core.
N/A— no destroy/rebuild of any targetperformed;
charly statusis read-only.gofmt -l .empty on both modules;go vet ./...clean on both;go test ./...green on both (fullcharly/ suite: ~100-119s, all
ok);golangci-lint run ./...reported2 real dead-code hits caused by this move (
domainInfoincharly/vm_plugin_client.go, thelibvirtSessionSocketalias incharly/vmshared_aliases.go— both superseded once the plugin callsvmshared.LibvirtSessionSocket/defines its owndomainInfodirectly),fixed in a second commit (
f7d84c5) rather than left for later —0 issueson both modules after.CHANGELOG/2026.197.2024.mdstaged (placeholder CalVer —the pr-validator finalizes the merge-time version).
Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)