Skip to content

fix(sdk): fetch the init runtime the init vocabulary depends on, and match a ref-shaped depends_candy - #336

Merged
github-actions[bot] merged 4 commits into
mainfrom
feat/polymorphism-truth
Oct 3, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
feat/polymorphism-truth

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fetches the init runtime an init's depends_candy: names, so a composition that only declares a service: gets its init installed instead of an image that stamps ai.opencharly.init="supervisord" with no supervisord binary to run.

Relates to opencharly/charly#764 (the umbrella issue for automatic init injection + the require: layer-supervisord cutover).

This revision answers the second review's three blocks (head e3fc4b3, run 37118911153): (1) the two deploykit behaviour changes now have live proof on the committed tree, not only on a back-port; (2) the duplicated op-context predicate is extracted into one shared sdk/internal/spectest helper rather than conceded; (3) the body accounting is corrected below — deploykit/init_unit_files.go's actual diff is described as what it is (the reworded unsatisfiedInitDepends warning), and the Rulebook section answers every applicable rule.

Summary

charly/charly.yml's init: vocabulary declares, per init system, the candy that installs that init's own runtime (supervisord: → the supervisord candy; systemd:/openrc: → none — they install with the OS). Declaring a service: in a candy is what selects an init and assembles its config — but nothing ever fetched the selected init's runtime candy. deploykit.InjectInitDependsCandy resolved depends_candy only against the project's already-scanned set, so a box that never happened to compose the init candy built and validated clean, baked ai.opencharly.init="supervisord" plus an assembled /etc/supervisord.conf, and then died inside podman on the render stage's COPY of the init candy's own template:

[image-build] FAIL after 1m58.942s
copier: stat: "/templates/supervisord.header.conf": no such file or directory

The field workaround is target-blind: 40 candies carry require: layer-supervisord and boxes list it by hand, which drags supervisord onto systemd/openrc venues.

