Skip to content

fix(deploykit): inject the active init's depends_candy into a box's composition - #119

Merged
atrawog merged 5 commits into
mainfrom
feat/init-depends-candy-injection
Aug 3, 2026
Merged

atrawog merged 5 commits into
mainfrom
feat/init-depends-candy-injection

Conversation

@atrawog

@atrawog atrawog commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

The defect

Declaring a service: in a candy is what SELECTS an init system and assembles its config — but nothing installed the selected init's own binary.

With a box composing only ripgrep + sshd (nothing bringing supervisord), measured before the fix:

  • charly box validate → passes
  • charly box build → succeeds; /etc/supervisord.conf assembled, ai.opencharly.init="supervisord" set, but no supervisor package installed
  • charly check box → passes (the service probe is context: [runtime], skipped at image scope)
  • charly check run <bed> → FAILS at [start]. fallback_entrypoint: [sleep, infinity] did not mask it.

The init vocabulary already declared the dependency correctly (supervisord → depends_candy: supervisord; systemd → none, since every machine venue already has one). DependsCandy was decoded and carried through the resolve envelope, then read by exactly ONE consumer — a validator that waived itself for dual-init candies, which is the shape the layer skill recommends everywhere and exactly what candy/sshd is. Nothing injected it into composition.

The fix

New deploykit.InjectInitDependsCandy(boxes, layers, initCfg) — the ONE shared pass (R3), mirroring ComputeIntermediates's (boxes, layers) shape.

Placement. The decision needs BOTH the box set and the candy graph — which candies trigger which init is a whole-composition question — so it cannot live in buildkit.ResolveBox, which resolves ONE box in isolation and deliberately carries no candy map. That decoupling (documented on buildkit.ResolveOpts) is respected, not changed.

Target-awareness is structural, not a flag. The active init comes from InitConfig.ResolveInitSystem — the SAME resolution that decides ai.opencharly.init and drives the render. A container resolves to supervisord (injected); a preserve_user/bootc machine venue resolves to systemd, which declares no depends_candy, so nothing is added. A blanket require: supervisord on service candies would be the WRONG fix for exactly that reason: target-blind, it would install supervisord onto systems that already have an init.

Why the companion validator deletion is safe

The superproject leg deletes validateInitDependencies and its four helpers. That is only defensible if injection makes the missing-init case impossible on every path that composes a box — not merely the build path. It does, and here is the full accounting.

buildkit.ResolveBox is the ONLY place a box's Candy list is set (config_resolve.go, resolved.Candy = …). So every composition path funnels through one of three seams, and all three inject:

Seam Feeds Wired in
ResolveAllBox's returned map build / generate superproject leg (candy/plugin-build/resolve.go), after ResolveAllBox, before ComputeIntermediates/GlobalCandyOrder/RenderPrepAll. Also covers the pullNamespacedBox + resolveNamespacedBases entries, which write into that same map
ProjectResolvedProject fresh-box loop validate, inspect, bundle-deploy this PR (loaderkit)
FillNamespaceBoxViews import-namespace boxes this PR (deploykit)

Two consequences worth stating explicitly, because they are what close the argument:

  • Bundle-deploy needs no separate call. candy/plugin-bundle's resolveBoxSelection reads rp.Boxes[req.BoxRef] from the resolved-project envelope — the very envelope the second seam produces — rather than re-resolving. Same for the add-candy-on-box overlay shape, which reads rp.Boxes[req.BaseBoxRef].
  • A local:/VM deploy composes no box at all. Those substrates compile a candy list into an InstallPlan; there is no ResolvedBox, so there is nothing for the guard to have checked. On a machine venue the active init is systemd, which declares no depends_candy anyway.

The third seam was found by auditing rather than assumed — an import namespace's boxes are resolved from the namespace's OWN config and reach NEITHER of the other two, so without it a namespaced box would have its init RESOLVED by the following RenderPrepBox (baking ai.opencharly.init) while its init candy was never added: the very defect this closes. ResolveSpecBox / ResolveAllSpecBoxes / WrapSpecBoxes have no production consumers — they are dead surface, not an open question. Named exit: the dead-code batch cutover, which also carries charly/kernel_manifest_floor_test.go:175, whose prose still describes deploykit.ResolveSpecBox as live and rides along with the deletion. They are deliberately NOT deleted here: that would widen a deploy fix into a public-API removal with its own blast radius, and this cutover's R10 neither exercises nor changes verdict on their removal (the R2 separability test).

The deleted code had zero test coverage — git grep for the five removed identifiers across *_test.go returns nothing. That is part of why the defect survived: the guard was never exercised, and its dual-init waiver was never questioned.

And the replacement seam had the same hole, now closed. Review mutation-tested it: replacing the InjectInitDependsCandy call in ProjectResolvedProject with a no-op left EVERYTHING green — the sdk suite, the superproject's go test ./charly/..., and plugin-build / plugin-bundle / plugin-box. The R10 beds do not close it either: the build path reaches the injection through the FIRST seam, and the superproject leg deletes the validator, so a silent no-op at the second seam was invisible. Shipping a fix for a zero-coverage defect with the same hole in the fix is not a thing this PR is going to do — loaderkit/resolve_project_test.go now seals it (see Verification).

