Repository navigation
fix(bed): the overlay builder bed ensures its base image too - #90
Conversation
…ox build does plugin-deploy-pod's half of the unified builder mechanism (opencharly/sdk#608, D-IR-1): a pod overlay whose add_candy closure carries a stage builder candy (npm, pixi, mise, aur) now builds. Before, the overlay appended each builder step's fragment after `FROM <base>`. That fragment was the builder's stage (`FROM arch-builder AS <candy>-npm-build`), so the stage opened mid-file: everything after it, the final USER included, went into the builder stage, which became the overlay image, and no line copied the builder's payload back. The ref was also the bare route value (`arch-builder`), which podman could not resolve. Measured with a disposable pod composing an npm candy onto arch: `short-name "arch-builder" did not resolve`. Now, through the Generator the image build uses: - the builder images the overlay's stages name are ensured first (Generator.NeededBuilderImages, then the existing dispatchBuildEnsurePeer), so a builder box nobody built locally is built from its project entry. This runs before anything is created under .build/, because a building ensure regenerates that tree and prunes non-box directories, the overlay dir included (measured: the Containerfile write then failed ENOENT); - the builder stages are hoisted before `FROM <base>` (EmitBuilderStages, with its fail-loud pre-pass and the builder box resolved to its image), and each payload is copied in right after it (EmitBuilderArtifacts). The step stream installs only a declared package output (plugin-installstep). Live proof (dev charly over every branch, this plugin and the builder plugins via CHARLY_PLUGIN_DIR, a disposable pod): - `deploy add` exits 0 with `Overlay image ready: overlay-probe-overlay:590f20064cb8`; - the overlay Containerfile has `FROM ghcr.io/opencharly/arch-builder:2026.325.2239 AS npm-probe-npm-build` before `FROM <base>`, and `COPY --from=npm-probe-npm-build --chown=1000:1000 /home/user /home/user` after it; - in the running pod, `charly cmd` lists `/home/user/.npm-global/bin/cowsay -> ../lib/node_modules/cowsay/cli.js`. The pod was then removed with `charly deploy del`. Found along the way, and filed, not fixed here: the first `charly config` after `deploy add` drops resolved_image and runs the base image (#84, reproduced on main). engine_ops_test: the two HOME-isolating tests also point XDG_CONFIG_HOME under the temp home. Current spec resolves the systemd user dir through XDG_CONFIG_HOME first, and this package's TestMain sets it package-wide, so TestWriteSystemdUnitConfig_Containerd looked in the wrong root (it fails on main against current spec). The Containerfile layout is one pure function, overlayMainStage: the service and builder stages before the main FROM, then USER root, each builder's payload, and the candy tasks. TestOverlayMainStageHoistsBuilderStagesAndCopiesPayloadsAfterTheMainFrom fails when a builder stage is opened after the main FROM (the pre-fix shape), and when a payload is copied after the candy tasks. Claude-Session: https://claude.ai/code/session_01Tvdn3vtn8FoWTMqGwqn4ZT Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942 Assisted-by: Claude Code Claude Opus 5.5 (analysed on a live system)
Review block on #85: the only added test exercised the pure overlayMainStage layout, so deleting the actual wiring left it green. The wiring is now one function, emitOverlayBuilders, which drives the Generator the image build uses, and TestEmitOverlayBuildersDrivesTheGeneratorsBuilderPath asserts that a needed builder with no resolved stage is REFUSED with the candy and the builder named — an outcome only the real EmitBuilderStages call can produce. Removing both builder calls fails it; so does opening a builder stage after the main FROM. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
…t it Review block on #85: the ensure-first loop had no test, and the dead noVocab variable was left in a new test file. prepareOverlayBuild now holds the two first steps in their load-bearing order, and TestPrepareOverlayBuildEnsuresBuilderImagesBeforeCreatingTheDir drives it with a stub build:ensure: every needed builder image is ensured, the overlay dir does NOT exist yet at the moment each ensure runs (the .build prune that motivated the ordering), a failed ensure stops the build, and the dir is created after. Deleting the loop fails it, as the pasted mutation shows. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
Review block on #86: `ensureStub.dir` was assigned but never read. The stub records only the overlay dir's existence at ensure time, so the field goes. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
Review block on #86: inserting prepareOverlayBuild left one contiguous comment block above it, so emitOverlayBuilders' doc was attached to the wrong function. Each function now carries its own. The body also gains the third mutation it was missing: the layout test fails when a builder stage opens after the main FROM, alongside the ensure-loop deletion and the Generator-wiring removal. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
…ator's resolver seam Review block on #87: deleting only the EmitBuilderArtifacts call was uncovered, because the refusal test reaches the stages error first. The Generator exposes ResolveDetectionBuilderStage, the same seam sdk's own tests use. The new TestEmitOverlayBuildersEmitsThePayloadCopyWhenAStageResolves stubs it with a reply carrying a stage and a COPY, declares the builder externalized as the host does, and requires BOTH halves out of emitOverlayBuilders — so deleting only the artifacts call fails it, as the pasted mutation shows. Four mutations now cover the four new behaviours. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
Review block on #88: the overlay builder render had no live proof, and no bed in this repo composed the path at all (#68). The bed needs a base and a builder box it can compose WITHOUT registry auth, because #65 blocks pulling a published charly image (HTTP 403). So the harness builds both locally from `docker.io/library/fedora:43`: - `candy/npm-toolchain` — the producing candy: node/npm on the fedora base, with a build-context check that npm is on PATH. An image's `produce: [npm]` NAMES what it can build; the composed candy is what installs the toolchain (distro-arch's shape). - `overlay-npm-builder` — `produce: [npm]`, `candy: [npm-toolchain]`, `distro: [fedora]`. - `overlay-base` — the base box, routing `builder: {npm: overlay-npm-builder}`. - `candy/overlay-builder-probe` — a candy whose package.json is what makes an image NEED the npm builder. - `pod-overlay-builder` — a disposable pod deploy with `add_candy: [overlay-builder-probe]`. - `check-overlay-builder` — the bed: the builder image is present before the deploy (the ensure-first ordering), the deploy renders the overlay Containerfile with the builder stage BEFORE the main FROM and the payload COPY after it, the overlay image is built, and the disposable deploy is removed again. Measured on this host: the render produces FROM overlay-npm-builder:<calver> AS overlay-builder-probe-npm-build (line 7) FROM localhost/overlay-base:<calver> (line 18) COPY --from=overlay-builder-probe-npm-build --chown=1000:1000 /home/user /home/user (line 23) and `charly deploy add` reports `Overlay image ready: pod-overlay-builder-overlay:…`. The bed is 3 of 3 steps PASS. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
The bed's first check builds `overlay-npm-builder` and asserts it resolves, but the
deploy it gates uses `overlay-base` as its image — and that image was never ensured.
On a host where `overlay-base` had not been built (or had been cleaned) the run died
before rendering anything:
charly: error: command "deploy": … prepare venue: rpc error: code = Unknown desc =
plugin-deploy-pod prepare-venue: overlay build: image not found in local storage: overlay-base
The check now builds and asserts BOTH images before the deploy runs, so the bed is
self-contained on a cold host instead of depending on an earlier run's leftovers.
Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)
# Conflicts: # charly.yml
Review — BLOCKHead SHA: Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — one-line change to a bed's ensure step in Checklist: All applicable rules PASS or NA (A1–A3, R0–R11, ARCH/QUAL/DISP/COORD NA for a bed-config fixture with no core/sdk/candy placement or Go surface). Comment disposition:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The overlay builder bed ensured only ONE of the two images its deploy needs.
overlay-builder-image-presentbuilds and assertsoverlay-npm-builder, but the bed's subject (pod-overlay-builder) usesoverlay-baseas its image, and nothing built that. On a host whereoverlay-basehad not been built, or had been cleaned since, the run died before rendering anything:The check now builds and asserts BOTH images, so the bed is self-contained on a cold host instead of depending on an earlier run's leftovers.
The same edit removes the old
... | grep -q overlay-npm-builder || trueclause. That clause could not fail —|| trueswallowed every outcome — so it asserted nothing; thebox inspect overlay-npm-builderthat follows it is the assertion that actually holds.Found while re-running the bed on a newer charly binary for opencharly/charly#1231's evidence.
How tested
charly box validateat the repo root:And the bed itself, on a host where
overlay-basehad been removed — the case that failed before the fix:Rulebook compliance
/charly-check:check(bed authoring,disposable: true, the ensure-first ordering),/charly-internals:git-workflow.image not found in local storage: overlay-base; root cause: the ensure step built only the builder image; fixed here, not filed.box list | grep -q ... || trueclause is deleted, with its removal stated above.git statusclean before the push;feat/branch; no force-push; the advancedmainmerged, never rebased.overlay-base, and passes after, with the same assertions on the render.charly check run check-overlay-builderon this head, pasted above (6 steps, PASS).Agent:/Assisted-by:lines name the harness the session runs in (Claude Code) and the model id that runtime reports to the session (deepseek-v4.1-flash:cloud), recorded as reported rather than guessed.Change classification
fully tested and validated— the bed that failed on a cold host now passes on one, and the corpus validates.Agent:
kde-cstream· Claude Code session25c0bf9d-28ad-4716-bc1b-5ca2118cc942Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)