What changed — 11 files, +969/−100:

  • loaderkit/init_depends_seed.go (new, +98) — initDependsSeeds(scanned, initCfg) returns, for each init the scanned set actually triggers, its remote depends_candy as a fetch coordinate: RepoPath, Version (the authored :version; empty ⇒ resolved to the repo's default branch by the caller), the bare Ref, and a layer=init:<name> scope. Only a REMOTE (@-prefixed) depends_candy is seeded; a bare depends_candy: supervisord names no repo and is left to the scan set exactly as before.
  • loaderkit/finalize_candy.go (+43/−29) — extracts candyTriggersInit(sc, def), the ONE "does this candy trigger this init" predicate, out of PopulateCandyInitSystem's inline loop so the seed and the finalizer cannot drift (R3). Behaviour-preserving: the same IsPackaged/SupportsPackaged/ServiceTemplate routing and the same candy_file glob arm.
  • loaderkit/scan_orchestrate.go (+104/−5) — runs the seed (a) over localScanned BEFORE the len(downloads) == 0 early return (a fully-local project must fetch too) and (b) after EVERY fix-point round over everything materialized so far — essential, because a distro service candy is itself remote, so its service: trigger only becomes visible once round 1 has fetched and scanned it. The seed is idempotent (the seeded map) so the fix-point drains instead of re-adding forever.
  • deploykit/init_depends.go (+32/−28) — normalize a ref-shaped depends_candy through spec.BareCandyRef before every presence check, so @github.com/opencharly/layer-supervisord:v2026.271.1817 matches the scanned set exactly as the bare name does, and ask the tolerant name rule before injecting a duplicate. The "not in the scanned set" branch's comment is re-based: with the fetch seed in place, reaching it means the fetch failed, not that the project forgot to list something.
  • deploykit/graph.go (+17/−1) — PruneContainerInitForSystemd stops comparing to the literal "supervisord" and asks orderSatisfiesInitDepends instead, against a new named const containerInitCandy = "supervisord". That is the ONE change that is not conditional on the vocabulary flip: a resolved order carrying the candy under its ref key (github.com/opencharly/layer-supervisord) is now pruned on a machine venue where before it survived onto a systemd guest. Intended, and covered by the live bed's second assertion.
  • deploykit/init_unit_files.go (+12/−5) — the reworded unsatisfiedInitDepends warning. Its text previously taught the pre-fix workaround verbatim ("Reference the candy directly in the box's candy: list, or pull it in via a composed candy's require:"); it now names the actual cause — the fetch that should have materialized the candy did not — and points at the vocabulary's depends_candy ref. The message also no longer interpolates depends_candy into the slot naming the missing binary (that slot read correctly only while the field was spelled bare, and the ref form would have printed ... with no @github.com/opencharly/layer-supervisord:v2026.271.1817 binary); it names the init's own runtime there instead. The dedupe key (box, init, candy) and the hook-swap contract are unchanged, and no test pinned the old text.
  • internal/spectest/opincontext.go (new, +53) — the ONE canonical port of the pure op-context classifier (spec.OpInContext / spec.OpEffectiveContexts), plus Install() to wire the DI hook. Two sdk test binaries need it (deploykit's compiler tests and loaderkit's live bed); under internal/ it stays unimportable from outside the module, so the published surface and the placement test are untouched.
  • deploykit/plan_compile_test.go (+9/−29) — its own verbatim copy of that classifier is deleted; the file now calls spectest.Install() in init(). (The copy in the plugin-fleet repo at candy/plugin-fleet/deploy_test_helpers_test.go stays: that package is out-of-module and cannot import sdk/internal.)
  • loaderkit/scan_live_bed_test.go (+195/−3) — the live-or-skip beds below, plus a new bed (see "How tested") and two things a real layer-supervisord materialization forced, both confined to that test file: the shared liveBedParse fixture now threads a hand-built, production-modelled spec.Threaded snapshot and drops a legacy top-level version: before parsing (the real cached manifest carries version: 2026.261.1747 at ~/.cache/charly/repos/github.com/opencharly/[email protected]/charly.yml:1, which production's command:migrate reshapes away before the parse; ParseCandyManifest's node-form branch — the only branch that desugars authored verb sugar — rejects a scalar top-level version:, so without the strip the bed would fall back to a decoder that does not desugar the manifest's command: verb sugar).
  • Tests — loaderkit/init_depends_seed_test.go (new, +317): local-only project fetches; remote trigger seeds on the next round; termination; no depends_candy ⇒ no fetch; use_packaged-only ⇒ no supervisord; bare depends_candy ⇒ no fetch; a project's own pin is NOT overridden, in both the root-repo and pre-cutover sub-path shapes. And deploykit/init_depends_ref_test.go (new, +89): the ref-shaped depends_candy matches the scanned key and the machine-venue prune drops it.

The seed is a fallback, never a version override: it adds nothing when the composition already names the init runtime, so PickCandyVersion's newest-wins rule can never move a project's own explicit pin.

How tested

Gate on the committed tree, head 2847040cca345d6fd048a8dee1d7aad01045c3d0 (re-run by the PR author on the pushed head, not taken from a worker's report):

$ gofmt -l .              → gofmt exit=0   (no output)
$ go build ./...          → build exit=0
$ go vet ./...            → vet exit=0
$ go test -count=1 ./...  → test exit=0
ok  	github.com/opencharly/sdk	0.216s
ok  	github.com/opencharly/sdk/agentkit	0.739s
ok  	github.com/opencharly/sdk/buildkit	0.011s
ok  	github.com/opencharly/sdk/candywalk	0.021s
ok  	github.com/opencharly/sdk/charlylib	0.015s
ok  	github.com/opencharly/sdk/checkkit	0.009s
ok  	github.com/opencharly/sdk/cmd/charly-lib-gen	0.008s
ok  	github.com/opencharly/sdk/deploykit	5.725s
ok  	github.com/opencharly/sdk/enginekit	0.008s
?   	github.com/opencharly/sdk/internal/spectest	[no test files]
ok  	github.com/opencharly/sdk/kit	11.309s
ok  	github.com/opencharly/sdk/llmkit	2.228s
ok  	github.com/opencharly/sdk/loaderkit	0.970s
ok  	github.com/opencharly/sdk/packagekit	0.036s
ok  	github.com/opencharly/sdk/vmshared	0.129s
ok  	github.com/opencharly/sdk/workflowkit	0.011s

The whole live suite, on that same committed tree (4 PASS, 0 SKIP — quoted in full, because a partial run could not show that the shared-fixture change left the two pre-existing beds green):

$ LIVE_SDK_MECHANISM_BED=1 go test ./loaderkit/ -run 'TestLiveBed' -v -count=1
=== RUN   TestLiveBedCrossBoxDifferenceIsSilent
    scan_live_bed_test.go:228: LIVE cross-box: resolved github.com/opencharly/[email protected] with ZERO diagnostics across 2 real tags
--- PASS: TestLiveBedCrossBoxDifferenceIsSilent (0.01s)
=== RUN   TestLiveBedSameBoxConflictIsInfo
    scan_live_bed_test.go:268: LIVE same-box: resolved github.com/opencharly/[email protected]; 1 INFO, 0 WARNING:
        candy github.com/opencharly/layer-direnv resolved to multiple git tags with differing content within one scope (box=one-box); using newest referenced v2026.272.0057 (from github.com/opencharly/[email protected])
--- PASS: TestLiveBedSameBoxConflictIsInfo (0.01s)
=== RUN   TestLiveBedInitDependsSeedFetchesTheInitRuntime
    scan_live_bed_test.go:315: LIVE init seed: materialized github.com/opencharly/[email protected] with 0 diagnostics:
--- PASS: TestLiveBedInitDependsSeedFetchesTheInitRuntime (0.01s)
=== RUN   TestLiveBedInjectionResolvesTheSeedsRealMaterialization
    scan_live_bed_test.go:370: LIVE init injection: scanned set carries github.com/opencharly/layer-supervisord (name "supervisord"); injected order [github.com/opencharly/layer-supervisord svc]; machine-venue prune -> [svc]
--- PASS: TestLiveBedInjectionResolvesTheSeedsRealMaterialization (0.00s)
PASS
ok  	github.com/opencharly/sdk/loaderkit	0.054s
                                                                  → exit 0 — 4 PASS, 0 SKIP

It ran live: no test skipped, grep -c SKIP on the log is 0. The bed drives the real EnsureRepoDownloaded fetch, the real ScanRemoteCandy manifest scan and — the new part — the real deploykit.InjectInitDependsCandy and the real deploykit.PruneContainerInitForSystemd, unmodified, over the real materialization the scan produced. No mock of any boundary; a cold cache skips visibly instead.

The new bed fails without each of the two deploykit changes, separately. That is the discrimination the previous revision could not offer, and it is what makes this live proof a proof of these diffs rather than of the pipeline around them. Each run reverts exactly one file to origin/main, runs the bed, and restores:

### RUN A — deploykit/init_depends.go reverted to origin/main (BareCandyRef normalization removed)
=== RUN   TestLiveBedInjectionResolvesTheSeedsRealMaterialization
warning: box "svcbox" resolves init "supervisord", which depends on the "@github.com/opencharly/layer-supervisord:v2026.271.1817" candy, but that candy is not in this project's scanned set — the fetch that should have materialized it did not, so nothing was injected: the image will declare init "supervisord" with no supervisord implementation installed and fail at start. Check that the init vocabulary's depends_candy ref exists and is reachable.
    scan_live_bed_test.go:361: the ref-shaped depends_candy must inject the REAL scanned key "github.com/opencharly/layer-supervisord", got [svc]
--- FAIL: TestLiveBedInjectionResolvesTheSeedsRealMaterialization (0.01s)
exitA=1

### RUN B — deploykit/graph.go reverted to origin/main (tolerant prune removed)
=== RUN   TestLiveBedInjectionResolvesTheSeedsRealMaterialization
    scan_live_bed_test.go:368: the REAL ref-keyed init candy must be pruned on a machine venue, got [github.com/opencharly/layer-supervisord svc]
--- FAIL: TestLiveBedInjectionResolvesTheSeedsRealMaterialization (0.01s)
exitB=1

### RESTORED — git status --short and git diff --stat on both files: empty

Read the RUN A output closely and the two changes separate cleanly: the seed did its job (the warning fires only because the candy was fetched and scanned), and the injection still missed it, because without the normalization the ref-shaped depends_candy matches no scanned key.

Live end-to-end under the assembled pipeline — charly built from a worktree with replace github.com/opencharly/sdk => <a mechanically identical back-port of this tree, see "Reconciling the spec pin" below>, then a disposable: true bed whose box composes no layer-supervisord and never names the init candy. The whole pod lifecycle passes — 14/14 steps, 0 errors, 0 warnings:

$ grep -E '^  - name:|^    duration_seconds:|^    ok:' .check/check-spikebox/2026.276.1052/summary.yml | paste - - - | sed 's/  - name: //; s/\t/  /g'
image-build  duration_seconds: 34  ok: true
check-image  duration_seconds: 25  ok: true
deploy-add  duration_seconds: 4  ok: true
config  duration_seconds: 3  ok: true
start  duration_seconds: 3  ok: true
bring-up-members  duration_seconds: 0  ok: true
check-live  duration_seconds: 12  ok: true
feature-run  duration_seconds: 11  ok: true
update  duration_seconds: 14  ok: true
rebuild-ready  duration_seconds: 2  ok: true
check-live-rebuild  duration_seconds: 10  ok: true
feature-run-rebuild  duration_seconds: 11  ok: true
cleanup  duration_seconds: 14  ok: true
cleanup-members  duration_seconds: 0  ok: true

$ grep -E '^(bed|calver|total_seconds|ok):' .check/check-spikebox/2026.276.1052/summary.yml
bed: check-spikebox
calver: 2026.276.1052
total_seconds: 144
ok: true
   (its `diagnostics:` block) errors: 0 · warnings: 0 · advisories: 0

$ grep -o -m 1 -E '[0-9]+ steps: [0-9]+ passed, [0-9]+ failed, [0-9]+ skipped' .check/check-spikebox/2026.276.1052/check-image.log
23 steps: 18 passed, 0 failed, 5 skipped

and the emitted image proves the fetch + injection (.check/check-spikebox/2026.276.1052/image-build.log):

$ grep -n -m 8 -E 'FROM scratch AS supervisord-conf|supervisord.header.conf|cat /supervisor|LABEL ai\.opencharly\.(init=|service\.supervisord|candy_version)' .check/check-spikebox/2026.276.1052/image-build.log
261:[4/5] STEP 1/3: FROM scratch AS supervisord-conf
264:[4/5] STEP 2/3: COPY .build/_buildconfig/templates/supervisord.header.conf /supervisor/00-header.conf
321:[5/5] STEP 18/41: RUN --mount=type=bind,from=supervisord-conf,source=/supervisor,target=/supervisor     cat /supervisor/*.conf > /etc/supervisord.conf &&     chmod 0644 /etc/supervisord.conf
363:[5/5] STEP 32/41: LABEL ai.opencharly.init="supervisord"
369:[5/5] STEP 34/41: LABEL ai.opencharly.service.supervisord='["github.com/opencharly/pod-sshd"]'
390:[5/5] STEP 41/41: LABEL ai.opencharly.candy_version='{"github.com/opencharly/layer-ripgrep":"v2026.235.1653","github.com/opencharly/layer-supervisord":"v2026.271.1817","github.com/opencharly/pod-sshd":"v2026.272.0324"}'

The COPY that failed in the defect now resolves, and the init runtime was materialized at the vocabulary's pinned tag on a box that never listed it. Independently, the bed's own log records the deploy-name alias resolving a fully-qualified source: Overlay image ready: ghcr.io/opencharly/spikebox:check-spikebox-2026.276.1037.

The deploy-add failure this PR previously reported is root-caused, and it was my own test state — not a defect of this change. Replaying the failing command by hand recovered what the plugin's silent executor had discarded:

$ podman tag spikebox spikebox:2026.276.1041
Error: spikebox: image not known                                                                                     → exit 125
$ podman tag ghcr.io/opencharly/spikebox:check-spikebox-2026.276.1041 spikebox:2026.276.1041
                                                                                                              → exit 0

So reply.BaseImage was the bare short name spikebox — build_overlay.go's default: fallback, taken when container.ResolveNewestLocalCalVer(engine, "spikebox") errors. It errored because of [email protected] container/local_image_coneb.go:619: electResolvedImage refuses with an ambiguous short name error that names every candidate when the top candidate has neither a label-CalVer nor a tag-CalVer and the candidates span more than one repository. Both spikebox candidates were mine, and they spanned two registries — ghcr.io/opencharly/spikebox:check-spikebox-2026.276.1041 and a leftover ghcr.io/example/spikebox:check-spikebox2-2026.276.0845 from an earlier spike of mine that used registry: ghcr.io/example. Removing my own scratch artifacts removed the ambiguity, and the same box, same binary, same commit then passed deploy-add and the entire lifecycle above. Real pod beds never hit this because all their candidates share one registry.

The residual finding is diagnosability, and it is routed to its owning batch: opencharly/plugin-deploy-pod#19 ("a failing podman tag reports only command exited 125 — the fire-and-forget helper discards the cause"). tagDeployAlias runs podman tag through exec.VenueRunSilent (spec/exec/executor.go:229), the fire-and-forget helper, which discards both streams and returns only command exited %d — so a cross-venue failure arrives with no cause at all. Its sibling VenueCapture (:211) already surfaces stderr. That issue is plugin-deploy-pod's, not this repo's, and this PR changes no deploy-venue code.

Reconciling the spec pin (correcting the revision before this one)

An earlier revision asserted "R10 — verified from the final committed tree, not an edited state" while also admitting a local adaptation. Those two statements were mutually inconsistent, and the claim was wrong. The claim is withdrawn and is not restated anywhere in this body. The accurate account:

  • The committed tree builds. go.mod pins github.com/opencharly/spec v0.2026276.0, and spec.LayerScope exists there (spec/resolve_opts.go:82: func LayerScope(candy string) string { return "layer=" + candy }). So go build ./... → 0 above is a real statement about the committed tree. spec.LayerScope is additionally already used, pre-existing and untouched, at loaderkit/refs_collect.go:511 — this PR did not introduce the dependency.
  • The adaptation was needed by the consumer, not by this tree. charly's composition cannot build against spec v0.2026276.0 yet: the plugins charly pins still declare []string where the newer spec wants the typed ExtraCandyRef. To run the end-to-end bed at all, the spike used a back-port of these same files onto the spec version charly can build with (v0.2026272.1512, which lacks LayerScope; hence the one-line substitution). It is the same source, mechanically re-expressed — not an edit to the committed tree, which contains no such adaptation and builds as shown.
  • charly version for the binary used in the live run: 2026.276.0451, built from the charly worktree at 6d7d80fc.
  • The consumer adoption that removes the need for the back-port is opencharly/charly#762 (spec#188), which is also what unblocks flipping the vocabulary to the remote ref.

Honest limits of this proof

  1. The deploykit runtime changes now DO have live proof on the committed tree — the end-to-end assembled run still does not. The previous revision's block 1 is answered by TestLiveBedInjectionResolvesTheSeedsRealMaterialization: the committed InjectInitDependsCandy and the committed PruneContainerInitForSystemd execute, unmodified, over the real [email protected] materialization, with the fail-without-change discrimination pasted above. What remains one step removed is the assembled proof — the full charly pipeline, which ran on the back-port because charly cannot yet consume spec v0.2026276.0 (opencharly/charly#762). That is the whole of the remaining gap, it is stated rather than glossed, and it is why the tier below stays at analysed on a live system.
  2. The change is not uniformly inert — and specifically, graph.go's is not. The fetch seed is inert until the vocabulary names a remote ref (main still carries the bare depends_candy: supervisord, so no shipped project fetches anything new from this PR alone). But PruneContainerInitForSystemd's switch from a literal to the shared name rule changes behaviour on its own, with no vocabulary flip required: a resolved order carrying the candy under its ref key (github.com/opencharly/layer-supervisord) is now pruned on a machine venue where before it survived onto a systemd guest. That is the intended change — one name rule for one divergence (R3) — and RUN B above shows the live bed is what detects it.
  3. The spec.OpInContext port is no longer duplicated — it is one shared helper. The previous revision conceded a second copy across two sdk packages (block 2). It is now sdk/internal/spectest: deploykit/plan_compile_test.go's copy is deleted and both it and loaderkit/scan_live_bed_test.go call spectest.Install(). The only surviving copy of that classifier anywhere in the org is the plugin-fleet repo's own candy/plugin-fleet/deploy_test_helpers_test.go, which is an out-of-module package and cannot import sdk/internal by the language's own rule — the reason is in that file's comment.
  4. The consumer leg — flipping charly/charly.yml to the pinned remote ref, bumping the sdk pin, and threading initCfg through the validate path so charly box validate stops reporting a state the build disproves — is opencharly/charly#764, and it is behind opencharly/charly#762.

Rulebook compliance

Every applicable rule of the umbrella AGENTS.md and charly/AGENTS.md, each answered with a one-line HOW or an explicit N/A and its reason.

  • R0 — skills first. HOW: before the first edit, this repo's own R0 list (sdk/AGENTS.md) was loaded by path from the marketplace tree — internals/skills/plugin/SKILL.md, internals/skills/install-plan/SKILL.md, internals/skills/go/SKILL.md — plus internals/skills/git-workflow/SKILL.md and its references/pre-validator-self-audit.md for the git/PR surface. No edit, branch, commit or gh action preceded them.
  • R1 — RCA every anomaly. HOW: the PR exists because of one RCA, not a symptom fix — depends_candy was resolved against the already-scanned set while nothing in the pipeline fetched it, so a composition triggering an init built an image stamping that init with no binary (opencharly/charly#764, with the charly box validate "nothing was injected" line and the [image-build] COPY templates/supervisord.header.conf failure as evidence). The deploy-add failure this PR's own gate surfaced is separately root-caused above to my own cross-registry scratch artifacts, with the residual diagnosed and routed. The nil-OpInContext panic that blocked the live bed was root-caused to a DI seam only charly core wires, and fixed by sharing that port, not by mocking the seam.
  • R2 — finish the whole cutover. HOW: the fix is one seam for every caller — ScanCandyFromLocal is the single chokepoint, and every production call site of it is covered by changing it once. There are exactly four on disk, all in plugin-build (resolve.go:98, resolve_project_word.go:105, resolve_project_tolerant.go:77, resolve_legs.go:465; grep -rn 'ScanCandyFromLocal' --include=*.go over the org finds no fifth), plus the spec.ProjectLoader.ScanCandyFromLocal seam that charly core reaches through instead of importing loaderkit. The name rule is unified across the injection and the prune in the same change. The cutover's other half is not deferred, it is sequenced: the require: layer-supervisord removal from the 40 candies + the box listings is the consumer leg of opencharly/charly#764, and it is only possible once this PR supplies the automatic fetch — this PR is the replacement home, so R2/B15's "removed from A while its replacement home on B is deferred" cannot apply.
  • R3 — no duplication. HOW: the detection predicate is extracted once (candyTriggersInit, consumed by both the finalizer and the seed); the injection and the machine-venue prune now share ONE name rule (orderSatisfiesInitDepends, named once as containerInitCandy); and the op-context port is collapsed into sdk/internal/spectest with both in-module copies deleted in this same change.
  • R4 — no workarounds. HOW: the fix materializes the dependency the vocabulary declares, rather than adding a blanket require: supervisord (which /charly-image:layer forbids as target-blind) or special-casing a project. The warning text change removes the workaround instruction rather than teaching a new one.
  • R4a — fix the product first; documentation never routes around a defect. HOW: this PR is the product fix; no page, README or skill is edited to describe the defect as expected behaviour. The one documentation-shaped change is inside the product — the runtime warning now names the real cause (a failed fetch) instead of instructing the user to hand-list the candy.
  • R5 — delete legacy completely. HOW: the stale pre-fix advice is deleted from the warning in the same change that makes it unnecessary, and no shim or dual path is introduced. The depends_candy bare spelling is not legacy: spec.BareCandyRef is identity on it and the seed ignores it, so both spellings stay valid with no stranded path. The 40 require: layer-supervisord lines are this cutover's deletion half and are owned by #764 (see R2).
  • R6 — preserve user work and Git safety. HOW: all work is in the session worktree .worktrees/polymorphism-truth/sdk on feat/polymorphism-truth; no force-push, no direct push to main, no history rewrite, no hook bypass (--no-verify / core.hooksPath), no git add -A, and no other session's file, branch or worktree touched. git status --short is empty on the head.
  • R7 — prove behavior, not compilation. HOW: every behaviour this PR changes has a test that fails without it — the seed's round/termination/pin-precedence cases, the ref-shaped injection, and (decisively) the live bed, whose RUN A / RUN B output above shows each deploykit change failing the bed on its own.
  • R7a — live or skip, never fake a live service. HOW: every check above ran against the real binary, the real registry and the real container engine. The live bed skips visibly (t.Skip naming the missing cache or the unset LIVE_SDK_MECHANISM_BED) and mocks no boundary; grep -c SKIP on the pasted run is 0.
  • R8 — preserve emitted artifacts. HOW: the two emitted artefacts this PR touches are the resolved box candy order (→ the Containerfile) and the stderr warning. The order is validated at its own boundary — the live bed asserts the injected head and the machine-venue prune over the REAL scanned keys — and the assembled run's emitted image is pasted with its labels. The warning's dedupe key (box, init, candy) and its hook-swap contract are unchanged, and no test or machine consumer parses its text.
  • R9 — binary equals source. HOW: the gates above (gofmt/build/vet/test) ran on head 2847040; the live beds run test binaries go test builds from that same tree; and the assembled run's binary is identified as charly version 2026.276.0451, built from the charly worktree at 6d7d80fc, against the back-port declared in "Reconciling the spec pin" — stated, not glossed.
  • R10 — fresh disposable proof. HOW: the sdk proof is built and run fresh from the final committed tree above; the assembled run mutated only a disposable: true bed's own resources, and no proof is taken from an edited state — the withdrawal of the earlier "verified from the final committed tree" claim is exactly that rule being applied to the end-to-end portion.
  • Disposable-Only Autonomy. HOW: the only resources this PR created or removed were its own spike box and bed in the scratchpad, both disposable: true; no shared or operator-owned resource was created, mutated or reaped. (The one teardown-venue hazard discovered during this work — charly deploy del with no venue falling back to the host executor — is tracked at opencharly/charly#765 and is why no roster containing check-kind-host-vm was run.)
  • Concurrency contract. HOW: no charly task sync / charly task verify was run (they are the gitlink writers); no --tag or bed_domain was shared with another session; the only shared writable surface touched was the read-only-when-warm repo cache, through its sanctioned boundary (EnsureRepoDownloaded: source-keyed path, per-binary flock, atomic rename).
  • Architecture / boundary law (kind-blind, capability-free). HOW: the new package is sdk/internal/spectest — importable only within the module, so the sdk's published surface is unchanged and the placement test's boundary holds; the change adds no capability code and no kind-specific branch to a mechanism package; the deploykit and loaderkit changes are pure functions of the config and the scanned set.
  • Hard Cutover by Default. HOW: there is no deprecation window and no compatibility branch here — the tolerant name rule replaces the literal comparison outright, and the warning's workaround instruction is deleted rather than kept alongside the new one.

Change classification

  • Change class: library + behaviour change in sdk (loaderkit fetch fix-point; deploykit injection and prune matching; a runtime warning's text), with test-only additions.
  • Verification gate: sdk gofmt -l / go build / go vet / go test -count=1 ./... on the committed pushed head 2847040 (all green, all 16 packages incl. internal/spectest); the whole live-or-skip bed suite on that same tree, against the real fetch, scan, injection and prune (4 PASS, 0 SKIP); the live bed's per-change fail-without-change runs (2/2 FAIL as designed, then restored); and the assembled end-to-end disposable: true bed on the mechanically identical back-port — 14/14 steps, 0 errors, 0 warnings.
  • Attribution tier: analysed on a live system — the changed runtime path ran live with retained output, but the tier is not raised to fully tested and validated for the two reasons stated: the assembled end-to-end proof ran on the mechanically identical back-port (Honest limits item 1; the deploykit runtime path itself now has committed-tree live proof), and the project's gate for that tier, ./charly/bin/charly task verify, cannot run at the umbrella root because of the pin defect owned by opencharly/opencharly#330 — a pin-advance change class this PR does not touch.

Agent: polymorphism-truth · session 9c898e99-b5d7-4f3e-a472-62c4ecbcd18f
Assisted-by: Claude Code DeepSeek V4.1 (flash) (analysed on a live system)

…match a ref-shaped depends_candy

The init vocabulary declares, per init system, the candy that installs that init's
runtime (`depends_candy:`). Declaring a `service:` is what SELECTS an init, but nothing
ever FETCHED the selected runtime candy: InjectInitDependsCandy resolved `depends_candy`
only against the project's already-scanned set, so a project that never happened to
compose the init candy built clean, stamped ai.opencharly.init="supervisord" onto an
image with no supervisord binary, and died inside podman on the render stage's COPY of
the init candy's own template. Every service candy carrying `require: layer-supervisord`
is the target-blind workaround this replaces — it drags supervisord onto systemd and
OpenRC venues.

- loaderkit: extract candyTriggersInit as THE one detection predicate (R3) and add
  initDependsSeeds, the pure seed resolving the vocabulary's remote `depends_candy` into
  fetch coordinates.
- loaderkit/scan_orchestrate: seed the fetch fix-point both before the local-only early
  return and after EVERY round — a remote service candy's trigger is only visible once
  its round has scanned it. Seeding is idempotent, so the loop drains; the seed is sorted,
  so the network fix-point does not vary run to run.
- loaderkit/scan_orchestrate: the seed is a FALLBACK. A composition that already names the
  init runtime — in the fetch set it arrived with, or already materialized — is left alone,
  so the arbiter's newest-wins rule can never silently move a project's own explicit pin.
- deploykit: normalize a ref-shaped `depends_candy` to its bare ref before every presence
  check, and reuse the tolerant name rule in the machine-venue prune so a ref-keyed
  layer-supervisord is pruned exactly as the bare name is.

Assisted-by: Claude Code DeepSeek V4.1 (flash) (analysed on a live system)
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: ac194f424cd2d3bed3c6d7b9fc57dbbbf743353f (branch: feat/polymorphism-truth)

Change class: code — sdk library + runtime-behaviour change (loaderkit fetch fix-point, deploykit injection/prune matching).

Security screen: PASS — no secrets, no egress, no guardrail/rulebook weakening, no embedded directives, no dependency/CI edits; all 8 changed files are accounted for by the body (diff counts +704/−67 match the file list exactly).

Blocks

  1. R1 + B12 — the pasted end-to-end gate did not pass, and the failure is left un-RCA'd. The body's own "How tested" pastes a bed whose third step fails deterministically:
    deploy-add → prepare venue: … deploy-name alias tag: command exited 125 (two runs, 3.879s / 3.962s). The body states outright: "It is not root-caused here." R1 requires a root-cause RCA and a real fix for every failure/warning in the gate output; B12 requires the eval bed to show no failed step. Neither holds. The author correctly downgraded the tier to analysed on a live system, but that does not license landing a runtime change whose end-to-end bed fails at a step it now reaches. The body must either fix it in-tree or supply the actual RCA and route it to the correct named batch — opencharly/charly#764 is the init-injection umbrella, not a deploy-venue batch, so it is not the matching thematic batch for a plugin-deploy-pod venue failure.

  2. R10/R9 + B12 — the live proof was run on an edited tree, contradicting the R10 claim. Limit 3 admits the spike required "one local, uncommitted adaptation because spec.LayerScope only exists from spec v0.2026276.0 while the live spike is measured against the pinned v0.2026272.1512." The shipped tree calls spec.LayerScope("init:" + initName) (loaderkit/init_depends_seed.go, ~L78), so the binary exercised live was not built from the committed source — yet the compliance section asserts "R10 — verified from the final committed tree, not an edited state." Those two statements are mutually inconsistent: the committed tree cannot both build against a spec that lacks LayerScope (as the go build → 0 claim requires) and force an adaptation when composed into charly. Either the committed go.mod pins a spec that provides LayerScope (in which case the adaptation was unnecessary and the claim is wrong), or it does not (in which case the committed tree does not build as claimed). The body must reconcile the spec pin, and assert charly version matches the committed source per R9. This is a body-truthfulness finding under rule 4.

Notes (non-blocking): no comments to disposition (<comment_thread> empty). The footer model string Claude Code DeepSeek V4.1 (flash) is unverifiable from the body alone (no independent authoring-runtime evidence) — noted, not blocked. The "change is inert" claim is not strictly true for the deploykit/graph.go prune generalization, which changes behaviour for a ref-keyed order independent of the vocabulary.

Verdict: BLOCK


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

View action run

Add TestLiveBedInitDependsSeedFetchesTheInitRuntime to the loaderkit live
mechanism bed: a fully-local project whose only candy declares a non-packaged
`exec:` service triggers supervisord, so ScanCandyFromLocal must FETCH
supervisord's runtime candy (the new init-depends seed) through the REAL
repo-cache fetch + manifest scan and resolve it at the vocabulary's tag. The
existing stubbed unit tests pin the seed's shape; this bed pins that the
production legs materialize and parse the real layer-supervisord tree it names.

The bed also exercises two production facts the pre-existing live beds never
reached:

  - liveBedParse now threads a hand-built, production-modelled spec.Threaded
    snapshot (liveBedThreaded) instead of an empty one, so ParseCandyManifest's
    node-form branch desugars the authored `command:` verb sugar exactly as
    production does. The bed's MigrateCache is a documented no-op, so it also
    drops the pristine export's legacy top-level `version:` stamp before the
    parse (writing a stripped temp copy; the shared read-only view is never
    mutated) — production's command:migrate reshapes that stamp away first.

  - spec.OpInContext, the process-wide DI hook FinalizeScannedCandies ->
    CompleteCandyRunOps calls for every scanned candy, is wired in this test
    binary (production charly wires it in its own init()). The real
    layer-supervisord candy carries a `run:` step, so the nil hook panicked;
    the classifier is a verbatim port of charly's opInContext/
    opEffectiveContexts, the same port deploykit/plan_compile_test.go carries.

The bed is live-or-skip: it skips visibly unless LIVE_SDK_MECHANISM_BED is set
and the warmed repo cache holds the init runtime, and never fakes the boundary.

Assisted-by: Claude Code DeepSeek V4.1 (flash) (analysed on a live system)
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: e3fc4b3dcf49251613be17e3ff8558f015a945af (branch: feat/polymorphism-truth)

Change class: code — sdk library + runtime/deploy behaviour change (loaderkit fetch fix-point, deploykit injection/prune matching).

Comment disposition. The one prior comment (by @github-actions[bot], head ac194f42, "8 changed files") is stale-superseded — the current head is e3fc4b3 with 9 changed files, and both of its blocks are resolved in the current revision: the deploy-add step now passes (14/14, 0 errors/0 warnings) with a stated RCA and a residual routed to the named batch plugin-deploy-pod#19, and the spec pin is reconciled with the false "R10 — verified from the final committed tree" claim explicitly withdrawn. Its two blocks are not carried forward.

Blocks

  1. A2 / B12 / R10 — the committed runtime change is not bed-proven. The body concedes (Honest limits §1) that "the end-to-end bed did not run on the committed tree, and is not claimed to have." On the committed source the new runtime behaviour is exercised only by a Go test (loaderkit live bed — the seed) and unit tests (deploykit/init_depends_ref_test.go — the ref-shaped injection + machine-venue prune). The deploykit behaviour changes (deploykit/init_depends.go presence-check normalization, PruneContainerInitForSystemd in deploykit/graph.go) have no live proof on the committed tree; their only live execution is inside the end-to-end bed that ran on a mechanically-adapted back-port. The body's claim that the live suite shows "the committed source, not a back-port, is what works" overstates it — that suite covers loaderkit only. Because charly cannot yet consume the pinned spec (opencharly/charly#762), the fix is to either run the bed against the committed source, or post the explicit operator sign-off the rulebook requires for a portion whose proof cannot yet exist.

  2. B7 / R3 — duplicated detection predicate across two sdk packages. The body concedes (Honest limits §3) that spec.OpInContext's classifier is now copy-pasted into loaderkit/scan_live_bed_test.go (liveBedOpInContext / liveBedOpEffectiveContexts) where deploykit/plan_compile_test.go already carries the same port. Both copies live in sdk, so a single shared sdk test helper is trivially possible; the rulebook's R3 admits no "a second copy is fine" threshold (the deploykit comment's threshold is an in-code convention, not the authority). Extract one shared helper.

  3. A1 — body accounting incomplete.

    • The bullet "deploykit/graph.go, deploykit/init_unit_files.go — PruneContainerInitForSystemd and orderSatisfiesInitDepends share ONE name rule…" describes graph.go's diff. deploykit/init_unit_files.go's actual diff is the reworded unsatisfiedInitDepends warning ("…the fetch that should have materialized it did not…"), which the body never describes as that file's change.
    • The "Rulebook compliance" section answers only R1, R2/B14, R3, R4, R7, R9 (+ live-or-skip). Applicable rules R0, R4a, R5, R6, R8 and the disposable-only / concurrency / architecture mandates are neither answered with a one-line HOW nor marked N/A — <reason>.

Verdict: BLOCK


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

View action run

Extract the pure spec.OpInContext classifier — which deploykit's compiler
tests and loaderkit's live bed each carried as a verbatim port — into one
sdk-internal helper, internal/spectest (R3: one canonical implementation per
behaviour, with no "a second copy is fine" threshold).

Add a live bed that drives the REAL InjectInitDependsCandy and the REAL
PruneContainerInitForSystemd, unmodified, over the SAME real
layer-supervisord materialization the seed bed fetches, with the
vocabulary's real ref-shaped depends_candy. That gives this PR's two
deploykit behaviour changes live proof ON THE COMMITTED TREE — what the
end-to-end charly bed cannot supply while opencharly/charly#762 is unmerged.
Verified to fail with either change reverted.
…runtime

`unsatisfiedInitDepends`'s message interpolated `depends_candy` into the slot that
names the binary the image will fail to exec. That slot only ever READ correctly
while the vocabulary spelled the field bare (`supervisord` == the binary). With the
ref-shaped `depends_candy` this PR's cutover introduces, the same warning printed

    ... declare init "supervisord" with no @github.com/opencharly/layer-supervisord:v... binary

naming a ref where a binary belongs. The init's own name is the runtime the entrypoint
execs, so interpolate THAT and state "no <init> implementation installed"; the candy the
field names still leads the sentence, where it is correct. No test pinned the default
text (both cases swap the `unsatisfiedInitDepends` hook), so nothing else moves.
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 2847040cca345d6fd048a8dee1d7aad01045c3d0 (branch: feat/polymorphism-truth)

Security screen: PASS — no secrets, no egress, no guardrail/rulebook/validator-spec weakening, no embedded directives, no new deps or CI edits; all 11 changed files are accounted for by the body.

Comments (both @github-actions[bot], re-derived against the current state): both are stale-superseded — the current head is 2847040 with 11 files, and every block they raised is resolved in the CURRENT diff/body: (comment 1, head ac194f42) the deploy-add failure is now RCA'd to the author's own cross-registry scratch images with the residual routed to plugin-deploy-pod#19, and the spec pin is reconciled with the false "final committed tree" claim withdrawn; (comment 2, head e3fc4b3) the two deploykit behaviour changes now execute live on the committed tree via TestLiveBedInjectionResolvesTheSeedsRealMaterialization with the RUN A/RUN B fail-without-change discrimination, the duplicated op-context classifier is collapsed into sdk/internal/spectest (both in-module copies deleted), and the body now describes deploykit/init_unit_files.go's reworded warning and answers every applicable rule.

Checklist: All applicable rules PASS or NA. Placement is CORRECT — the new shared helper is sdk/internal/spectest (module-private, no published-surface growth), and the loaderkit/deploykit changes are pure functions of config + scanned set. Minor unverifiable items noted, not blocking: the Assisted-by model string has no independent authoring-runtime evidence in the body; the 4-commit series is expected to squash.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 3, 2026 11:28
@github-actions
github-actions Bot merged commit d6fc5ad into main Oct 3, 2026
6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 3, 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