The loaderkit fresh arm now projects its views in a SECOND pass, because the injection rewrites img.Candy and ProjectResolvedBox copies that list into the view. That refactor also collapsed two byte-identical projection blocks into one closure (R3).

Two RCAs worth reading

  1. TestValidate_PortRelayMissingSocat broke. Injection manufactured an "unknown candy" error that masked the socat error under test. The injected candy must actually be in the scan — an absent one is now a no-op, since a project without it could not install that init by any route.
  2. Injection silently no-opped on box/fedora while every unit test stayed green. BareCandyRef strips only the @ and the :version suffix, so a REMOTE candy is keyed by its full repo path (github.com/opencharly/charly/candy/supervisord) while the vocabulary names it supervisord. Now resolved via GetName(). Caught by reading the emitted Containerfile (R8), not by the tests — regression test added.

Verification

  • go build ./... + go test ./... green in charly, sdk, spec, and every candy module (in-workspace and GOWORK=off for out-of-process ones).

  • gofmt -l empty. Binary rebuilt with task build:binary; every command run through that worktree's ./bin/charly.

  • 9 tests in deploykit/init_depends_test.go: both directions, remote-key, idempotence, transitive require:, unreachable-candy no-op, and the namespaced-box path. Verified to FAIL with the implementation stubbed out, and the namespace test verified to fail with only that seam removed.

  • NEW loaderkit/resolve_project_test.go — the second seam, which the tests above cannot see: they all call the pass DIRECTLY, so they stay green if ProjectResolvedProject silently stops calling it. The test runs the genuine resolve -> inject -> project chain through the real buildkit.ResolveBox and asserts the projected view (rp.Boxes["tutorial-shell"].Candy) carries the init candy — sealing both halves of the wiring: the call itself, and the second-pass projection ordering the call forced. It lives in loaderkit so the coverage sits with the seam; the fixture cost was ~4 lines, since deploykit.NewSpecCandyModel is exported and the seams are plain func fields.

    Mutation-verified, both directions of the wiring. Neuter the call at loaderkit/resolve_project.go:117:

    --- FAIL: TestProjectResolvedProject_InjectsInitDependsCandy (0.00s)
        resolve_project_test.go:95: projected view must carry the injected init candy, got [sshd]
    FAIL	github.com/opencharly/sdk/loaderkit	0.005s
    

    Move the projection back into the resolve loop (single-pass, pre-injection list) — same failure. Restored, on the caught-up tree:

    ok  	github.com/opencharly/sdk/loaderkit	0.007s
    

    Under the mutation the new test is the ONLY failure across go test -count=1 ./... — which is exactly the point: nothing else in the module was watching that call.

  • Doc-comment scope correction on InjectInitDependsCandy: the presence check reads the box's OWN resolved order (ResolveCandyOrder with a nil parentCandies), NOT its base chain, so a child whose BASE installs the init candy still gains it. Harmless for the artifact — GlobalOrderForBox filters a base-provided candy back out at render — but rp.Boxes[child].Candy can then name a candy the child does not itself install, and the comment now says so instead of claiming the chain is checked.

R10, both directions, on the final tree:

charly check run check-tutorial-shell: PASS (steps=13)

container direction — tutorial-shell composes only ripgrep + sshd, supervisord arriving PURELY by injection. Artifact proof: ARG BASE_IMAGE=ghcr.io/opencharly/fedora-supervisord:..., whose Containerfile runs dnf install -y supervisor. This bed FAILED at [start] before the fix.

charly check run check-migrate-local: PASS (steps=6)

machine venue — host: local, disposable: true.

Re-run on the caught-up tree (round 3). The paragraph that stood here said the outputs came from the tree at 60c1a1c and argued the later commits could not affect them. That argument was probably right, but it is an argument where a run was available, and a reviewer correctly declined to waive this PR's own gate on it. Both beds were therefore re-run on the current tip:

charly check run check-tutorial-shell: PASS (steps=13)
charly check run check-migrate-local:  PASS (steps=6)   BED EXIT=0

Zero warnings. go build ./..., go vet ./..., gofmt -l, go test -count=1 ./... clean, and the seam-2 mutation re-run post-merge with the same result: neutering loaderkit/resolve_project.go:117 fails TestProjectResolvedProject_InjectsInitDependsCandy and nothing else; restoring it goes green. Both outputs are now in the CHANGELOG entry too, since a merged entry is immutable and a PR body is not.

