Repository navigation
feat(clean): ingest the pre-relocation image store instead of abandoning it (#30) - #32
Conversation
…ing it opencharly/sdk#556 moved the image store from W3.6's data root ($XDG_DATA_HOME/charly/images) into the cache root's registry store. It moved the reader and the writer; it left the CONTENT behind, at a path nothing resolves any more, so on a host with build history hundreds of GiB became invisible to every charly verb (#30: 311 GiB, 202 entries, measured). The retirement record now carries that root as a second row, and its disposal is an INGEST, never a removal: every entry is re-published into the registry store — blobs hardlinked where the two trees share a filesystem and copied otherwise (reported either way), each descriptor re-keyed into the current entry shape — every entry and every reference is VERIFIED in the destination, and only then is the source tree removed. Nothing is dropped, so there is no keep set and no state surface can make it unsafe; the refusals are about the bytes it moves (an unreadable index, an entry with no reference, a manifest the tree does not hold) and each names itself. charly clean --store then applies D-STORE-7 to the ingested content. There is no data-root resolver and this adds none: D-STORE-1 (DESIGN.md:2482) declares four roots and data is not one (spec#375 reverted RootData), so the pre-relocation path is a RECORDED LEGACY FACT, spelled once in the retirement record and expanded by one function that resolves no store and feeds no reader. Refs: #30 Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
…know The dry-run line asserted "copied" because Linked is the zero value when nothing ran. It now says both cases, since a figure that reads as a measurement while being an unset field is the class of report this category exists to avoid. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
The row test carried two throwaway assignments (a cache root it never used, and a zero-value spec.RetentionRequest) and an import that existed only for the second. The cache-root arm now asserts the resolved directory instead, through CHARLY_CACHE_DIR which the fixture injects. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
The ingest refuses an index that names no entries while the tree holds blobs, and an entry whose manifest the tree no longer holds. Both were documented and untested, so the body's coverage claim was ahead of the diff. Each now has an arm with a red mutation (an index naming nothing, and the presence check skipped). Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code/config (Go plugin + tests, candy ADE step, docs). Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
WAITING — this PR is the blocked side; it names the block, the counterpart, and what clears it. Blocked by: What is blocked: the consumer side — a charly pin bump that carries this plugin. The R10 bed for What clears it: On the counterpart comment: Part II #11 asks for the matching Next update: with the next push on this branch, or when the block clears. Agent: clean-retention |
Review — PASSHead SHA: Security screen: PASS — no secrets, no exfiltration, no network surface, no guardrail weakening; the change is a local filesystem/store transform in a candy, and the candy Checklist: All applicable rules PASS or NA. Placement is CORRECT (capability in the Comment dispositions:
Non-blocking note (rulebook gap, not a stated obligation): the body's "Change classification" says "Rollback is Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
Successor to #31, which the validator auto-closed at its 5-verdict threshold
after each of its findings had been fixed and re-run. Same branch, same head; the only change is this
body naming its predecessor (Part II #7's carry-forward).
charly clean --cachenow disposes of the pre-relocation image store at the data root, which thestore relocation abandoned (
opencharly/plugin-clean#30: 311 GiB and 202 entries on this host, at apath no charly verb could name, report or reclaim). The disposition is an ingest, not a removal:
every entry is re-published into the cache root's
registrystore, verified there, and only then isthe source tree removed.
The home, and why it is not
migrateThe obvious reading — a one-time legacy reshape belongs in
charly migrate's declarative table — doesnot survive the engine: every
apply:hook incandy/plugin-migrateisfunc(*yaml.Node) bool(
engine.go'sgoHooks), i.e. a YAML-document transform applied per file. The engine has no seam fora filesystem/store operation, so landing this there would mean inventing a second execution class in
migrate— a bigger cutover than the issue, and one that would put content-addressed store surgery ina plugin whose engine knows only YAML. So the work stays in
plugin-clean, where the store readers,the reference discipline and the report already live, and the retirement record — the mechanism whose
whole purpose is "a path a previous version wrote, why it is superseded, and where its content went" —
gains one row.
The resolver question, answered explicitly
There is no data-root resolver, and this change does not add one.
D-STORE-1(DESIGN.md:2482)declares four roots — config, cache, state, runtime — and data is not among them;
spec/storeroot'sRootDatawas reverted for that reason (opencharly/spec#375). Asking the contractto name
$XDG_DATA_HOME/charlyagain would re-introduce a root the contract removed.What remains is a recorded fact about a dead version: an old charly wrote its image store under
$XDG_DATA_HOME/charly/images. That fact is spelled once, as path ELEMENTS in the retirementrecord (
retiredCacheRoots()→{Name: "data-images", Place: retiredInLegacyDataRoot, Elems: ["charly","images"]}), and expanded by one function (legacyDataRoot) which resolves no store,feeds no reader, and is called by the retirement sweep and nothing else. Every cache-root row keeps
resolving through
storekit.StoreDir; nothing about the live roots changed.Why ingest, and not "keep what state references and evict the rest" in place
The issue allows either. The in-place eviction needs a per-entry reachability walk over the legacy
layout, whose descriptors are OCI image manifests rather than storekit entry manifests — a third
reader, and a second implementation of the image-graph walk that storekit owns privately. It would also
be the only disposition in this package that deletes artifacts on the strength of a keep set, inside a
category (
--cache) that has no budget, no live-build guard and no refusal discipline of its own.Ingest needs no keep set at all, and that is the point: nothing is dropped. Every descriptor is
re-keyed into the current entry shape (its payload is the artifact index naming the legacy manifest, so
every later reader walks it with the same code), its blobs are materialized into the destination
(hardlinked where the trees share a filesystem, copied otherwise — reported either way), every entry
and every reference is verified in the destination, and only then is the source removed. The result
is not a smaller store; it is a store the policy can SEE —
charly clean --storethen appliesD-STORE-7(DESIGN.md:2488) to it, in the category that owns that judgement.The refusals are about the bytes it moves, and each names itself: an unreadable
index.json, an indexthat names no entries while the tree holds blobs, an entry with no
io.containerd.image.name, and anentry whose manifest the tree does not hold. No state surface is consulted, so none can make the
transform unsafe — the strongest form of the issue's property 3.
Files
candy/plugin-clean/legacy_store.gocandy/plugin-clean/retention.goPlace/Elems,legacyDataRoot,retiredRootDir, the ingest dispatchcandy/plugin-clean/command.gocache retired data-images:line (ingested/would-ingest, entries, bytes, destination, link-or-copy)candy/plugin-clean/legacy_store_test.gocandy/plugin-clean/retired_roots_test.goXDG_DATA_HOMEcandy/plugin-clean/charly.ymlclean-legacy-data-root-presentADE stepREADME.md,.agents/skills/clean/SKILL.mdHow tested
The gates, on this head
Four commits:
f231c1a(the ingest and the record row),74c921d(the dry run no longer asserts alink/copy outcome it cannot know),
2808e0a(vestigial statements dropped from the row test) andb85add3(the two documented refusals get their arms). Everything below was run onb85add3.The covered properties, each failing without its change
mutArestores #30's defect (the record does not reach the data root),mutBturns the ingest into ablind
RemoveAll,mutCturns an unreadable legacy store into an empty one:The other arms in
legacy_store_test.gopin idempotency (the second run reports the path absent anddoes nothing), the dry-run report (names path, entries and bytes; touches neither store nor source),
and each refusal with its own red arm: an unparseable index (
mutC), an index that names no entrieswhile the tree holds blobs (
mutD), an entry with no reference annotation, and an entry whose manifestthe tree no longer holds (
mutE).The live arm — a real legacy store, the shipped binary, both runs
The binary is the plugin's own dual-mode entrypoint built from this head:
(
./cmd/servecarriessdk.Main(NewProvider(), NewMeta(), CliMain), so the same file is the pluginserver and the out-of-process CLI — which is why the commands below invoke
charly-clean-legacyandnot
serve.) The legacy tree is the W3.6 shape (image-manifest descriptors annotated with thereference), under an injected
XDG_DATA_HOME, with an injectedCHARLY_CACHE_DIR:Nine blobs in the destination for the two entries, and the arithmetic is the fixture's, not a guess:
2 layers + 1 shared config (both fixtures write the same
{"architecture":"amd64","os":"linux"}config bytes, so content addressing stores it once) + 2 image manifests + 2 artifact-index payloads +
2 entry manifests = 9. The old graph came across (layers, config, manifests) and the new entry shape
was written beside it (indexes, entry manifests), all reachable — the store reports nothing
unreferenced afterwards.
Rulebook compliance
R0 — the area's skills were loaded before acting:
/charly-core:clean,/charly-internals:plugin,/charly-internals:go,/charly-internals:git-workflow,/charly-internals:strict-policy,/charly-internals:root-cause-analyzer,/charly-internals:cutover-policy,/charly-check:check,/charly-internals:disposable,/charly-internals:local-infra,/charly-core:charly-status, and —because the home question turned on it —
/charly-build:migrate, whose own text is what settled thechoice (
apply:hooks are YAML transformers).R1 — the anomaly is the issue's: a relocation that moved reader and writer and left the content
behind, with no acceptance for "what happens to the bytes at the old home". Fixed here; the missed
control (a relocation needs a third leg beside add and delete) is named in the issue and answered by
the retirement record now carrying the destination. The dry-run line's false "copied" was found while
taking the live arm and fixed in
74c921d(a figure that reads as a measurement while being an unsetfield). No new findings to file; nothing deferred.
R2 — one implementation per behaviour: one record (
retiredCacheRoots), one resolver(
retiredRootDir), one blob materializer (materializeLegacyBlobs), one report branch. The ingestreuses
storekit's own writers (PutBlob/PutEntry/BlobPath/Entries/Lookup) rather thanre-implementing any store mechanism, and the legacy path appears in exactly one place.
R3 — no sleeps, retries or magic numbers; the one fallback is cross-device (EXDEV), which is a
real filesystem fact, is reported as "copied", and is followed by removing the source so one copy
remains. No
podman/systemctl, no hand-built store.R4 — product before prose: the transform and its report are the product's, and the docs follow
it —
README.md, the authoredcleanskill and the candy description now describe the ingest(see the
Filestable above).R5 — nothing is deleted from the legacy tree before its content is verified elsewhere; the one
name that disappears is the retired root itself. The pre-relocation path drives RESOLUTION in
exactly one place: the record's
Elems, expanded bylegacyDataRoot. The path STRING also appearsin prose — doc comments, the candy description, the record's own
Reason, and a test comment — whichthe grep below shows in full rather than hides: a reader can check the claim instead of trusting it.
What must not exist — and does not — is a second place where the path is RESOLVED, or a hand-built
cache-root path beside
storekit.StoreDir.$ git grep -n "XDG_DATA_HOME" -- candy/plugin-clean
candy/plugin-clean/charly.yml:154: the image store out of W3.6's data root ($XDG_DATA_HOME/charly/images) it moved the reader
candy/plugin-clean/legacy_store.go:8:// (
$XDG_DATA_HOME/charly/images) and into the ONE cache root as the namedregistrystore — thecandy/plugin-clean/legacy_store_test.go:7:// Every arm isolates BOTH roots (CHARLY_CACHE_DIR for the store, XDG_DATA_HOME for the legacy tree)
candy/plugin-clean/legacy_store_test.go:111: t.Setenv("XDG_DATA_HOME", dataRoot)
candy/plugin-clean/retention.go:303: // retiredInLegacyDataRoot — a path a PREVIOUS version wrote under
$XDG_DATA_HOME/charly, which thecandy/plugin-clean/retention.go:308:// legacyDataRoot resolves
$XDG_DATA_HOME(else$HOME/.local/share) — the PRE-RELOCATION data root,candy/plugin-clean/retention.go:315:// a version that is gone: an old charly wrote its image store under
$XDG_DATA_HOME/charly/images.candy/plugin-clean/retention.go:320: if v := strings.TrimSpace(os.Getenv("XDG_DATA_HOME")); v != "" {
candy/plugin-clean/retention.go:363: Reason: "the IMAGE store at the pre-relocation DATA root (
$XDG_DATA_HOME/charly/images), abandoned " +candy/plugin-clean/retired_roots_test.go:27: // arm exercises its own root and never the operator's
$XDG_DATA_HOME/charly/images.candy/plugin-clean/retired_roots_test.go:28: t.Setenv("XDG_DATA_HOME", t.TempDir())
candy/plugin-clean/retired_roots_test.go:55: t.Fatalf("the legacy data-root row is present in an isolated XDG_DATA_HOME: %+v", dry[1])
bed: check-commands-local
calver: 2026.322.1610
driver_version: 2026.322.1604
total_seconds: 572
ok: true
status: PASS
[deploy-add] PASS 43.6s · [bring-up-members] PASS 2ms
[check-live] PASS 7m33.406s · [update] PASS 40.195s
[cleanup] PASS 37.425s · [cleanup-members] PASS 0s
PASS (steps=6)