Repository navigation
fix(charly,plugin-vm): dead-code radical-removal batch (superproject leg) - #179
Conversation
…leg) Companion call-site cleanup for opencharly/sdk#91, which deletes vmshared.ValidateLibvirtSnippet as dead code (zero production callers): removes its only caller, charly/libvirt_test.go's TestValidateLibvirtSnippet (TestIsDeviceElement is untouched — real production caller), and the dead ValidateLibvirtSnippet re-export in candy/plugin-vm/vmshared_aliases.go (itself zero-referenced anywhere). Also documents the R1 finding that surfaced during proof: the plugins/internals/skills/libvirt-renderer/SKILL.md caller claim this function's deletion falsifies was already stale before this cutover (fixed in the companion opencharly/marketplace#103). NOTE: sdk/ and plugins/ submodule gitlinks are intentionally NOT bumped in this commit — opencharly/sdk#91 and opencharly/marketplace#103 must merge first; this leg's own proof ran against the pre-merge branch commits checked out in the worktree, and the gitlink bump belongs in a follow-up delta once both merge. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
|
Update per team-lead ruling:
|
…e sweep Continuing the batch's cross-module exported-symbol reference-count sweep across all 83 candy/plugin-* modules (per team-lead direction to continue while PR validation runs), scoped this pass to standalone functions and package vars (methods excluded — an exported method can be live purely via interface satisfaction, which grep can't see, and verifying every plugin's interface contract individually is out of this batch's budget; flagged as remaining scope). - candy/plugin-check/score.go: AllVerdicts — zero call sites anywhere. - candy/plugin-vm/machine.go: RootfulEngine — zero call sites anywhere; EnsureMachine/IsRootless (called internally by RootfulEngine) are independently live via other real callers in the same file and untouched. $ grep -rn -w "AllVerdicts\|RootfulEngine" . --include='*.go' (no output outside each symbol's own now-deleted declaration — verified before deletion via the full repo-wide sweep, R5 self-test clean after) Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
|
Update — continued candy-module export sweep (per team-lead direction): Extended the batch's cross-module reference-count technique across all 83
Checked ~85 low-count candidates total (everything ≤30 aggregate repo-wide hits) across Updated proof (plugin-check + plugin-vm re-verified after these 2 deletions): R5 grep self-test clean for both new identifiers. |
pr-validator — CHANGES REQUESTED ❌Change class: superproject Validated independently at head
R10 gate — the decisive finding (items 2/3/4/11)Identical root issue to the sibling What would fix this: run the disposable bed(s) reaching Comments considered: 2 comments (both the author's own "Update per team-lead ruling" notes) — Cross-PR interactions considered: Decision: FAIL. Blocking findings: (1) PR body/Changes/Test-plan stale relative to the two additionally-deleted symbols; (2) no disposable bed run despite the touched packages ( Assisted-by: Claude Code (Anthropic Claude Opus 4.8; analysed on a live system) |
…ead symbols Continuing the dead-code radical-removal batch with a second, more precise instrument per team-lead direction: golang.org/x/tools/cmd/deadcode's whole-program RTA reachability analysis from charly's real main(), which (unlike grep) correctly accounts for interface dispatch. Every one of its raw candidates was individually re-verified with full context before deletion — several false leads (transitively-live, or the artifact of a first unfiltered run) were caught by that verification, not just trusted from the tool. 19 standalone functions/methods deleted (podDeployEngine, candySourceDirs, newHostVerbResolver, shellOverlayToEntry, appendGroupsForAMDGPU, appendAutoDetectedEnv, ValidateXMLEgress, ImageRuntime, ResolveBoxEngineFromDir, deployNodeSharesGPU, CandyNames, ScanAllCandy, SavePortOverride, bareRefs, resolveSecretValue, MergeDeployShell, replaceShellEntryByID, HasTailscaleSidecar, extractQuadletImageLine) plus distro.go's installHint/distroFamily methods and deployDelCmd's dead kit.ReverseExecutor-satisfying methods + now-orphaned struct fields. Full per-symbol proof (why each is genuinely dead, not just tool-flagged) is in this cutover's CHANGELOG entry. 3 more only-test-called validators (validateEntityCUE, validateVocabularyCollections, validatePluginCandy) and one act-command renderer (renderOpCommand) are FLAGGED, not deleted — deleting a validator risks masking a silent charly-box-validate coverage regression rather than just removing inert code, and that call needs a human, not a mechanical sweep. Also flags (not fixes) a larger doc-divergence cluster the appendAutoDetectedEnv finding surfaced: 7 SKILL.md sections across 6 plugin docs describing now-superseded architecture (DRINODE injection, MergeDeployShell) — out of this round's time-box, next thematic batch. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
|
Round 2 — x/tools deadcode RTA sweep (per team-lead direction): Ran `golang.org/x/tools/cmd/deadcode` (whole-program RTA reachability from charly's real `main()`) as a second, more precise instrument — it correctly accounts for interface dispatch, closing the exact blind spot flagged in the manual grep-count sweep's "methods excluded" note. Every one of its raw candidates was individually re-verified with full context before deletion (never trusted the tool flag alone). 19 more dead symbols deleted (commit 1d24dfc) — full per-symbol proof in the CHANGELOG entry. Highlights:
3 validators + 1 renderer flagged, NOT deleted — Larger doc-divergence cluster surfaced, not fixed this round: 7 Updated proof: R5 grep self-test: every deleted identifier greps clean outside CHANGELOG/ and outside its own live twin module (confirmed zero stray |
The validator correctly rejected the "zero-behavior-change deletion needs no bed" argument this entry originally made (R10's matrix has exactly one bed-exempt class — documentation-only — and this isn't it). Records the correction and points to the actual bed verdicts (opencharly/charly#179), since both beds ran from that superproject worktree and exercise this leg's deletions transitively through the built binary. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
The validator correctly rejected the "zero-behavior-change deletion needs no bed" argument this entry originally made (R10's matrix has exactly one bed-exempt class — documentation-only — and this isn't it). Records the correction and the two disposable-bed verdicts run on a fresh rebuild: check-charly-vm (VM-class, 8/8 steps PASS) and check-exampledeploy (deploy-state/bundle-lifecycle class, 6/6 steps PASS), both exit 0, zero residue. Confidence tier re-stamped to analysed on a live system. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
… fix Team-lead's per-item twin-or-regression ruling on the 4 previously-flagged only-test-called functions: - validateEntityCUE + validateVocabularyCollections: DELETED. git log -S found the exact commit (c9befd8) that deliberately cut their production call site (the legacy root-shape format they validated is now hard-rejected at load). RDD-verified live that the modern per-kind load-time plugin gate ("plugin kind:X: plugin_input fails #XInput") is the real production replacement. Their 3 test files redirected to the live validateEntityClosedCUE sibling, preserving real coverage. - validatePluginCandy: DELETED. candy/plugin-box/validate_rules.go's plugin-block check is an explicit, documented 1:1 port ("Mirrors core splitCapability + validatePluginCandy exactly"). - renderOpCommand: DELETED. Its "in-proc deploy path" caller class no longer exists (every deploy target is out-of-process now); confirmed live that kit.WalkPlans -> RunHostStep reaches the identical resolveProvisionScript seam. 8 test call sites redirected to a test-local helper replicating the exact former logic. Also: while redirecting the validator tests, surfaced a GENUINE pre-existing regression (predates this batch) — a vm: entity's PCI hostdev missing its required slot/function fields passes `charly box validate` when it should reject. Attempted the obvious fix (concrete validation on the real load-time gate, validateKindValueCUE) and RDD-verified live via go test ./... that it breaks 9 other real cases across vm/pod/local/k8s/candy corpus validation — far wider blast radius than the known candy base⊻from disjunction issue. REVERTED to the safe prior behavior; the gap is documented in place with every failing test named, tracked as a properly-scoped follow-up (needs per-field concreteness modeling, not a blanket flip) rather than shipped half-fixed or silently parked. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
pr-validator — CHANGES REQUESTED ❌ (round 2 — substance now solid, one procedural gap remains)Change class: superproject Validated independently at head
R10 gate — independently re-verified, and a real timing gap I found and closed myselfThe two cited bed runs (
|
… batch) Mechanical: replaces the vague "a follow-up"/"properly-scoped follow-up" phrasing (in provider_kind_invoke.go's doc comment and the CHANGELOG entry) with the actual registered program-exit name, the VALIDATION-CORRECTNESS BATCH, per operator direction — a named, registered exit, not an undifferentiated "follow-up". Assisted-by: Claude Sonnet 5 (Anthropic; documentation reviewed)
pr-validator — APPROVED ✅ (round 3 — final)Change class: superproject Validated independently at head Item 1 (description completeness) — RESOLVED. Confirmed via direct API ( The R10 — all 3 cited disposable beds independently re-run by me, fresh, on the exact final commit (not trusted from the PR's own pasted output, which predates this commit by design of the review process):
Plus: Full checklist: all 19 items PASS or correctly N/A — see my round-2 comment (#179 (comment)) for the complete per-item breakdown, which stands unchanged except items 1 and the Comments considered: all prior comments (team-lead rulings, sweep updates, my own round-1/2 verdicts) — accounted for, superseded by this final state. Decision: PASS. Finalizing the merge-time CalVer and merging now. Assisted-by: Claude Code (Anthropic Claude Opus 4.8; analysed on a live system) |
Rewrites the placeholder CHANGELOG/2026.203.1027.md to the merge-time stamp CHANGELOG/2026.203.1303.md, per the CalVer-at-merge rule (git-workflow skill "CalVer") to avoid author-time collisions across concurrently-open PRs. Assisted-by: Claude Code (Anthropic Claude Opus 4.8; analysed on a live system)
|
Merge outcome: merged (squash) as Assisted-by: Claude Code (Anthropic Claude Opus 4.8; analysed on a live system) |
Docs fix surfaced by the dead-code radical-removal batch's twin-or-regression procedure (companion PR: opencharly/charly#179). The internals/skills/go/SKILL.md claimed validateVocabularyCollections (charly/validate.go) was "also used by charly box validate for project files" -- false on two counts: (1) that production call site was already deliberately cut in charly's c9befd83 (the legacy root-shape collection format it validated became unreachable, hard-rejected at load before ever reaching validation); (2) validateVocabularyCollections and its sibling validateEntityCUE are themselves deleted as dead code in the companion charly PR -- RDD-verified live that the modern per-kind load-time plugin gate is the real production entity-schema enforcement today. Fixed 3 locations: the embedded-defaults paragraph, the validate.go file-map table row, and the schema-change guards list. Documentation-only change, zero behavior change. Assisted-by: Claude Sonnet 5 (Anthropic; documentation reviewed)
Mechanical gofmt -w on 8 files flagged by `gofmt -l charly/` (checkrun_act.go, deploy.go, distro.go, distro_test.go, engine.go, shellcollect.go, sidecar_test.go, update_deploy_dispatch_test.go) — #179's dead-code radical-removal batch left each with a stray trailing blank line at EOF. None are otherwise touched by this PR's own cutover. Verified whitespace-only: `git diff --stat` shows exactly 1 line removed per file (8 total); `git diff --ignore-blank-lines` is empty, confirming zero semantic change. go build/go vet clean after. Fixed now rather than left for the next validator to independently rediscover via the same gofmt -l check. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
… VFIOGpu Companion to `opencharly/sdk#92` (merged, `v0.2026203.1311`): bumps the `sdk` gitlink + `charly/go.mod` require, and updates every consumer of the two representation reshapes that PR's `HostProbeReply.GroupAccessible` and `VFIOGpu` CUE conversion required (both wire-format-identical, Go-source breaking). - `sdk` gitlink bumped to `922b3469`; `charly/go.mod` require bumped to `v0.2026203.1311`. - `HostProbeReply.GroupAccessible` is now `map[string]bool` (was `map[int]bool`) — updated construction/read call sites. - `VFIOGpu` no longer embeds `VFIOPCIDevice` anonymously — every composite literal replaced with the new `spec.NewVFIOGpu(d)` constructor. - One stale doc-comment citation of the deleted `sdk/spec/deploy_wire.go` repointed to `sdk/schema/buildwire.cue`. - Mechanical gofmt rider: 8 files left unformatted by #179 (whitespace-only, verified via `git diff -w --ignore-blank-lines` emptiness). Independently re-verified by a fresh pr-validator: JSON wire-identity of the GroupAccessible reshape confirmed mechanically; sdk gitlink verified as sdk's real origin/main HEAD; fresh rebuild + go test/vet/lint + the check-exampledeploy disposable bed all re-run from scratch on the exact PR head, all green. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
Summary
Superproject leg of the dead-code radical-removal batch (a standing operator
directive turned into one properly-sized, fully-verified cutover). Companion
PRs:
opencharly/sdk#91— deletes the actual dead functions (MERGED,e6b0208,v0.2026203.1236)opencharly/plugins#103— fixes the stale skill-doc reference thisbatch's RCA surfaced (merged)
opencharly/plugins#105— fixes a second doc-divergence claim(
validateVocabularyCollections) surfaced by this PR's Round 3twin-or-regression procedure (open)
charly/andcandy/plugin-vm/, plus 21 more dead symbols found by two furtherdiscovery rounds, plus the Round 3 ruling on 4 previously-flagged
validators/renderers
This PR's
sdk/pluginssubmodule gitlinks are intentionally notbumped yet — that's a follow-up delta now that #91 has merged (its gitlink
should point at
e6b0208on sdk's merged main, never a feature-branchcommit); this worktree's proof below ran against
sdk's merged main viagit submodule update.Changes
Round 0 — call-site cleanup for #91's deletions:
charly/libvirt_test.go'sTestValidateLibvirtSnippet— itssubject (
vmshared.ValidateLibvirtSnippet) is dead code deleted in refactor(deploy): single-source preempt consts to spec + kill 3 test-only aliases (K4 Bucket D) #91.TestIsDeviceElementuntouched.ValidateLibvirtSnippet = vmshared.ValidateLibvirtSnippetre-export from
candy/plugin-vm/vmshared_aliases.go.Round 1 — continued cross-module export sweep (2 more):
candy/plugin-check/score.go:AllVerdicts— deadvar, zero call sites.candy/plugin-vm/machine.go:RootfulEngine— zero call sites.Round 2 —
golang.org/x/tools/cmd/deadcodeRTA sweep (19 more; fullper-symbol proof in the CHANGELOG entry), deleted from
charly/:podDeployEngine,candySourceDirs,newHostVerbResolver,shellOverlayToEntry,appendGroupsForAMDGPU,appendAutoDetectedEnv,ValidateXMLEgress(charly-core copy — live twin incandy/plugin-vm),ImageRuntime,ResolveBoxEngineFromDir(stale K-wave annotation, sameprecedent as
ResolveDeployBoxName),deployNodeSharesGPU,CandyNames,ScanAllCandy,SavePortOverride,bareRefs,resolveSecretValue,MergeDeployShell,replaceShellEntryByID,HasTailscaleSidecar(livetwin in
sdk/deploykit),extractQuadletImageLine(live twin incandy/plugin-deploy-pod); plusdistro.go's(Distro) installHint/distroFamilymethods (live twins incandy/plugin-doctor), andbundle_add_cmd.go'sdeployDelCmd— its 4kit.ReverseExecutor-satisfyingmethods plus the now-orphaned
AssumeYes/KeepRepoChanges/KeepServices/KeepImage/DryRun/Runnerstruct fields (kept onlyName— confirmed viaa
kit.RunReverseOpscall-site audit that the realReverseExecutorimplementor is
deploykit.HostReverseExec, neverdeployDelCmd). Severaltests were preserved-and-redirected rather than deleted where they exercised
real, still-live behavior through a deleted thin wrapper (
resolveSecretValue's3 credential-resolution tests now call
deploykit.ResolveSecretValuedirectly;
bareRefs's 2 tests got a small test-local helper;TestDeployShellOverlay_YAMLParsewas split, keeping only its realYAML-parsing half).
Round 3 — the twin-or-regression procedure (team-lead ruling on the 4
previously-flagged items), per-item verdict:
validateEntityCUE+validateVocabularyCollections→ DELETED(twin found, scenario c).
git log -S 'validateVocabularyCollections('found the exact commit (
c9befd83) that deliberately cut their productioncall site — the legacy root-shape format they validated is now
hard-rejected at LOAD (
#NodeDocgate), so their input class waseliminated, not just their caller. RDD-verified LIVE that the modern
per-kind load-time plugin gate is the actual replacement:
charly box validateagainst a scratch project with an unknown field on abuilder:/agent:entity fails withplugin kind:builder: plugin_input fails #BuilderInput: ...field not allowed. Their 3 dependent test files wereredirected to the live
validateEntityClosedCUEsibling rather thandeleted, preserving real coverage.
validatePluginCandy→ DELETED (exact-coverage twin, scenario c).Same
c9befd83commit.candy/plugin-box/validate_rules.go'sif v.IsPlugin { ... }block is an EXPLICIT documented 1:1 port — its owncomment states "Mirrors core splitCapability + validatePluginCandy
exactly" (same 3 checks: ≥1 provider, well-formed
<class>:<word>,builtin providers actually compiled in).
renderOpCommand→ DELETED (architectural elimination, scenario c).Its "in-proc deploy path" caller class no longer exists — every deploy
target is out-of-process now. Confirmed live that
kit.WalkPlans(everyout-of-process deploy plugin) dispatches act-verb OpSteps to
RunHostStep,which reaches the SAME
resolveProvisionScriptseamrenderOpCommandused to wrap. Its 8 test call sites were redirected to a test-local
testRenderOpCommandhelper replicating the exact former logic.validateKindValueCUE(the real load-time gate the 3 items above routethrough for non-box kinds) → GENUINE REGRESSION FOUND (scenario d),
attempted fix REVERTED, tracked as its own named program exit. While
redirecting
cue_tighten_test.go's helper,vm_hostdev_pci_missing_slot/function_rejectedfailed — RDD-verifiedLIVE that
charly box validateon a realvm:entity with a PCI hostdevmissing required
slot/functionexits 0 (should reject). This PRE-DATESthe batch (the deleted
validateEntityCUEwas the only thing that evercaught it, and it already had zero production callers before this batch
touched anything) — but R2 requires fixing what a cutover surfaces, not
parking it. Attempted the direct fix (
cue.Concrete(true)onvalidateKindValueCUE) and RDD-verified viago test ./...that it hasfar wider blast radius than the known
candybase⊻from disjunction issue— even excluding
candy, it brokeTestCueKinds_Corpus(the realbox/candy corpus),
TestBundleCompileParity_PluginRoundTrip,TestPreresolveActiveInitInto_MachineVenue_ResolvesSystemd,TestCompileServiceSteps_PrefersPreresolvedActiveInit, 3×TestBuildDeployPlan*, and 2×TestInvokeProvider_LazyConnectFallback*—9 real, currently-passing cases. Trading one gap for nine new ones is not
a fix, so it was REVERTED to the safe prior (non-concrete) behavior; the
gap is documented in place (
provider_kind_invoke.go'svalidateKindValueCUEdoc comment, every failing test named) and trackedas its own named, registered program exit — the VALIDATION-CORRECTNESS
BATCH — rather than a vague "follow-up": the real fix needs per-field
concreteness modeling (or a narrower kind/field-scoped check), not a
mechanical blanket flip.
Also flags (does not fix) a doc-divergence cluster the
appendAutoDetectedEnvfinding surfaced: 7
SKILL.mdsections across 6 plugin docs describenow-superseded architecture — out of this batch's time-box, next thematic
batch's docs leg.
Round-3 verdicts with full evidence, and the validation-correctness batch
scoping.
Full batch discovery method
golangci-lint --enable-only=unusedacrosscharly/,sdk/, all 83candy/plugin-*modules — 0 findings everywhere (already clean of thatclass;
unusedstructurally can't flag exported-symbol-with-zero-callersin a library-shaped package).
golangci-lint --enable-only=unparamoncharly/— 0 findings.charly/*_aliases.godeclaration — nonedead.
sdk/kitfullsdk/*, then all 83 candy modules' standalone-function/package-var exports) — found the symbols deleted in refactor(deploy): single-source preempt consts to spec + kill 3 test-only aliases (K4 Bucket D) #91 + rounds 0-1
above.
.gofiles — none found.functions, cross-checked against all 83 candy modules.
golang.org/x/tools/cmd/deadcodewhole-program RTA reachability fromcharly's real
main()— closes the interface-dispatch blind spot classes1-6 structurally can't see. Every raw candidate individually
re-verified with full context before deletion (a tool flag is a
hypothesis, never proof by itself).
git log -Sper-item history + live coverage-comparison RDD verification(the twin-or-regression procedure) on the 4 items classes 1-7 couldn't
safely auto-resolve — found 3 genuine twins and 1 genuine regression.
Not done (documented remaining scope, not silently dropped): an exhaustive
exported-symbol sweep of all 83 candy modules' own METHOD (not just
standalone-function) surfaces; the VALIDATION-CORRECTNESS BATCH (the
validateKindValueCUEper-field-concreteness fix).Test plan
go build ./...,go vet ./...— clean oncharly/,candy/plugin-vm/,candy/plugin-check/GOWORK=off go build/vet/test ./...— clean oncandy/plugin-deploy-pod/(out-of-process module, comment-only editsthere)
golangci-lint run ./...oncharly/— 0 issues (full ruleset)go test ./...— all packages pass oncharly/,candy/plugin-vm/,candy/plugin-check/(pasted below)task build:binary— clean rebuild;charly version→2026.203.1131confirmed the fresh binary at bed-run time (below;each bed's own
.check/<bed>/<run-calver>/directory carries anindependent run-time timestamp, distinct from the binary's own
version stamp). Branch subsequently updated (
gh pr update-branch)to merge charly's own
#180(unrelated build/pkg fix) —re-verified with a FRESH
task build:binary(charly version→2026.203.1243) +go build/go vet/golangci-lint/go test ./...(all clean, pasted below) on top of the merge; a 4thbed re-run was judged unnecessary for an unrelated upstream merge
(this PR's own code is unchanged since the bed runs) — the chain
validator's delta re-gate covers it
repo's
CHANGELOG/and outside its own live twin module (no strayfunc <name>(declaration remains anywhere in the touched modules)matrix has exactly one bed-exempt class (documentation-only), which
this isn't; overrules an earlier "zero-behavior-change ⇒ no bed" call
Disposable bed runs (fresh rebuild at
charly version→2026.203.1131, pre-#180-merge; each bed's own run-calver below is independent of the binary version)Three beds, chosen to exercise the runtime classes this cutover's touched
files span:
check-charly-vm(VM-class, 8 steps, ~5 min) — the establishedVM-substrate bed; exercises
candy/plugin-vm(touched:machine.go'sRootfulEnginedeletion) and the sdkvmsharedsurfaces (vm_snapshot.go,cloud_init_iso.go) this cutover's sdk leg touches:check-exampledeploy(deploy-state/bundle-lifecycle class, 6 steps,~1 min) — chosen over
check-commands-localbecause it exercises thecharly bundle add/update/delSTATE lifecycle end-to-end (the deploySTATE-MODEL machinery
deploy_state.go'sDropMappingKeydeletion touched,and
bundle_add_cmd.go'sdeployDelCmdteardown-resolution path thiscutover's largest single finding touched) with verifiable teardown-residue
assertions;
check-commands-localonly exercises unrelated CLI verbs(settings/candy/clean/box/status) and would not have exercised either
touched surface as directly. Re-run on the FINAL (post-Round-3) rebuild:
check-commands-local(command-verb class, 6 steps, ~3.5 min) — runADDITIONALLY once Round 3 touched
validate.go/provider_kind_invoke.godirectly: its
box-new-validate-generatestep exercises realcharly box validateend-to-end (box new→candy→box→validate→generate),directly proving the Round-3 validator deletions + the
validateKindValueCUErevert didn't break the live command:All 3 post-run states clean (VM destroyed, deploys torn down,
cleanup/cleanup-memberssteps passed — zero residue).Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)