Round-3 correction — a false citation. The CHANGELOG named charly/kernel_manifest_floor_test.go as prose still describing deploykit.ResolveSpecBox as live. That file does not exist: it was deleted from superproject main at 21ab450b, about an hour before this PR's first commit, and charly/import_purity_test.go:6 records the deletion. I cited a file I had not opened. The real residue is cross-repo — spec/schema/resolvedproject.cue:331-332 and spec/schema/buildwire.cue:238 plus their generated twins — which strengthens the case for keeping the dead-code deletion out of this chain rather than weakening it.

Systemd direction, stated precisely: there is no preserve_user/bootc box anywhere in-tree, so no machine-venue IMAGE exists to assert on. Structurally the injection touches only box resolution, and local:/VM deploys compile candies rather than boxes, so it is unreachable there; the one machine-venue path that does go through box resolution is covered by TestInjectInitDependsCandy_MachineVenueInjectsNothing, plus the live local bed above.

R2 routing (not this cutover)

candy/plugin-tmux TestConcurrentTmuxRunsIsolateTypedPasteAndHighVolumeOutput fails in the superproject. Causality established: it fails identically on a pristine sdk with this cutover's changes removed, and plugin-tmux imports neither deploykit nor loaderkit. Outside this cutover's R10; belongs to the next thematic batch, not parked.

Landing

Chain: spec (opencharly/spec#14) → this → box/fedora (opencharly/distro-fedora#11) → superproject. Merge after the spec leg. Tags here use the Go-module scheme v0.<YYYYDDD>.<HHMM leading-zeros-stripped>, not plain CalVer.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)

…omposition

Declaring a `service:` in a candy is what SELECTS an init system and assembles its
config — but nothing installed the selected init's own binary. A box composing only
service candies validated clean, built clean, baked ai.opencharly.init="supervisord"
and a fully assembled /etc/supervisord.conf, and then failed at deploy `[start]` with
no supervisord in the image. `fallback_entrypoint: [sleep, infinity]` did not mask it.

The init vocabulary already declared the dependency correctly (supervisord →
depends_candy: supervisord; systemd → none, since every machine venue has one).
`DependsCandy` was decoded and carried through the resolve envelope, then read by
exactly ONE consumer — a validator that WAIVED itself for dual-init candies, which is
the shape the layer skill recommends everywhere. Nothing injected it into composition.

New deploykit.InjectInitDependsCandy is the ONE shared pass (R3). It mirrors
ComputeIntermediates's (boxes, layers) shape and lives beside it because the decision
needs BOTH the box set and the candy graph: which candies trigger which init is a
whole-composition question, so it cannot live in buildkit.ResolveBox, which resolves
ONE box in isolation and deliberately carries no candy map.

Target-awareness is structural, not a flag: the active init comes from
InitConfig.ResolveInitSystem — the SAME resolution that decides ai.opencharly.init and
drives the render. A container resolves to supervisord (injected); a preserve_user /
bootc machine venue resolves to systemd, which declares no depends_candy, so nothing is
added. A blanket require-supervisord on service candies would be the WRONG fix for
exactly that reason: target-blind, it would install supervisord onto systems that
already have an init.

Wired at all three box-composition paths. buildkit.ResolveBox is the ONLY place a box's
Candy list is set, so every path funnels through one of:

- ResolveAllBox's returned map — injected by candy/plugin-build's resolveBuildEngine
  in the superproject leg, which also covers the pullNamespacedBox and
  resolveNamespacedBases entries that land in that same map;
- ProjectResolvedProject's fresh-box loop in loaderkit — feeds validate, inspect and
  bundle-deploy. Its fresh arm now projects views in a SECOND pass, because the
  injection rewrites img.Candy and ProjectResolvedBox copies that list into the view;
- FillNamespaceBoxViews in deploykit — an import namespace's boxes are resolved from
  the namespace's OWN config and reach neither of the other seams; without this a
  namespaced box would have its init RESOLVED by the following RenderPrepBox while its
  init candy was never added.

ResolveSpecBox, ResolveAllSpecBoxes and WrapSpecBoxes have no production consumers.

Two properties the pass must have, both pinned by tests: it is IDEMPOTENT, so it can run
at every chokepoint without double-injecting, and it injects the candy's own MAP KEY
rather than its bare name — BareCandyRef strips only the leading marker and the version
suffix, so a REMOTE candy is keyed by its full repo path while the init vocabulary names
it bare. Resolving by key alone silently no-opped on every distro submodule, where the
init candy is always a remote ref; that was caught by reading the emitted Containerfile
under R8, not by the unit tests.

Assisted-by: Claude Code Claude Opus 5 (fully tested and validated)
@atrawog

atrawog commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

charly/pr-validator — CHANGES REQUESTED

Fresh independent evaluation. I re-derived every load-bearing claim from the tree rather than from the PR body. The completeness argument holds — I confirmed it independently, and it is the strongest part of this PR. The block is a coverage gap on one of the two seams this PR itself adds.

What I independently confirmed (all TRUE)

1. buildkit.ResolveBox is the only writer of a box's candy list. Per-submodule git grep -nE '\.Candy\s*=([^=]|$)' -- '*.go' over . spec sdk plugins box/*: the only ResolvedBox.Candy assignment is sdk/buildkit/config_resolve.go:124. Every other hit is an unrelated type (deployRec.Candy, uf.Candy, set.Candy, a test message).

2. The three seams are exhaustive. Production callers of the box resolvers, whole-tree:

Call site Covered by
candy/plugin-build/resolve.go:117 (ResolveAllBox) seam 1 — superproject leg (resolve.go:126, verified present in the super tree)
candy/plugin-build/resolve_legs.go:300 → loaderkit.ProjectResolvedProject seam 2 — this PR
sdk/deploykit/spec_box_resolve.go:125 (inside FillNamespaceBoxViews) seam 3 — this PR
buildkit/config_resolve.go:74,362,468 internal recursion; pullNamespacedBox writes into ResolveAllBox's map → seam 1
deploykit/spec_box_resolve.go:43,56 (ResolveSpecBox/ResolveAllSpecBoxes) no production consumers — confirmed (see N2)

3. Target-awareness is structural, exactly as claimed. InjectInitDependsCandy calls initCfg.ResolveInitSystem(layers, order, ""). The render path calls g.InitConfig.ResolveInitSystem(g.Candies, candyOrder, "") at deploykit/render_prep.go:69 (sets img.InitSystem) and :187 (bakes ai.opencharly.init) — the same function with the same empty explicit-override argument. There is no flag and no second resolution to drift. systemd declares no depends_candy, so a machine venue injects nothing.

4. Idempotence. Sound by construction: the second call's ResolveCandyOrder(img.Candy, …) sees the just-prepended key, so slices.Contains(order, key) short-circuits. Pinned by TestInjectInitDependsCandy_Idempotent.

5. Remote-candy keying. candyKeyForName falls back to GetName(); the direct-key hit answers the local case. Correct, and the determinism note (globally-unique candy names ⇒ at most one map match) is right.

6. The stubbed-implementation claim. Reproduced: stubbing the body to a no-op fails 3 tests —

--- FAIL: TestInjectInitDependsCandy_ContainerInjectsSupervisord
    init_depends_test.go:86: container composition must gain the supervisord candy, got [ripgrep sshd]
--- FAIL: TestInjectInitDependsCandy_RemoteKeyedInitCandy
    init_depends_test.go:208: remote init candy must be injected by its MAP KEY, got [github.com/opencharly/charly/candy/sshd]
--- FAIL: TestFillNamespaceBoxViews_InjectsInitDependsCandy
    init_depends_test.go:276: namespaced box must gain the init candy, got [sshd]

7. Hygiene. gofmt -l . empty; go build ./... clean; go test ./... green across all 8 sdk packages. PR-body attribution is correctly formed (*Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)*).


B1 — BLOCKING: seam 2 has zero coverage anywhere

loaderkit/resolve_project.go:117 — deploykit.InjectInitDependsCandy(freshBoxes, layers, initCfg) — is one of the two seams this PR adds, and it is completely unproven. I replaced that single line with a no-op (_ = initCfg), left everything else intact, and ran:

sdk           go test -count=1 ./...      → ok × 8 packages (sdk, agentkit, buildkit,
                                             deploykit, enginekit, kit, loaderkit, vmshared)
superproject  go test ./charly/...        → ok  github.com/opencharly/charly/charly  156.669s
                                             ok  .../charly/internal/pluginsgen        0.009s
candy/plugin-build                        → ok
candy/plugin-bundle                       → ok
candy/plugin-box                          → ok

Everything green with the seam deleted. The R10 beds do not close this either: the build path goes through seam 1, and the superproject leg removes validateInitDependencies, so nothing downstream would notice seam 2 silently no-opping.

This is not a cosmetic gap. Seam 2 is the arm the PR body names as feeding validate, inspect, and bundle-deploy — and candy/plugin-bundle's resolveBoxSelection reads rp.Boxes[req.BoxRef], so it drives real deploy behaviour, not just display. It is also precisely the failure shape this PR's own RCA identifies:

The deleted code had zero test coverage … That is part of why the defect survived: the guard was never exercised.

R10 requires check coverage that fails without the change; half this PR's production wiring can be deleted with the suite green. Seam 3 was verified this way by the author and seam 1 is exercised live by the bed — seam 2 needs the same treatment.

