Repository navigation
fix(kit,vmshared,deploykit,spec): dead-code radical-removal batch (sdk leg) - #91
Conversation
…k leg) Deletes 8 proven-dead exported/unexported symbols (ValidateLibvirtSnippet, FirstNonEmpty, CheckLevels, DropMappingKey, ISOBuilderAvailable, MirrorSnapshotsToDeployState, PackageItemsFromStrings, SnapshotsRefcountSummary) found via a full unused-linter + cross-module reference-count sweep across charly/, sdk/, and all 83 candy/plugin-* modules — each had zero call sites anywhere in the tree. Flags deploykit.ResolveDeployBoxName (zero callers, cites a K-wave label) for an explicit ruling rather than unilaterally deleting it. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
…ero callers Team-lead ruling on the item flagged in the previous commit: an annotation citing a future K-wave use does not make uncalled code migration inventory — it makes it dead code with an aspiration. ResolveDeployBoxName and its private helper resolveDeployKeyToBoxFromProject had zero callers anywhere (no production code, no test) despite the file's header describing itself as built for "a plugin, or any future consumer" that never materialized. The K4 wave can re-create it from git history the day a real caller exists. $ grep -rn -w "ResolveDeployBoxName\|resolveDeployKeyToBoxFromProject" . --include='*.go' (no output — zero hits anywhere in the repo after deletion) Whole file deleted (49 lines, both functions, no test file existed for it). Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
…easoning Updates this batch's CHANGELOG entry: moves ResolveDeployBoxName from "flagged" to "deleted" (team-lead ruling, prior commit), and adds the explicit R10 anti-waste reasoning for why no disposable-bed run was performed on this zero-behavior-change deletion class. Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
|
Update per team-lead ruling:
Updated proof (deploykit re-verified after the deletion): |
pr-validator — CHANGES REQUESTED ❌Change class: Validated independently at head
R10 gate — the decisive finding (items 2/3/4/11)The PR's own argument ("Why no I searched What would fix this: run the disposable bed(s) whose kind matches the touched packages (at minimum a VM-class bed, e.g. Comments considered: 1 comment (the author's own "Update per team-lead ruling" note) — Cross-PR interactions considered: Decision: FAIL. Blocking findings: (1) the PR body no longer matches its own diff (the Assisted-by: Claude Code (Anthropic Claude Opus 4.8; analysed on a live system) |
Found while proving the charly-leg deletions in this batch:
- deploykit/secret_probe.go's header claimed resolveSecretValue "does NOT
move... STILL core" in charly/secrets.go — false now that the companion
charly PR deletes it as dead code (zero real callers; every remaining
caller of deploykit.ResolveSecretValue in charly core calls it directly).
- kit/ports.go had an orphaned one-line doc comment ("SavePortOverride
writes port overrides to charly.yml for persistence.") with no function
attached — a pre-existing dangling-comment bug, unrelated to but adjacent
to charly-core's own (now-deleted) SavePortOverride.
Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)
|
Round 2 update: two small R1 doc fixes appended (commit 8ba91af), found while proving the companion charly PR's deletions:
See charly#179 for the much larger round-2 finding set (the |
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)
pr-validator — APPROVED ✅ (round 2)Change class: sdk Go (dead-code deletion, vmshared/kit/deploykit/spec) Validated independently at head
R10 gate — independently re-verified, not just trustedThe two cited bed runs ( Comments considered: 3 (the round-1 team-lead-ruling update, my own round-1 FAIL, and a round-2 update documenting the 2 doc fixes) — all Cross-PR interactions considered: 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.1236.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) |
Summary
sdk leg of the dead-code radical-removal batch (a standing operator directive
turned into one properly-sized, fully-verified cutover). Companion PRs:
superproject (
opencharly/charly#179— call-site cleanup + doc-divergencefixes) and
plugins(opencharly/plugins#103, merged — SKILL.md fix). ThisPR should merge FIRST (the superproject leg bumps its
go.mod/submodulepointer to this commit).
Deleted (zero call-site proof)
Full hunt:
golangci-lint --enable-only=unusedacrosscharly/,sdk/(everysub-package), and all 83
candy/plugin-*modules — 0 findings everywhere(this codebase was already clean of that class). Since
unusedstructurallycannot flag an exported symbol in a library package, ran a manual cross-module
reference-count sweep instead (
grep -rw --include='*.go' -c <symbol> charly sdk candy, summed, then hand-verified every count ≤3 hit):vmshared.ValidateLibvirtSnippet— only caller was its own now-deleted test.kit.FirstNonEmpty— zero callers anywhere, including tests.kit.CheckLevels— deadvar, doc-claimed purpose ("for error messages")never actually consumed.
deploykit.DropMappingKey— zero callers.vmshared.ISOBuilderAvailable— zero callers; doc claimed acharly doctorcaller that doesn't exist.
vmshared.MirrorSnapshotsToDeployState— zero callers (theVmSnapshotStatetype it built is independently live elsewhere and untouched).
spec.PackageItemsFromStrings— zero callers; doc claimed a migrator callerthat doesn't exist.
vmshared.SnapshotsRefcountSummary— zero callers.deploykit.ResolveDeployBoxName+ its private helper(
deploykit/deploy_box_name.go, whole 49-line file) — originally flagged(zero callers, cited a K-wave label "(K4)", described itself as built for
"a plugin, or any future consumer" that never materialized). Team-lead
ruling: an annotation citing a future K-wave use does not make uncalled
code migration inventory — it makes it dead code with an aspiration.
Deleted with a fresh repo-wide grep pasted in the commit.
Each deletion's now-dangling import (
errorsinvm_helpers.go,stringsinvm_snapshot.go) was removed in the same edit; verified viago build.Fixed (R1 — documentation divergence, found while proving the above)
deploykit/secret_probe.go's header claimedresolveSecretValue"does NOTmove... STILL core" in
charly/secrets.go— false now that the companioncharly PR deletes it as dead code (zero real callers; every remaining
caller of
deploykit.ResolveSecretValuein charly core now calls itdirectly).
kit/ports.gohad an orphaned one-line doc comment ("SavePortOverridewrites port overrides...") with no function attached — a pre-existing
dangling-comment bug, unrelated to but adjacent to charly-core's own
(also deleted)
SavePortOverride.Test plan
go build ./...— cleango vet ./...— cleangolangci-lint run ./vmshared/... ./kit/... ./deploykit/... ./spec/...— 0 issuesgo test ./...— all packages pass (pasted below)CHANGELOG/earlier "no bed needed" call; the R10 matrix has exactly one bed-exempt
class, documentation-only, which this isn't)
Disposable bed runs (fresh rebuild,
charly version→2026.203.1120)Two beds, chosen to exercise the touched surfaces' actual runtime classes —
see
opencharly/charly#179for the full choice rationale (both beds runfrom that superproject worktree since that's where
charly.yml's beddefinitions and the compiled binary live; this sdk PR's deletions are
exercised transitively through the sdk module the binary is built from).
check-charly-vm(VM-class, 8 steps) — exercisesvmshared/vmshared snapshot/cloud-init surfaces this PR touched (vm_snapshot.go,cloud_init_iso.go):check-exampledeploy(deploy-state/bundle-lifecycle class, 6 steps) —exercises the
deploykitbundle-add/update/del state-management path(
deploy_state.go, touched by this PR'sDropMappingKeydeletion) and thechecklevel.go-gated check harness:Both post-run states clean (VM destroyed, deploy torn down, zero residue —
cleanup/cleanup-memberssteps passed).Assisted-by: Claude Sonnet 5 (Anthropic; analysed on a live system)