Skip to content

fix(bed): the overlay builder bed ensures its base image too - #90

Merged
github-actions[bot] merged 9 commits into
mainfrom
feat/unified-builders
Nov 22, 2026
Merged

github-actions[bot] merged 9 commits into
mainfrom
feat/unified-builders

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The overlay builder bed ensured only ONE of the two images its deploy needs. overlay-builder-image-present builds and asserts overlay-npm-builder, but the bed's subject (pod-overlay-builder) uses overlay-base as its image, and nothing built that. On a host where overlay-base had not been built, or had been cleaned since, the run died before rendering anything:

charly: error: command "deploy": deploy-dispatch add: deploy plugin: deploy-dispatch add:
prepare venue: InvokeProvider deploy:pod op=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, 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 || true clause. That clause could not fail — || true swallowed every outcome — so it asserted nothing; the box inspect overlay-npm-builder that 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 validate at the repo root:

charly box validate: OK — checked 3 candies, 2 boxes, 9 deploys, 6 distros, 7 builders; 0 warnings, 0 errors

And the bed itself, on a host where overlay-base had been removed — the case that failed before the fix:

charly check run check-overlay-builder: [deploy-add] PASS after 4.176s
charly check run check-overlay-builder: [check-live] PASS after 30.752s
charly check run check-overlay-builder: [update] PASS after 2.122s
charly check run check-overlay-builder: [cleanup] PASS after 2.103s
charly check run check-overlay-builder: PASS (steps=6)

PASS  the builder image the overlay's stages will name is PRESENT before the deploy runs …
PASS  `charly deploy add` … renders the overlay Containerfile with the builder stage BEFORE its main FROM and the payload COPY after it …
PASS  the disposable deploy is removed again, so the bed leaves nothing running  [overlay-builder-cleaned-up]

Rulebook compliance

  • R0: /charly-check:check (bed authoring, disposable: true, the ensure-first ordering), /charly-internals:git-workflow.
  • R1: the finding is this fix — the bed failed on a cold host at image not found in local storage: overlay-base; root cause: the ensure step built only the builder image; fixed here, not filed.
  • R2: no duplication — one ensure step builds exactly the two images the deploy names.
  • R3: no workaround, sleep or retry; the ensure step builds what the deploy needs instead of assuming leftovers exist.
  • R4: the fixture is the fix; no prose routes around it.
  • R5: the never-failing box list | grep -q ... || true clause is deleted, with its removal stated above.
  • R6: git status clean before the push; feat/ branch; no force-push; the advanced main merged, never rebased.
  • R7: the bed is the coverage: it failed before the change on a host without overlay-base, and passes after, with the same assertions on the render.
  • R8: the real engine and images run; nothing mocked.
  • R9: nothing installed; the charly used is a worktree-local build.
  • R10: charly check run check-overlay-builder on this head, pasted above (6 steps, PASS).
  • R11: no DESIGN shape touched; a bed's ensure step only.
  • Footer provenance: the 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

  • Change class: test fixture (a disposable bed's ensure step).
  • Attribution tier: fully tested and validated — the bed that failed on a cold host now passes on one, and the corpus validates.
  • Breaking change + rollback: none; a bed's ensure step. Rollback: revert this squash commit.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)

…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)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 4fe7368e544f94923d3c9fdf9024eac95eb39196 (branch: feat/unified-builders)
Change class: test fixture / bed config (charly.yml ensure step)

Blocks

  1. A1 — body is missing the required Project-rulebook rule-compliance section. The body supplies ## Summary, ## How tested, and ## Change classification, but no rule-by-rule compliance section answering the applicable rules (R0–R11, and any DESIGN D-<AREA>-<n> the change touches) with a one-line HOW or N/A — <reason>. The template requires this section for every applicable rule; a missing section is a defect, not an NA. Add it.

  2. A1 — Summary does not account for the removed box list ... | grep -q overlay-npm-builder || true clause (charly.yml:112). The diff both adds the overlay-base build/inspect and drops the old box list grep (which was a no-op because of || true). The body describes only the addition. Every diff item must be accounted for: state that the never-failing box list assertion was removed and why.

  3. A3 — attribution footer names an internally inconsistent harness/model pair. *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)* pairs the Anthropic "Claude Code" harness (also named in the Agent: line) with a DeepSeek model id, and the body supplies no runtime evidence corroborating the provider/model. Under A3 the full model name must be verifiable and not guessed; correct the footer to the real harness and full model name (or, if the body is model-free, use the model-free form).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 4fe7368e544f94923d3c9fdf9024eac95eb39196 (branch: feat/unified-builders)

Security screen: PASS — one-line change to a bed's ensure step in charly.yml; no secrets, no network/egress, no gate/rulebook/validator modification, no supply-chain or scope mismatch.

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:

  • Comment 7084303537 (block, by @github-actions[bot]) — stale-superseded on all three counts: (1) the CURRENT body carries a full ## Rulebook compliance section answering R0–R11; (2) the CURRENT body explicitly states the removal of the box list … | grep -q … || true no-op clause and why (also under R5); (3) the CURRENT body supplies footer provenance for the Claude Code / deepseek-v4.1-flash pair ("the model id that runtime reports to the session … recorded as reported rather than guessed"), so the "no corroboration / guessed name" premise no longer reproduces against the current state.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 22, 2026 19:24
@github-actions
github-actions Bot merged commit f9291db into main Nov 22, 2026
5 of 6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant