Repository navigation
feat(clean): charly clean --deep — store-wide untagged-image purge (closes the podman-prune R4 gap) - #174
Conversation
Closes a real CLI-only-interface gap (issue #173): this host's podman store held 3,552 images / 132.6GB / ~97% reclaimable / ~2,700 untagged intermediates, confounding build-corruption diagnosis and wasting the host. The pre-existing default `charly clean` dangling sweep only ever removes charly-labeled untagged images; a multi-stage build's intermediate stage images are never labeled (WriteLabels stamps only the final stage), so they accumulate invisibly to every existing category. - candy/plugin-clean: new --deep flag (cleanCategories resolves --images/ --check/--deep — --deep NEVER fires implicitly on a plain `charly clean`, R5 zero default-behavior change), reporting via the new kit.HumanBytes formatter. - charly/retention.go: pruneDanglingCharlyImages refactored (no behavior change) into a shared selectDanglingImages/pruneDanglingImages engine; pruneDeepDanglingImages (--deep) and pruneDanglingCharlyImages (the default sweep) are both thin wrappers over it (R3). - charly/host_build_retention.go: the "retention" HostBuild seam gains the Deep request/reply fields (sdk leg). - ADE: plugin-clean's charly.yml description/plan + charly.yml's check-commands-local R10 bed (new clean-deep-dry-run-runs step) updated. Purely additive (no public surface removed, no default-behavior change) -- not a breaking change. Live `charly clean --deep --dry-run` on this host's real store: 56 untagged images / 92.6 GiB reclaimable (vs. 30 charly-labeled dangling images the default sweep reports) -- confirming the gap this closes. Full battery (build/vet/test/lint across sdk, charly, and plugin-clean standalone; `charly box validate`; `task build:binary`) green; the destructive purge + the check-commands-local R10 bed run as the orchestrator's final gate. See CHANGELOG/2026.202.1610.md. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; syntax check only)
Root cause (orchestrator's destructive R10 run, this host's real store): --deep worked exactly as designed -- removed the untagged set (3,552 -> 3,484 images), exit 0, all InUse/live-build backstops intact -- but the dry-run's "92.6 GiB reclaimable" wildly overstated the ~4.6 GiB (132.6 GB -> 128 GB) actually freed. DeepBytes sums each removed image's reported Size, which counts every layer it references; most of those layers are SHARED with the ~3,400 remaining (largely stale-tagged) images, and removal only frees layers held UNIQUELY. The verb's selection/removal logic was never wrong -- only the presented figure was misleading. Every place presenting DeepBytes now labels it "up to X (shared layers may reduce actual reclaim)" and notes pairing --deep with --invalidate for the fullest reclaim: the CLI report line, the --deep flag help text, the check-commands-local bed's check description, plugin-clean's ADE description, and this CHANGELOG (the paired sdk + plugins legs cover the wire-type doc comment + the skill docs). Presentation-only fix -- no functional/behavioral or wire-schema change; full battery (build/vet/test/ lint across sdk, charly, plugin-clean standalone; charly box validate; task build:binary) re-run green, live --deep --dry-run re-verified with the corrected wording. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; syntax check only)
sdk#85 round-1 pr-validator FAIL: (1) SDD zero-tolerance finding on spec/clean_wire.go (a hand-written wire struct extended with new fields -- fixed in the sdk leg by converting to sdk/schema/clean.cue, zero consumer change needed here), (2) an attribution-tier self-contradiction between the sdk leg's CHANGELOG/commits (syntax check only) and its PR body (fully tested and validated) -- the actual proof (this repo's destructive --deep purge + check-commands-local bed, both already executed and independently cross-checked by the fresh sdk validator) supports the higher tier. This commit: repoints the sdk gitlink to the CUE-converted head and the plugins gitlink to its matching go-skill fix (clean.cue now cited as LANDED in the generation-coverage list, alongside a stale buildctx claim on the same line corrected in the same sweep); reconciles this repo's own CHANGELOG trailer to fully tested and validated, since it is the SAME evidence chain the sdk leg cites. Re-verified against the new sdk head: go build/vet/test ./charly/... green (144.3s, full suite), task build:binary clean, charly box validate exit 0, and a fresh `charly clean --deep --dry-run` against this host's real store still exits 0 with the corrected wording -- proving the CUE-generated wire types work end-to-end identically to the hand-written ones they replace. No .go source in this repo changed. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
sdk#85 merged: main 52e7a09, tag v0.2026202.1944 (fresh validator round-2 PASS, incl. an independent live re-run of the --deep --dry-run proof). feat/clean-deep is deleted upstream in sdk post-merge, so the branch-head pin 0ecfe18 this repo previously carried is now unreachable -- repoint to the merged main SHA. charly/go.mod's github.com/opencharly/sdk require bumped to v0.2026202.1944 (version-string edit only -- the in-tree replace github.com/opencharly/sdk => ../sdk makes this cosmetic for local resolution; go mod tidy deliberately NOT run, per the wave-1 ledger's standing guidance that a full charly standalone tidy pollutes go.mod with candy/plugin-* workspace-only pseudo-requires). Delta re-gate against the merged head: task build:binary clean (no go.work.sum drift), go build/vet ./charly/... clean, go test -count=1 ./charly/... green (136.0s, full suite), charly box validate exit 0, and a fresh live charly clean --deep --dry-run against this host's real store exits 0 with the identical corrected wording -- the merged sdk head behaves identically to the pre-merge branch head it replaces. No other source changed. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
… leg lands AFTER this PR (docs-last ordering); its gitlink bump rides the next landing Assisted-by: Claude Code (Anthropic Claude Fable 5; analysed on a live system) Claude-Session: https://claude.ai/code/session_015CXB8CkzwZeXPzbqKjsuYj
pr-validator — APPROVED ✅Change class: charly-or-sdk Go — cross-repo consumer leg (sdk producer merged first, plugins docs leg deliberately follows). Head verified: Checklist
Comments considerednone (PR carried zero comments). Cross-PR interactions consideredOne other open PR in DecisionPASS. Every rule verified independently — not from the author's word: rebuilt the binary from the true HEAD, re-ran the full Go battery (build/vet/test/lint/gofmt) clean at zero warnings, cross-checked the disposable bed evidence on disk against the actual Proceeding to Phase 3: finalize the merge-time CalVer, merge, and tag. Assisted-by: Claude Code (Anthropic Claude Opus 4.5; fully tested and validated) |
pr-validator: rename the CHANGELOG placeholder to the merge-time CalVer (generated at merge, per policy — author-time stamps collide/mis-order across concurrent PRs). Assisted-by: Claude Code (Anthropic Claude Opus 4.5; fully tested and validated)
Both were true-sounding facts about shared mutable state, asserted without the identifiers that would have made them falsifiable. 1. "main is drift-red" — FALSE, and it was never true. main pins plugins at 396e4bfe, and aa80ca9f (#174) is NOT an ancestor of it, so the gitlink predates #174: main's candy sources are pre-sweep AND its pinned plugins tree is pre-#174, two halves of one older state, which is what a clean drift check reports. The eight-artifact red only appears in a checkout with plugins/ ahead of the gitlink and candy sources not yet swept — an ordinary working tree, never a committed state of main. Recorded as a rule, because the mechanism generalises: `charly marketplace drift` and `charly docs drift` answer a question about the CHECKOUT they ran in — candy sources on disk versus the submodule tree on disk — not about any commit. A submodule checkout floats independently of its gitlink, so "the gate is red on main" means nothing until main's exact tree is reconstructed (superproject commit plus each submodule at its PINNED sha). The urgency framing this produced is removed from the entry and the PR body: the generated half was pending at the plugins tip, which is a queue, not a breakage. 2. "both gitlinks are their submodule's current tip" — half false, and already false when written. docs ee3d162e was the tip; plugins aa80ca9f was not — 4458a400 (#176) had merged minutes earlier, and ab1f93d3 has landed since. The pin is a strict ancestor of the tip, so the FORWARD MOVE claim (the one that matters for correctness) stands unchanged; only the word "tip" was wrong. Restated as "descendant of what main carries", which does not decay. Both corrections applied to the CHANGELOG and the PR body, and the whole entry re-swept for sentences leaning on the removed premise rather than only the two quoted in review. That re-sweep caught a third, smaller instance: this correction's own cross-reference said "see below" for a section that sits above it. Now cited by heading, per the same rule. CHANGELOG-only; no code, config, gitlink or DOCS_REF change, so the bed run and every gate figure in the entry stand unchanged. Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
An earlier revision of this entry — written at my own request for a disclosure — stated that landing the projections leaves main drift-red until this PR carries their source. That is FALSE and it stated it about main, in an artifact of record. Verified mechanism: marketplace drift compares candy sources against the plugins tree AT THE SUBMODULE CHECKOUT, and main pins plugins at 396e4bfe, which is not a descendant of either #174 (aa80ca9f) or #176 (4458a40). Main's source and its pinned tree are both pre-projection, so the gate is green on it, and landing a projection does not move a superproject gitlink. The true statement: the gap is PENDING AT THE PLUGINS TIP and materializes only when a superproject leg bumps the gitlink past those commits — the leg that advances the pointer owns carrying the matching source. The red state is reproducible only in a working tree whose plugins/ is fetched past the gitlink, which is not main. Both traps are kept because both are correct and independently useful: a drift result is a fact about a CHECKOUT (measuring main means reconstructing main's tree with submodules at their gitlink, not their own origin/main), and the 'clean (N artifacts)' line prints only on the clean path so its absence is not evidence. Assisted-by: Claude Code Anthropic Claude Opus 5 (documentation reviewed) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
Summary of changes
The superproject/consumer leg of the
charly clean --deepcutover: theuntagged-image store-purge verb, closing a CLI-only-mandate gap surfaced by
issue #173's investigation (host store at 3,552 images / 132.6GB / 97%
reclaimable — ~2,700 untagged multi-stage intermediates invisible to the
existing charly-labeled sweep). Producer leg MERGED: sdk#85 → 52e7a09
(v0.2026202.1944, the CUE-sourced clean wire). Docs leg (plugins) lands AFTER
this PR per docs-last ordering; this PR pins plugins at merged main beb2eda.
candy/plugin-clean/command.go:--deepflag (explicit-category gate —never fires on plain
charly clean); pure unit-testedcleanCategoriesselection; report uses
kit.HumanByteswith the "up to X (shared layers mayreduce actual reclaim); pair with --invalidate" labeling (the R1-corrected
estimate semantics).
charly/retention.go: dangling-sweep refactored into ONE shared engine(
listDanglingImagesstubbable var, pureselectDanglingImages,pruneDanglingImages(engine, onlyCharly, dryRun)) — the charly-labeled andstore-wide sweeps are thin wrappers (R3), same InUse/live-build backstops.
check-commands-local bed gains the
clean-deep-dry-run-runscheck step.Change class
charly-or-sdk Go — cross-repo consumer leg. Order: sdk#85 (MERGED) → this
PR → plugins docs PR (after).
How R10-tested — exact gate, commands, and pasted output
verb exercised BOTH destructively and dry-run on the real store + full Go
battery.
2026.202.1916 (includes the NEW clean-deep-dry-run-runs step) — binary built
from this branch.
task build:binaryat every stage (incl.post-repoint delta re-gate: build/vet + full
go test ./charly/...green136.0s +
charly box validateexit 0 + a fresh live dry-run on the mergedsdk pin).
charly clean --deepran on this host's real store (orchestrator-run, underthe operator's standing outdated-image authorization, backstops verified via
dry-run first): removed 68 untagged images, 3552→3484, 132.6GB→128GB. The
dry-run path ran repeatedly incl. after the CUE conversion and after the
repoint (identical output).
shared-state dispatch path changed.
Attribution tier
fully tested and validated— the new verb executed live (destructive +dry-run) on fresh rebuilds, plus the composing bed.
Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)git-workflow loaded before work.
predicted vs 4.6GB actual) RCA'd to shared-layer accounting and fixed
in-cutover (labeling + pairing note across CLI/wire-doc/skills/CHANGELOG);
battery and bed at zero warnings.
a documented reason (no cheap per-layer refcount API); nothing parked
silently.
podman image prune→charly clean --deepin the strict-policy table, landing inthe docs leg).
clean_wire.go swept there; no stale references here (grep clean).
plugins-gitlink ordering fix landed as a new commit, no amend.
charly versionmatched;no new runtime OS deps.
disposable: true; NEW coverage thatfails without the change: the bed's clean-deep step + cleanCategories/dry-run
unit tests.
LIVE store before landing. ADE — plugin-clean plan/description updated,
charly box validateexit 0. SDD — the wire is CUE-sourced (sdk#85'sround-2 conversion; TestGenReproducible green).
only change is a behavior-preserving refactor of the existing retention file
(tracked K-wave inventory, no new capability in core).
operator's standing authorization for outdated-image removal with
InUse/live-build backstops.
this head (isolated caches).
CHANGELOG/2026.202.1610.mdstaged (placeholder; finalize atmerge; tag v<YYYY.DDD.HHMM>).
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
https://claude.ai/code/session_015CXB8CkzwZeXPzbqKjsuYj