Repository navigation
fix(deploykit): label ai.opencharly.box with the box's LEAF name, not the namespace-qualified key - #136
Conversation
… the namespace-qualified key buildBakedMetadata set meta.Box from the Generator's Boxes map KEY, which for a box reached through an `import:` namespace is qualified (`fedora.fedora-nonfree`). The image REF is not: buildkit.ResolveBox descends into the namespace, so FullTag reads `ghcr.io/opencharly/fedora-nonfree:<tag>`. The image was labelled with a name no ref of it ever carries. Every consumer keys the label and the ref name together, so they must agree: spec/container's local-image resolver matches its label family on exactly that equality and discards the name family whole, so a namespaced build was invisible to a resolve of its own image name and an older bare-labelled image won — how `charly check box fedora-nonfree` came to certify a stale artifact and report all-green. plugin-clean's retention groups by the same label, so one box's builds split into two keep_images groups depending on how it was named at build time. meta.Box = spec.LeafName(boxName), and the same in the data-image label block. spec.LeafName is the codebase's existing namespace stripper — the one the ref builders already use — so the label is derived exactly the way the ref is. Unqualified keys (non-imported boxes, synthesized intermediates) are unchanged. kit re-exports the new resolver surface (ResolveBuiltImageRef, ResolveLocalImage, LocalImageResolution, ErrStaleLocalImage) so plugin call sites keep kit.X. Coverage: TestBuildBakedMetadata_BoxLabelIsLeafName asserts the emitted label equals the trailing repo segment of the ref that same build produces; fails on the pre-fix body (emits `fedora.fedora-nonfree`). R8, live: after the fix, `charly box build fedora.fedora-nonfree` emits ai.opencharly.box=fedora-nonfree, read back with `charly box labels`. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
|
|
| merged squash SHA | bbb3c6a2c8428a98a55c3acd919b11b7f921b3a1 |
| release tag | v2026.227.1854 |
| Go-module tag | v0.2026227.1854 |
go get github.com/opencharly/[email protected]
GOWORK=off go build ./... # must exit 0
I minted the v0. tag as part of tagging that merge, since the Go-consumable form is what a consumer pins. I am not making the go.mod change myself: a dependency pointer that must reference its producer's merged SHA is precisely the edit that needs an independent check, and if I authored it and then merged this PR, nobody would have checked it. Same reasoning the orchestrator applied to the superproject gitlinks.
One thing to look at while you are in there
v0.2026225.1800 — the version currently pinned — resolves to 2b620ff65, which is not reachable from spec/main. It is an orphaned pre-squash commit that survives only because the module proxy still serves the tag. Worth confirming the new pin does not repeat that: v0.2026227.1854 points at bbb3c6a2c, which is the squash-merge commit on main, so it is reachable — but the check is git merge-base --is-ancestor <tag-commit> origin/main, not the tag's existence.
Everything downstream (plugins#173, docs#55, charly#278) is held behind this.
…ols it did not depend on
kit/local_image.go re-exports four symbols spec introduces in this same batch
(ErrStaleLocalImage, LocalImageResolution, ResolveLocalImage,
ResolveBuiltImageRef), while go.mod still pinned a spec predating them. At the
module boundary the package did not compile:
GOWORK=off go build ./...
kit/local_image.go:28:31: undefined: spec.ErrStaleLocalImage
... three more
Pinned to v0.2026227.1854, the Go-module tag on spec's merged squash bbb3c6a2c,
verified with `git merge-base --is-ancestor <tag-commit> origin/main` rather than
by the tag resolving — the proxy will serve a tag whose commit has left the
branch.
Why five rounds of green gates missed it: go.work's `use ./spec` overrides the
module pin in-tree, so an in-workspace build resolves against the local spec/
directory and never reads go.mod. This module is the plugin CONTRACT — its real
consumers are out-of-tree and resolve through the proxy, the one configuration
nothing exercised. Same shape as the tautological guard and the non-hermetic
label test in this batch: a gate that cannot fail on the thing it names.
Gate: GOWORK=off go build ./... exit 0, GOWORK=off go vet ./... exit 0, and
GOWORK=off go test ./... green across all 8 packages — all at the module
boundary, plus the in-workspace suite still green.
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
Correction — my
|
Renames the placeholder CHANGELOG stamp to the CalVer generated at merge (UTC, `date -u`) and rewrites its H1 to match. Documentation only. Assisted-by: Claude Code Anthropic Claude Opus 5 (documentation reviewed) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
Summary of changes
The render labelled an imported box's image with a name no ref of that image ever carries, which is what made
charly check box <box>certify a stale artifact and report all-green. This is the emitter half of the fix; the resolver half isopencharly/spec#29, the call sites areopencharly/charly.buildBakedMetadatasetmeta.Box = boxName, whereboxNameis the Generator'sBoxesmap KEY. For a box reached through animport:namespace that key is QUALIFIED —fedora.fedora-nonfree. The image REF is not:buildkit.ResolveBoxdescends into the namespace (sdk/buildkit/config_resolve.go:69) and resolves the box under its leaf name, soFullTagis built as<registry>/fedora-nonfree:<tag>(:190). Measured on the live store:ghcr.io/opencharly/fedora-nonfree:2026.227.0836carriedai.opencharly.box=fedora.fedora-nonfreewhile…:2026.216.1908carriedfedora-nonfree.Every consumer keys the label and the ref name together, so they must agree:
spec/container.ResolveLocalImage's label family is exactlyimg.Labels[LabelBox] == <short>, and the election discards the name family wholesale when the label family is non-empty. A namespaced build was therefore invisible to a resolve of its own image name, and an older bare-labelled image won.candy/plugin-clean's retention groups by the same label, so one box's builds split into twokeep_imagesgroups depending on how the box happened to be named at build time. (Retention's ORDERING within a group had a second, destructive defect on the same root cause — it is fixed in the superproject half of this batch, not left open.)Concrete edits:
deploykit/render_prep.go—meta.Box = spec.LeafName(boxName), with the invariant and its consequence stated in a comment.deploykit/generate.go— the same in the data-image label block (the second emission site; R3, both or neither).kit/local_image.go— re-export the new resolver surface (ResolveBuiltImageRef,ResolveLocalImage,LocalImageResolution,ErrStaleLocalImage) so plugin call sites keep theirkit.Xspelling, matching this file's established re-export pattern.deploykit/baked_box_label_test.go— new.spec.LeafNameis the codebase's existing namespace stripper — the one the ref builders already use (kit.ResolveShellImageRef(registry, spec.LeafName(image), "")) — so the label is now derived exactly the way the ref is, rather than by a second rule that can drift. Unqualified keys (every non-imported box, and every synthesized intermediate) are unchanged.Change class
cross-repo —
charly-or-sdk Go.Landing order (producer → consumer):
spec→sdk(this PR) →plugins→docs→charly.opencharly/spec—#29, the resolver + theErrStaleLocalImagesentinel. Must merge before this PR:kit/local_image.gore-exports symbols it introduces.opencharly/sdk— this PR.opencharly/plugins,opencharly/docs— regenerated skill + site page.opencharly/charly— the three call sites, the check skill source, the gitlink bumps.How R10-tested — exact gate, commands, and pasted output
charly check run <bed>on a bed that exercises the changed path, plus per-modulego test/golangci-lint. The bed ischeck-marketplace, chosen deliberately: its plan runscharly box labels marketplace-apphost-side with a BARE short name, so it is the bed that could actually REGRESS from the companion guard and the one whose verdict depends on this label being right. Picking the bed that can fail is the point.check-marketplace | pod | ok | 13 steps | 370s— run calver.check/check-marketplace/2026.227.1148/, binarycharly version=2026.227.1116(the one binary every step below ran on). Single-bed gate: every bed'simage-buildstep exercises this emitter identically, andcheck-marketplaceis additionally the only bed whose plan CONSUMES the label through an unpinned short-name resolve. Not a concurrency-class change (see below), so no roster batch.task build:binaryand./bin/charly versionreports2026.227.1116; no.gofile under the changed packages is newer thanbin/charly. The bed's ownupdate(97s) +check-live-rebuild(37s) legs are the fresh-rebuild gate and both passed, at ZERO warnings.buildBakedMetadataran in a realcharly box buildof a NAMESPACE-QUALIFIED box (fedora.fedora-nonfree) — the exact input that used to emit the wrong value — and the label was read back off the built image. One caveat, stated plainly: inopencharly/charlyone of the three call sites (box feature run) could not execute because that verb is unreachable for a separate pre-existing reason, which caps the cutover's tier atanalysed on a live system. Nothing in THIS repo's diff is unexecuted.N/A— this is a pure string derivation inside label emission. It takes no lock, mutates no shared state, and touches neither the loader walk, the deploy ledger, the resource arbiter, nor any build lock.Attribution tier
analysed on a live system.Every changed path in THIS repo executed live against the fresh rebuild — the label emitter ran for a namespace-qualified box, the emitted Containerfile was inspected, and the label was read back off the built image. The tier is nevertheless not
fully tested and validated, because the cutover spans repos and one of its three call sites inopencharly/charly(box feature run) could not be exercised: that verb is unreachable on a clean baseline (it routes to the top-levelcharly featuregrammar) and its hidden engine leafcheck __feature-boxis not reachable either — verified, not assumed. The table requires changed paths executed live; one did not, so the whole cutover claims the lower tier.Stated so the validator is not misled in the other direction: the lower tier's own wording ("the complete fresh-rebuild R10 did not pass") understates this case — the R10 bed DID pass. The downgrade rests purely on that one unexecuted call site.
Trailer:
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system).Harness rulebook compliance — state HOW each is satisfied
/charly-internals:plugin(this repo's contract + the boundary law),/charly-internals:go,/charly-check:check,/charly-build:build(the label/CalVer contract this emitter implements),/charly-internals:git-workflow,/charly-internals:strict-policy.podman image inspecton both families showed the two differentai.opencharly.boxvalues, andcharly box inspect fedora.fedora-nonfreeshowedname = fedora-nonfree/full_tag = ghcr.io/opencharly/fedora-nonfree:…against a map key offedora.fedora-nonfree, which is the divergence in one output. Further anomalies surfaced mid-work and were each RCA'd before classification, none dismissed as flake (see R2). Bed output has zero warnings.candy/plugin-clean's retention sort sharing this cutover's ordering blind spot — was found late and FOLDED INTO this cutover rather than named as separable, because it is the only surface here that DESTROYS an artifact rather than producing a false answer, and it consumes the same struct on the same root cause. The other three are RCA'd to file:line, named in the superprojectCHANGELOG/<CalVer>.md, and each has an assigned owner. Most relevant here: an imported box bakes NOai.opencharly.descriptionat all, becausedeploykit.CollectDescriptionsreachescfg.BoxConfig(boxName)/cfg.WalkBaseChain(boxName)— flat map lookups with no namespace descent — so the plan label is omitted entirely for every namespaced box. That is the SAME root-cause family as this fix, in the same package, and I deliberately did NOT widen into it: the fix is making the whole deploykit collector family namespace-aware, an architectural change, and the orchestrator has opened it as its own cutover with an owner. This PR fixes the label identity only.ai.opencharly.boxhas exactly TWO emission sites (render_prep.go's baked-metadata gather andgenerate.go's data-image block) and both were changed together — fixing one would have left the identity rule split. No new helper:spec.LeafNameis the existing canonical stripper, so there is now one namespace rule, used by both the ref builders and the label emitter.git grep 'meta.Box = boxName'returns nothing; both sites now readspec.LeafName(boxName). No transitional or dual-mode path in the final code — there is no flag or fallback preserving the old label value.git statuschecked before every destructive action; the temporary fix-revert used to produce the failing-test proof was restored withgit checkout -- <file>and the tree re-verified0 dirty. One amend was taken (the tier correction) — legal, the branch had not been pushed; the superproject gitlink was then re-pointed at the amended SHA.charly check run check-marketplaceend to end, not justgo test. Output pasted above.charly box labels(both pasted) — not an empty or missing label, and not merely a source-level assertion.task build:binary,charly version=2026.227.1116,find <changed pkgs> -name '*.go' -newer bin/charlyempty. No new runtime OS dependency, sopkg/arch/PKGBUILDis untouched.check-marketplaceisdisposable: true; no non-disposable target touched. Fresh rebuild via the bed's ownupdateleg, zero warnings. Coverage that fails without the change is pasted above.box inspectbefore any edit, rather than read out of the code. ADE —N/Afor this repo (no candy in the diff). SDD —N/A, no.cueedit and no schema-shaped type changed;spec.BakedLabelSetis CUE-generated and its SHAPE is untouched, only the VALUE assigned to an existing field.N/A — no kernel change.sdk/deploykitis the render kit, not core; nothing moved towardcharly/, andcharly/import purity is unaffected (this repo is the SDK thatcharly/must NOT import, and no newcharly/dependency is created).check-marketplacebed, declareddisposable: true. The R8 verification created image TAGS only and destroyed nothing.gofmt -l .empty;golangci-lint run ./...→0 issues;go vetclean;go test ./...green across all six packages.CHANGELOG/2026.227.1157.mdstaged — placeholder CalVer, the pr-validator finalizes it at merge.Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)