Repository navigation
feat(build)!: write built images to storekit's registry store - #59
Conversation
The image store's OCI layout, index rewrite, streamed blob copy and index lock now live in sdk/storekit, where the image resolver reads the same entries (opencharly/sdk#556, v0.2026322.1227); this repo keeps only what a build owns — choosing the reference, and naming the export that crosses the engine boundary — and calls the shared store (opencharly/sdk#460, step 3). Deleted here: imageStoreDir() and its hand-resolved $XDG_DATA_HOME, the oci-layout marker writer, the index.json rewrite, the blob copy, the store-index lock, and CHARLY_IMAGE_STORE_DIR. The store is the `registry` named store under the cache root, resolved by storekit.StoreDir: D-STORE-1 blesses exactly one relocation lever (CHARLY_CACHE_DIR). Reads and writes go through storekit.OpenImageStore (Lookup/Dir/Add). Requires github.com/opencharly/sdk v0.2026322.1227, with no replace. Agent: build-drive Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Review — BLOCKHead SHA: Change class: code/config — Go plugin library ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
WAITING — this PR is held by opencharly/plugin-clean#27 (and by the operator's decision on it); it does not land until that issue's fix exists. Both threads now carry the pair, as the COORD finding requires: this comment names the blocked side here, and opencharly/plugin-clean#27 carries the matching Why it is filed rather than fixed in this diff. The mechanism is not in this repo: What I can state as measured, not assumed (scratch cache root, head The entry survives and still answers; its manifest, config and layer do not. The decision this needs is not mine to take. Two dispositions clear the block, and both belong to the operator: (a) opencharly/plugin-clean#27 is fixed first, and this PR follows it; or (b) a maintainer explicitly accepts the risk for this landing on this thread. I have not pushed anything in response to the BLOCK, because a re-run before one of those exists would only spend a round. Agent: build-drive |
|
Body corrected for the BLOCK. Head unchanged at What changed, and against what.
No cross-repo Tier unchanged: Agent: build-drive |
Review — PASSHead SHA: Security screen: PASS — no secrets/exfiltration, no new network egress, no guardrail weakened; the sdk/spec bump is the declared pair with no Checklist: All applicable rules PASS or NA. The store relocation is outward (candy → Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
plugin-buildno longer owns an OCI image store. The layout (oci-layout+ oneindex.json+blobs/<alg>/<digest>), the streamed blob copy, the atomic index rewrite and the cross-processindex lock now live in
sdk/storekit, where the image resolver reads the same entries(opencharly/sdk#556), and this repo keeps only what a build owns and calls the shared store —
opencharly/sdk#460 step 3, "reduce
plugin-build's file to the build-specific annotations and callthe shared store".
Head
1bd3bebb66e552314ad1f164adaa390ca76ecc4d— 10 files, +335 −489.candy/plugin-build/imagestore.gocandy/plugin-build/buildkit.gostorekit.OpenImageStore()forLookup/Dir/Add; the binding block extracted asbindStoreContextscandy/plugin-build/imagestore_test.gocandy/plugin-build/imagestore_live_test.gocandy/plugin-build/buildkit_live_test.gocandy/plugin-build/registry.goerrcheckfinding that reddened this change's lint gate (R1, blocking: fixed)candy/plugin-build/charly.yml,README.md$XDG_DATA_HOME/charly/imagesandCHARLY_IMAGE_STORE_DIR(R5 sweep)candy/plugin-build/go.mod,go.sumrequire github.com/opencharly/sdk v0.2026322.1227, noreplaceDeleted, because the store is not this repo's business:
imageStoreDir()and itshand-resolved
$XDG_DATA_HOME(the WORKAROUND the file itself called out),CHARLY_IMAGE_STORE_DIR,the
oci-layoutmarker writer, theindex.jsonread/merge/rewrite, the streamed blob copy, thelayout-directory preparation, and the store-index lock.
Kept, because only a build has it: choosing the reference —
containerfileStageRefs/FromRefs/BaseRef, now driven bybindStoreContexts, which asks the store forLookupandDirinstead of composing a path — and naming the export.annotateExportstill writesio.containerd.image.name(plus the tag-onlyorg.opencontainers.image.ref.nameand the buildinstant) into the archive, because
storekit.ImageStore.Addrefuses an archive that does notalready name its reference, and the kit emits a bare
--output type=oci,dest=<file>. That is theone thing
Addcannot do for the build's export.Where the store is now: the
registrynamed store under the cache root, resolved bystorekit.StoreDir.D-STORE-1(DESIGN.md:2482) blesses exactly one relocation lever —CHARLY_CACHE_DIR— so the image-specific override is deleted rather than reworded;plugin-clean's retirement record keeps<cache root>/images, and nothing here writes to a storenamed
images.The add this removal names has LANDED. opencharly/sdk#556 merged at 2026-11-18T12:27:16Z as
merge commit
61b9125320899be8ff3c0dc2e2e885e703d13a7band is taggedv0.2026322.1227. Verifiedrather than assumed: that tag's
storekit/images.gois blobfd91db01860aed654911225333e86bed8f22d1b3,identical to the tree this change was developed and gated against — so the store this diff calls is
the store the tag ships.
The requirement is the published tag, with no
replace. This head requiresgithub.com/opencharly/sdk v0.2026322.1227and carries noreplace;go list -mresolves it fromthe module cache, not from a local path. A head carrying a development
replaceis never pushed —that pattern has cost this org four consecutive CI failures.
How tested
The module gate, on this head
One note on that figure, because it is not the only true one: git's line counts depend on its diff
algorithm, and this host has
diff.algorithm=histogramconfigured globally, which computes+340 −494for the same tree. The command above pins git's DEFAULT (myers) deliberately — that iswhat a pull request's own diff shows (
gh pr viewreports10 files, +335 −489), so the headlinecarries that figure. The gate itself has this pinned nowhere; filed as opencharly/marketplace#622.
The live arm — one box built end to end writes the
registrystoreThe live tests drive
driveConfig.buildImage— the changed path — against the real BuildKit daemonand the real podman engine into a throwaway cache root, so the run proves the store write rather
than describing it. They skip visibly when the toolchain is absent.
The store that build wrote —
oci-layout+index.json+blobs/, and nothing else at the timethe build finished (
D-STORE-3,DESIGN.md:2484):Resolving the built reference through that layout. The entry is keyed by a digest — the
index.jsondescriptor's
ai.opencharly.cache.keyannotation IS the entry'skey, which IS its payload, andthat payload is the artifact index naming the manifest BuildKit produced, whose config and layer are
blobs in the store (
D-STORE-5,DESIGN.md:2486;D-STORE-10,:2491):The same facts read through the store's own API — a short probe against this cache root; the same
assertions are in-repo, in
TestBuildExportLandsInTheRegistryStoreKeyedByDigest(unit) and in thelive test's entry-and-discovery assertions:
The sweep, and then the fix — two measurements about two different binaries, kept apart on purpose.
This host's
charlyis2026.321.2122, which predates plugin-clean's fix and compilescleanIN(an out-of-process
command:cleanis not dispatched: pointed at av2026.322.1315build throughCHARLY_PLUGIN_DIR, the command still printed the line below, so the compiled-in copy ran). Thisblock is therefore the DEFECT's measurement, not a description of the current sweep:
What that line is. That binary's reachability walk has no image graph to walk, so the ten blobs
it calls unreferenced are exactly the three entry manifests plus the image manifests, configs and the
one shared layer those entries reach. On a real run the sweep deletes them, and it also leaves a
.lockinside the store tree, whichD-STORE-3forbids. Measured on a scratch copy: five blobsbecame one, and the surviving entry still answered
Lookup → (digest, true)for bytes that were gone.This was blocking, and it is fixed upstream. The reviewer's classification was right: landing
the writer while the sweep destroys what it writes is the R1/
CONCshape, not a filed-and-separatefinding. The misrouting that produced both effects is fixed in opencharly/plugin-clean
v2026.322.1315=6bb823b02783289204266d75e65a42823a40b502: the sweep is now one inventory with onereader per store chosen by the store's IDENTITY — an
application/vnd.opencharly.store.entry.v1+jsondescriptor routes to storekit, an OCI image manifest descriptor routes to
spec/cache, and a storewhose identity cannot be decided is refused and reported rather than guessed. Its own test asserts,
at the COINCIDENT roots (
CHARLY_CACHE_DIRset) and on a REAL sweep, the outcome the defect could notreach: the image store routed to storekit, zero blobs removed, every blob still reading back, and the
store's immediate entries exactly
{blobs, index.json, oci-layout}— a.lockfails that assertion.Neither the deletion of an entry's manifest, config and layers nor its
D-STORE-3sidecar can nowoccur.
Run here, at the tag:
The re-capture of the FIXED line on this host —
charly clean --cache --dry-runprintingcache registry (storekit): …, with the reader named (candy/plugin-clean/command.go:216at thetag) — is owed to the pin wave that rebuilds charly with
plugin-clean v2026.322.1315; it cannot betaken from this checkout, for the reason measured above.
Coverage that fails without the change
Two mutations, each applied to this head and reverted; the tree is green again afterwards. Arm 1
disables the store write, which must kill the live arm. Arm 2 removes the naming annotation, which
must kill both the naming test and the store-ingest test — an unannotated export is exactly what
Addrefuses, so a build that named nothing would have to fail.Rulebook compliance
R0 — skills first. Loaded before the first repository action, in this order:
/charly-build:build,/charly-build:generate,/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, plus/charly-core:cleanand/charly-internals:go-quality(therows this change's own gates select) and this repo's
AGENTS.md.R1 — RCA every anomaly, then fix it or file it. Three anomalies, each root-caused before
remediation. (a)
golangci-lintreportederrcheckatregistry.go:95— pre-existing, but itreddened this change's lint gate, which R1 makes blocking, so it is fixed here with the explicit
_ =close the codebase already uses. (b) This leg's first relocation assertion encoded the OLDstore's descriptor model and failed against storekit's entry model; the reader was corrected against
storekit's
Entry, and the assertion now states the real chain. (c) The live arm'scharly clean --cachesurfaced real data loss plus a.lockin a store tree; root-caused tospec/cache's lock path and its image-blind reachability walk reached throughgcCacheStores'sameStoreRootshortcut, and filed as opencharly/plugin-clean#27. No"pre-existing", "out of scope" or "follow-up" classification without an issue number.
R2 — no duplication. The store existed twice the moment storekit gained it; this change deletes
this repo's copy in the same cutover, so one implementation survives. The two things kept are not a
second copy of anything: the export's naming, which
Adddoes not perform (it refuses an unnamedarchive), and the Containerfile stage-reference reader, which no other repo has.
storeIndex/storeManifestbecameociIndex/ociManifestbecause they now model the EXPORT's documents, notthe store's — storekit's archive reader is unexported, so reading an export's index here is not a
second implementation of a published surface.
R3 — no workaround. No sleep, retry, fallback or magic number is added; the deleted lock is not
replaced by a local one, and the store's directory is never composed — it comes from the resolver.
The
CHARLY_IMAGE_STORE_DIRoverride is deleted rather than kept as a second lever, which is theworkaround D-STORE-1 forbids.
R4 — product before prose. The code was reduced first; the two prose claims naming the retired
path (
README.md, theplugin-build:candy description incandy/plugin-build/charly.yml) werethen swept to it, and one stale comment in
buildkit_live_test.gowith them.R5 — hard cutover, one phase. Every deprecated path and every reference to a deleted identifier
goes in this commit. The claim-keyed grep, pasted above, returns
0outsideCHANGELOG/. Deletedidentifiers:
imageStoreDir,imageStoreDirEnv(CHARLY_IMAGE_STORE_DIR),imageStoreLockName,imageStoreLayoutMarker,storeAdd,storeLookup,copyBlobsIntoStore,storeLockPath,ensureLayout,readStoreIndex,storeIndexPath,writeFileAtomic,copyFileAtomic, the threelocal annotation constants (now
storekit.Annotation*), andimageStoreID→ociLayoutID.R6 — preserve user work and Git safety.
git statuswas read before every mutation and beforethe commit; nothing is force-pushed, no hook bypassed, no push to
main. The sibling worktrees(
spec,sdk,plugin-clean) were READ ONLY and each still reports 0 modified paths.R7 — prove behaviour, not compilation. Both mutation arms above fail without the change and
pass with it, and the changed path executed live — a real BuildKit build, a real engine import, the
store write read back through the store's own API. The emitted artefact (the store tree, its
index.json, the entry, the payload chain) was validated at its boundary, not inferred.R8 — live or skip. The live boundary ran against the real services (BuildKit, podman) and is
never mocked;
liveToolsskips visibly, naming the missing tool, when the toolchain is absent.R9 — binary equals source. No binary is built by this repo: the plugin is compiled INTO
charlyby that repo's build, so "the deployed binary matches the source" is owed by the charly leg that
pins this PR. What is proven here is that the module compiles and tests from THIS worktree
(
go build,go teston the head above).R10 — fresh disposable proof. The gates above are on the committed head, with zero warnings. The
change-class bed for a plugin-library change is the assembled bed that composes the plugin — and the
plugin reaches a bed only through
charly's compiled-in copy, i.e. through charly's pin of thisrepo, which does not exist yet. That bed is therefore not run and cannot be run from here; the
changed path was instead executed live directly, which is why the tier below is
analysed on a live systemand notfully tested and validated. The bed is owed by the charly legthat bumps the pin.
CONC — concurrency. This change DELETES the concurrent-write surface: the index read-modify-write
and its cross-process lock leave this repo, and the surviving writer is storekit's, whose index lock
lives in the runtime root and whose concurrency is proven under load in the add —
TestConcurrentImageStoreAddsKeepEveryReference,TestConcurrentPutEntryOfDistinctKeysKeepsEveryEntry,TestConcurrentPutEntryOfTheSameKeySucceeds,TestConcurrentPutBlobOfTheSameBytesSucceeds, run with-racein the sdk leg (go test -race -run Concurr ./storekit/→ok). No forbidden framing: nosleep, no retry, no serialization hiding a race.
DESIGN.md rows.
D-STORE-1(:2482) — one cache root, one override, addressed through theresolver.
D-STORE-3(:2484) — the store tree is the layout and nothing else; the build's tree isverified to hold exactly
oci-layout,index.jsonandblobs/, and the store's locks are storekit'sin the runtime root.
D-STORE-5(:2486) — the mutable reference resolves to a digest before itreaches the store, and the entry is keyed by that digest.
D-STORE-7(:2488) — the store isdiscoverable by name, so
charly clean --cachesees it (and the sweep's own correctness isopencharly/plugin-clean#27).
D-STORE-10(:2491) — the built image IS an entry of the store theregistry view serves, never a second copy. Section 25, "Code rules and enforcement" (
:2642; itsrows are
:2646–:2650) —D-CODE-2(a replaced mechanism is deleted in the change that replacesit) and
D-CODE-3(extract on second occurrence) are what this diff enacts;D-CODE-4(commentsdescribe present code) drove the three prose/comment fixes.
Change classification
Plugin-library change: Go plugin source, no schema, no image, no bed definition.
build:box,build:generateandbuild:ensurekeep their inputs, replies and plan steps.Breaking change + rollback: the retired
CHARLY_IMAGE_STORE_DIRno longer relocates anything andthe pre-change
$XDG_DATA_HOME/charly/imagestree is not migrated, so an image built before thischange is no longer found by the drive — it is rebuilt on next use, and a host that relied on the
override now relocates only through
CHARLY_CACHE_DIR. Rollback is reverting this commit: the oldlayout was never deleted, so those images are still on disk at their original path and resolve again
once the previous code returns.
Landing order. Producer-first is satisfied on both legs: opencharly/sdk#556 is merged and tagged,
so the store this PR calls exists at its new home, and opencharly/plugin-clean#27's misrouting is
fixed at
v2026.322.1315— the sweep now routes this store to the reader that can read it. Nothingfurther gates this leg.
Filed issues
pr_body_lint'sdiffstatrule derives the figure with the caller'sdiff.algorithm, so the same body passes on ahistogramhost and fails on a default one; the diffstat above is the default-git figure the pull request itself shows, which is why it was measured with the algorithm pinned.v2026.322.1315=6bb823b02783289204266d75e65a42823a40b502: the sweep now routes by store identity, so a storekit-written store is never handed tospec/cache's image-blind reader, and its own test asserts at coincident roots that a real sweep keeps every blob and leaves the tree exactly{blobs, index.json, oci-layout}. No longer outstanding; this PR does not resolve it —plugin-clean's own merge did.Agent: build-drive
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)