Required: a test that FAILS when line 117 is removed — assert that a fresh-resolved box (the non-preResolvedBoxes arm) comes back with the init candy in rp.Boxes[<box>].Candy. loaderkit has no ProjectResolvedProject test today, so this is a new one there (a stub seams.ResolveBox closure over buildkit.ResolveBox is enough — charly/resolved_project_host_test.go:226's testProjectResolvedProjectWithBoxes is a working template). It belongs in this leg, since the seam is sdk code.

B2 — BLOCKING (one line): the doc comment overstates the presence check

InjectInitDependsCandy's doc comment says it injects when the dependency candy "is not already in its resolved chain". The check is ResolveCandyOrder(img.Candy, layers, nil) — parentCandies is nil, so the base chain is not part of that closure. Measured, with a child whose base installs supervisord and which composes only sshd:

PROBE parent.Candy = [supervisord]
PROBE child.Candy  = [supervisord sshd]     ← injected although the base already installs it

The emitted image is unaffected — GlobalOrderForBox(img.Candy, parentCandies) filters the parent-provided candy back out at render (ResolveCandyOrder's parentCandies[name] → skip), so no duplicate install is emitted. But rp.Boxes[child].Candy (and therefore charly box inspect and the bundle-deploy selection) now lists a candy that box does not install, and the comment as written asserts otherwise. Per R1 this is a doc-vs-reality divergence on a surface this cutover authors.

Required: either make the pass parent-aware, or correct the comment to state that the presence check is scoped to the box's OWN candy closure and that a base-chain-provided init candy is re-listed and filtered back out by GlobalOrderForBox at render. The one-line comment fix is a perfectly good resolution — the behaviour itself is benign.

N2 — non-blocking, needs a named exit

The PR body and CHANGELOG state that ResolveSpecBox / ResolveAllSpecBoxes / WrapSpecBoxes "have no production consumers". Verified true (whole-tree, per-submodule): only the definitions plus two prose mentions inside charly/kernel_manifest_floor_test.go's manifest strings — no call sites. That makes three exported sdk functions dead code surfaced by this cutover. Deleting them is a ! breaking sdk-API change with a superproject prose sweep attached, so it is reasonably separable from this fix — but the standing radical-dead-code-removal rule needs an exit named, not a bare observation. Add one line to the PR body routing it to a specific batch (the manifest prose at kernel_manifest_floor_test.go:175 still describes deploykit.ResolveSpecBox as live and rides along).

Mechanics for the next round

  • The branch is BEHIND main (28590c1). Catch up with gh pr update-branch (a merge — never a rebase, never a force-push).
  • Push the fix as an ADDITIONAL commit; the status resets and I re-run.
  • Re-run the R10 beds on the final tree after the fix, per the standing gate.

No merge, no tag. Status posted as failure.

atrawog added 2 commits August 4, 2026 00:46
…_candy injection

ProjectResolvedProject's call to deploykit.InjectInitDependsCandy had zero
coverage anywhere: replacing it with a no-op left the whole sdk suite, the
superproject's go test ./charly/..., and plugin-build / plugin-bundle /
plugin-box green. The R10 beds do not close it either — the build path reaches
the injection through candy/plugin-build's resolveBuildEngine, so a silent
no-op at this seam is invisible to them.

That matters because this seam is not the build path. It feeds the validate /
inspect / bundle-deploy envelope, and candy/plugin-bundle's
resolveBoxSelection reads rp.Boxes[...] to decide what a deploy installs — so
a no-op here is a real deploy defect. It is also the exact failure shape this
cutover's own RCA names: the deleted validator had zero coverage, which is why
the defect survived in the first place.

loaderkit/resolve_project_test.go runs the genuine resolve to inject to
project chain through the real buildkit.ResolveBox and asserts the PROJECTED
view carries the init candy — sealing both halves of the wiring: the call
itself, and the second-pass projection ordering the call forced. Verified to
FAIL under both mutations (the call neutered; the projection moved back into
the resolve loop) and to pass restored.

Also states the injection's presence-check SCOPE in its doc comment: it reads
the box's OWN resolved order (ResolveCandyOrder with a nil parentCandies), not
its base chain, so a child whose BASE installs the init candy still gains it.
Harmless for the artifact — GlobalOrderForBox filters a base-provided candy
back out at render — but rp.Boxes[child].Candy can then name a candy the child
does not itself install, and a consumer reading that field as "what this box
installs" must account for it.

Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
@atrawog

atrawog commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

charly/pr-validator — round 2: CHANGES REQUESTED

Fresh evaluator, head 5c903de3. The code is clean and I verified it myself. Both round-1 blockers are genuinely closed. Two findings remain, both R1 documentation-divergence in the cutover's OWN prose — one of them in a file this PR ships.

B1 — CLOSED. Mutation reproduced independently (third check)

I neutered the call at loaderkit/resolve_project.go:117 myself (_ = deploykit.InjectInitDependsCandy) and ran go test -count=1 ./... across the whole module:

--- FAIL: TestProjectResolvedProject_InjectsInitDependsCandy (0.00s)
    resolve_project_test.go:95: projected view must carry the injected init candy, got [sshd]
FAIL
FAIL	github.com/opencharly/sdk/loaderkit	0.007s

The new test is the only failure in the module. Restored → go test -count=1 ./... green, go build ./..., go vet ./..., gofmt -l . all clean. The 9 deploykit/init_depends_test.go tests all run and pass, including _MachineVenueInjectsNothing and TestFillNamespaceBoxViews_InjectsInitDependsCandy.

B2 — CLOSED. Comment matches behaviour, verified against the render path

  • InjectInitDependsCandy calls ResolveCandyOrder(img.Candy, layers, nil) — the box's own requested closure, no base-provided subtraction. Confirmed at deploykit/init_depends.go:66.
  • ResolveCandyOrder (deploykit/graph.go:96) skips a name when parentCandies[name], so passing the base set only ever REMOVES entries — the base chain is never consulted for presence either way. The comment's "scope is the box's own order, NOT its base chain" is accurate.
  • The stated consequence checks out end to end: RenderPrepBox (deploykit/render_prep.go:46) calls GlobalOrderForBox(img.Candy, parentCandies) with parentCandies from CandyProvidedByBox(img.Base, …), which filters a base-provided candy back out of RenderCandyOrder, and ResolveInitSystem at :69/:187 reads that filtered order — so the artifact and the baked ai.opencharly.init are unchanged, while rp.Boxes[child].Candy can name a candy the child does not itself install. Exactly what the comment now says.

Seam completeness re-confirmed, not re-derived: resolved.Candy = at buildkit/config_resolve.go:124 is the only assignment across all repos (the other two hits are struct-literal copies in the projection adapters), and all three seams inject.


F1 — BLOCKING. The named batch exit cites a file that does not exist

CHANGELOG/2026.215.2200.md:62-64 — shipped content, and the same claim in the PR body:

their deletion is scoped to the dead-code batch cutover (which also carries charly/kernel_manifest_floor_test.go's prose, still describing deploykit.ResolveSpecBox as live)

charly/kernel_manifest_floor_test.go was deleted from superproject main at 21ab450b (2026-08-03 21:10 +0200) — roughly an hour before this PR's first commit, so the claim was false when written, not overtaken by events. git ls-files | grep kernel_manifest is empty; charly/import_purity_test.go:6 records the deletion in as many words ("kernel_manifest_floor_test.go, deleted in this same change"). It survives only in stale agent worktrees under .claude/worktrees/.

R1's claim-keyed sweep binds to a cutover's own new prose explicitly, and this one ships in the CHANGELOG, so it is blocking.

The correction is also the thing that makes the R2 separability argument verifiable. I went looking for the real residue and it is stronger than the phantom one — deleting ResolveSpecBox / ResolveAllSpecBoxes / WrapSpecBoxes here would drag a cross-repo R5 sweep into the middle of a 4-repo chain:

  • spec/schema/resolvedproject.cue:331-332 names ResolveAllSpecBoxes in the present tense ("the SAME primitive ResolveAllSpecBoxes wraps"), with the generated twin at spec/cue_types_gen.go:5489-5490;
  • spec/schema/buildwire.cue:238 names ResolveSpecBox, generated twin at spec/cue_types_gen.go:3036;
  • WrapSpecBoxes' own doc comment (deploykit/spec_box_resolve.go:71-74) is already stale today: it says charly's toDeploykit uses it, while charly/ has been at zero sdk mechanism-kit references since the feat(deploykit)!: K5-Unit-1 Option A — clean kit of R-item, shrink seam to 1-op (#67) #55 terminus.

So: the surface is genuinely dead (zero production and zero *_test.go references, per-submodule grep over . spec sdk plugins docs box/*), the exit is genuinely justified, and the batch's real cargo is the spec-schema comment set above plus a task cue:gen regeneration. Name that instead of the phantom, in both the CHANGELOG and the body.

F2 — BLOCKING (cheap either way). "on the final tree" is contradicted two paragraphs later

The body's header reads "R10, both directions, on the final tree" over both bed blocks, and the next paragraph then says "Both bed outputs above were produced on the tree at 60c1a1c." Only check-tutorial-shell has been re-run since — I have the orchestrator's fresh caught-up-tree run (PASS (steps=13), 18 steps / 16 passed / 0 failed / 2 skipped, tutorial-shell-service-wired-into-init ok, binary 2026.215.2253) and it is good evidence for the container direction.

check-migrate-local has not run on 5c903de3. That is not a nothing-delta: the catch-up merge brought 51 files and ~2286/1794 lines of main's #55 import-purity work into this module (including vmshared/cloud_init_render.go). Main's work is independently landed and validated, but a bed run at 60c1a1c does not prove the tree being merged, and the machine-venue direction is the half the body leans on that bed for.

Fix either way — both are honest:

  • re-run charly check run check-migrate-local on 5c903de3 and paste it, keeping the header true; or
  • restate the header to what the evidence supports (container direction on the final tree; machine-venue direction at 60c1a1c plus TestInjectInitDependsCandy_MachineVenueInjectsNothing and the structural no-op on the final tree) and drop the PR-level tier to match.

With F2 resolved by the first option, fully tested and validated is earned. As the body currently stands it is not, and the correctly-formed italicized *Assisted-by: …* line is otherwise fine.

Not blocking

Nothing else. The two RCAs are sound, the GetName() remote-keying is the right fix and is pinned by _RemoteKeyedInitCandy, idempotence is real, and the plugin-tmux R2 routing is causally established.

Push the fix commits to feat/init-depends-candy-injection (no force-push, no amend — the status resets and a fresh validator re-runs).

atrawog added 2 commits August 4, 2026 01:13
Two round-2 findings.

THE CITED FILE DOES NOT EXIST. The entry named
`charly/kernel_manifest_floor_test.go` as prose still describing
`deploykit.ResolveSpecBox` as live, and pointed the dead-code batch at it. That
file was deleted from superproject main at 21ab450b, about an hour before this
PR's first commit; `charly/import_purity_test.go:6` records the deletion. The
citation was false when written — I described a rider I had not opened.

The real residue is in `spec`, not `charly`: resolvedproject.cue:331-332 and
buildwire.cue:238 (plus their generated twins) still name the two functions in
the present tense, and `WrapSpecBoxes`' own doc comment claims a charly consumer
that has not existed since the #55 terminus. That makes the separability
argument stronger, not weaker — deleting the three here would drag a spec schema
sweep plus `task cue:gen` into the middle of a four-repo chain.

R10 EVIDENCE NOW IN THE ENTRY, not only in the PR body, and re-run on the
caught-up tree rather than the tree the header was written against. The gate the
plan states is the gate that runs: check-tutorial-shell PASS (steps=13), which
fails without this change because its box composes no supervisord candy and
still gets [program:sshd]; check-migrate-local PASS (steps=6), exercising
ProjectResolvedProject on the deploy path the injection now sits inside. Zero
warnings.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
@atrawog
atrawog merged commit bc183d1 into main Aug 3, 2026
@atrawog
atrawog deleted the feat/init-depends-candy-injection branch August 3, 2026 23:22
atrawog added a commit to opencharly/marketplace that referenced this pull request Aug 4, 2026
core/skills/service/SKILL.md:101 claimed `charly box validate` enforces that an
image with an init-system layer must include the required dependency layer.

That enforcement was deleted in the opencharly/sdk#119 plugins leg
(validateInitDependencies in candy/plugin-box/validate_graph.go); a whole-tree
grep returns zero hits. The skill had been documenting an enforcement that no
longer existed — and pointing readers at a gate that could not have caught the
shape that actually broke deploys, since a box passing validate still failed at
[start] with no init in the image.

The line now states what happens instead: a box composing a service: candy gets
the active init's depends_candy added to its composition automatically, so it
never has to list supervisord by hand and can no longer be missing it.

Every skill in this repo is published to opencharly.ai, so this was a false
claim on a public surface about the exact mechanism this chain changes. Found by
the R1 claim-keyed sweep for the injection mechanism, not by reading the diff.

Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
atrawog added a commit that referenced this pull request Aug 4, 2026
…t a derived view (#120)

#119 (bc183d1, v0.2026215.2321) shipped an incomplete fix: it made a
box composing only service: candies install its init, and in doing so silently removed
six acceptance probes from the teaching box — including the only one proving the init
actually runs.

Root cause: InjectInitDependsCandy wrote to buildkit.ResolvedBox.Candy, which is a pure
BareCandyRef normalization of the authored list (buildkit/config_resolve.go:124-126) — a
DERIVED VIEW, not a second source of truth. Five chain collectors (CollectDescriptions /
CollectHooks / CollectBoxPorts / CollectShell / CollectBoxVolume) re-derive the composition
from cfg via BoxCandyChain -> cfg.WalkBaseChain -> node.Img.Candy, so an injected candy
contributed nothing to any of them: the image ran supervisord as PID 1 while the baked
ai.opencharly.description label — the plan `charly check box` runs — never mentioned it.

The pass now takes (cfg *spec.Config, layers, initCfg) and prepends the active init's candy
to the AUTHORED composition via cfg.SetBox, before box resolution. Every derivation follows
for free. The five collectors are UNCHANGED — no signature change, no threading, no fallback
branch, no special case naming supervisord or init; base-chain folding (union across levels,
first-occurrence-wins) is untouched.

All three composition chokepoints move ahead of resolution: loaderkit.ProjectResolvedProject,
deploykit.FillNamespaceBoxViews, and candy/plugin-build's resolveBuildEngine (superproject leg).
loaderkit's freshOrder/freshBoxes two-pass dance — which existed only because injection had to
run after resolve — is DELETED, not left dormant.

Coverage: deploykit/init_depends_collect_test.go (new, seven tests) asserts the CONTRIBUTION
class — description, ports, volumes, base-chain inheritance with de-dup, machine-venue negative,
and idempotence across the three chokepoints in both local- and remote-keyed shapes.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
atrawog added a commit to opencharly/distro-fedora that referenced this pull request Aug 4, 2026
`box/tutorial-shell` composes only `ripgrep` and `sshd`. The `supervisord` line is
gone: declaring a `service:` is what SELECTS an init system, so charly now adds that
init's own candy to the composition automatically and target-aware — supervisord for
this container image, nothing at all for a machine venue, which already has systemd.
The mechanism is deploykit.InjectInitDependsCandy (opencharly/sdk#119, #120).

This box is not the injection's only live consumer, and does not claim to be. SIX
boxes in this submodule resolve a supervisord that appears nowhere in their authored
base chain — check-pod, composition-app, composition-source, selftest-image,
selftest-layer, and this one; the other five are already in that state on main.
(k8s-box is NOT among them: it names supervisord outright at box/k8s/charly.yml:5.)
What this box contributes is legible coverage: it is the teaching example quoted
verbatim on opencharly.ai, small enough to read end to end, and the only one where
the injection is the point being demonstrated rather than an incidental detail.

Before the sdk fix this exact composition built clean, validated clean, and passed
`charly check box` — the service, port and control-socket probes are
`context: [runtime]`, skipped at image scope — then failed at deploy [start] with no
supervisord in the image.

Prose kept honest. "Three candies" lived in two live surfaces, both corrected here:
the box `description:` (box/tutorial-shell/charly.yml:5) and the check-tutorial-shell
bed `description:` (charly.yml:77). The `plan:` step comment was not one of them — it
said "Drop either candy from the list above" — but was updated anyway, because
"either" reads differently once the composed list is two. The box description is baked
into ai.opencharly.description and quoted verbatim on opencharly.ai, so a stale line
there is a published defect. The bed description had also been advertising supervisord's
control-socket check as acceptance content while that probe was not being collected;
opencharly/sdk#120 restored the collection, and the description now explains the probe
as proof that an injected candy contributes its acceptance plan, not merely its binary.

R10, re-run independently by the validator on a fresh worktree-local binary
(charly 2026.216.0131):

  charly check run check-tutorial-shell: PASS (steps=13)
  check-image         24 steps: 19 passed, 0 failed, 5 skipped
  check-live          24 steps: 22 passed, 0 failed, 2 skipped
  check-live-rebuild  24 steps: 22 passed, 0 failed, 2 skipped

Zero warnings across the run. Coverage discriminates: the box composes no supervisord
candy, so absent the injection there is no assembled /etc/supervisord.conf at all and
tutorial-shell-service-wired-into-init cannot pass.

R8, verified via `charly box labels tutorial-shell` and the emitted Containerfiles:
ARG BASE_IMAGE=ghcr.io/opencharly/fedora-supervisord:<tag>, an auto-intermediate whose
own Containerfile runs `dnf install -y supervisor`; the injected candy's six plan steps
appear in ai.opencharly.description under
origin candy:github.com/opencharly/charly/candy/supervisord.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
atrawog added a commit to opencharly/marketplace that referenced this pull request Aug 4, 2026
Round-2 review findings, all five mine.

CHANGELOG, wrong PR and wrong repo. The entry credited the validator deletion to
"the #119 plugins leg". opencharly/sdk#119 added the injection HELPER; the
deletion is opencharly/charly#205 (9631f646, v2026.216.0358), and
candy/plugin-box/ does not exist in sdk at all.

CHANGELOG land order omitted the leg that matters. It concluded "neither claim
describes a behaviour that is not yet true" from sdk#119 + #120 +
distro-fedora#11 — while both the injection call site and the deleted presence
check live in the SUPERPROJECT. Until #205 merged, charly neither injected nor
had stopped policing, so both rewritten pages described behaviour the tool did
not have. That is precisely the false state a validator caught in round 1; the
fix was to land #205 first, not to soften the pages. The entry now names all
five legs with their merges and tags.

Three sibling pages carried the same corrected claim and were never swept,
because the original sweep was keyed to literal strings rather than to the
claim:

  distros/skills/tutorial-shell "Drop either candy and the check fails" — a
  three-candy-model claim containing neither literal. supervisord can no longer
  be dropped (it is injected, not listed), and of the two composed candies only
  sshd's removal fails the check: with no service: declared, nothing selects an
  init, so no config is assembled to hold the block. distro-fedora#11 fixed this
  exact sentence in the box comment; the skill's mirror was missed.

  infrastructure/skills/supervisord — the Usage example LISTED supervisord in a
  box's candy: list, with a comment saying service: layers "need" it, directly
  above prose stating you rarely add it manually. The example now omits it, so
  the sample and the paragraph under it agree.

  image/skills/layer — a generic require: example used [python, supervisord].
  The example teaches require: mechanics and is not an init recommendation, but
  supervisord is now a hazardous name to demonstrate with, since composing the
  init by hand is the thing the injection makes wrong. Swapped for
  build-toolchain; the mechanism being taught is unchanged.

Also removed cutover narrative from core/skills/service — "the presence check
that used to enforce this is gone, it could not catch..." is history, and skills
state current behaviour in present tense. The standing rule was already in the
bullet's first half.

Re-swept claim-keyed over four claim families, newline-normalized, instrument
asserting what it read: 474 files enumerated, 474 read, 0 read failures. Zero
live hits outside CHANGELOG/ history.

Assisted-by: Claude Code Anthropic Claude Opus 5 (documentation reviewed)
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