Skip to content

feat(deploykit): relocate the build-time BUILDER render engine to sdk/deploykit (K3-A) - #39

Merged
atrawog merged 3 commits into
mainfrom
feat/k3a-render-fold
Jul 13, 2026
Merged

atrawog merged 3 commits into
mainfrom
feat/k3a-render-fold

Conversation

@atrawog

@atrawog atrawog commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

K3-A (first K3 build-engine relocation unit). The build-time BUILDER render engine — the multi-stage detection builders (pixi/npm/aur), the external_builder: out-of-tree builders, the pre-main-FROM stage assembly, and the artifact COPY emitters — relocates OUT of charly core into sdk/deploykit/builders_render.go, over CandyModel + buildkit.ResolvedBox. The only host coupling (the provider registry) stays 3 seam function-value fields on the render Generator, wired host-side by charly's toDeploykit(); the host closures preserve every builder error string byte-exact.

This is the producer half of the K3-A cutover — the consumer (charly core generate.go −343, seam wiring) lands as the superproject PR that bumps this sdk to the merged tag.

Change class

Code (sdk library) — runtime class. Gate = the consuming superproject's build + byte-parity + live beds (below).

What changed (sdk/deploykit)

  • NEW builders_render.go (328 lines): EmitPreMainCandyStages, EmitBuilderStages, EmitExternalBuilderStages, EmitExternalBuilderArtifacts, EmitBuilderArtifacts; exported BuilderResolveInputFrom (R3 — also consumed by charly's inline-builder seam + step-emit host builder); the shared DetectExternalizedBuilders pkg func (ONE detection impl for the render AND the deploy build pre-pass, R3); expandBuilderPath.
  • render_generator.go: 3 registry seam fields (EnsureBuildersConnected / ResolveDetectionBuilderStage / ResolveExternalBuilderStage), extending the existing ResolveInlineBuilder seam pattern.
  • candy_model.go: CandyModel.GetExternalBuilder() (plain snapshot-safe field read).

R10 evidence (runtime class — fully tested and validated)

Live build-class gate on the frozen tree + stamped binary v2026.194.1658:

check-builder-vm      PASS  9 steps  185s  ok:true  (the moved builder-OpResolve cluster driven LIVE through the deploykit render — npm detection builder end-to-end)
check-commands-local  PASS  5 steps  117s  ok:true  (6/6 plan checks incl. box-new-validate-generate through EmitPreMainCandyStages)
+ byte-parity goldens: fedora (470 Containerfiles) + arch (111) BYTE-IDENTICAL on the exact frozen binary

Coverage: the goldens byte-covered all 3 builder paths (detection pixi/aur, external_builder via check-pod→plugin-example-builder, inline cargo); error strings audited byte-exact on the failure paths. After merging origin/main (07dbdbc, K5U0's #ResolvedProject envelope — disjoint from these files), re-verified: sdk build + go test ./deploykit/... ./spec/... green (TestGenReproducible = no drift), charly rebuilt against the merged sdk → byte-parity still BYTE-IDENTICAL.

Checklist

  • R1 RCA on the one anomaly (freshness-guard stale-binary — rebuilt, R9)
  • R3 no duplication (DetectExternalizedBuilders/BuilderResolveInputFrom = one shared home)
  • R5 no stale refs (10 comment cross-refs swept; residuals are accurate relocation pointers)
  • R7/R10 live build-class beds PASS on the fresh cycle + byte-parity
  • go build ✓ · go test ✓ · golangci-lint 0 ✓ · gofmt ✓ · no CUE touched (TestGenReproducible green)
  • Branch up-to-date with origin/main (merged 07dbdbc, no conflicts); reconcile delta re-gate green
  • No new aliases; ZERO-ALIASES clean

Assisted-by: Claude (fully tested and validated)

atrawog added 2 commits July 13, 2026 19:08
…/deploykit (K3-A)

The multi-stage BUILDER render (detection pixi/npm/aur + external_builder + the pre-main-FROM
stage assembly + the artifact COPY emitters) moves from charly core into
deploykit/builders_render.go over CandyModel + buildkit.ResolvedBox. The only host coupling —
the provider registry (on-demand connect + ResolveBuilder + OpResolve Invoke) — stays 3 seam
function-value fields on the render Generator (EnsureBuildersConnected /
ResolveDetectionBuilderStage / ResolveExternalBuilderStage), wired host-side by charly's
toDeploykit(); the host closures preserve every builder error string byte-exact.

CandyModel gains GetExternalBuilder (the external_builder: word). BuilderResolveInputFrom is
exported (R3 — shared with charly's inline-builder seam + the step-emit host builder).
DetectExternalizedBuilders is ONE shared pkg func for both the render AND the deploy build
pre-pass (R3).

Byte-identical `charly box generate` output across box/fedora (46 images) + box/arch (12);
go test (deploykit) green; golangci-lint 0; no CUE touched (TestGenReproducible green). First
K3 build-engine relocation unit.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01QKhd4bTfDKi4epvFJDWyLV
@atrawog

atrawog commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code (sdk deploykit kit) — runtime class. PRODUCER half of the K3-A two-leg landing (+383/-0; the −299/−343 charly render deletion is leg 2, the superproject PR).

Validated by a fresh, superproject-rooted evaluator (V-K3A) that trusted none of the author's pasted output and re-derived every checkable gate.

Independently re-run (isolated worktree at the PR head 568abc0):

  • go build ./... ✓ · gofmt -l . empty ✓ · go vet ./... ✓ · go test ./... all green ✓
  • golangci-lint v2.12.2 run ./... = 0 issues ✓
  • TestGenReproducible RAN (pinned cue present) + PASSED → no gen drift (PR touches no CUE/proto/generated) ✓
  • sdk/deploykit imports only buildkit + spec — no charly-core import (placement clean) ✓
  • Merge is clean/up-to-date: 07dbdbc..568abc0 == exactly the 4 author files; disjoint from K5U0's #ResolvedProject envelope ✓

Relocation fidelity: side-by-side vs super-main emitBuilderArtifacts — identical structure, only layer.Name→GetName() / externalizedBuilders→g.ExternalizedBuilders adaptations for the CandyModel interface. Byte-faithful. (The pre-existing dead inner branch in EmitBuilderArtifacts is faithfully carried, not introduced — a non-blocking cleanliness note for a future cutover.)

R10 bed cross-check (no benefit of the doubt) — reconciled on disk:

  • check-builder-vm/2026.194.1700/summary.yml — EXISTS, ok:true, 9 steps all ok, total 185s → matches the pasted claim exactly (npm detection builder end-to-end through the relocated EmitBuilderStages).
  • check-commands-local/2026.194.1700/summary.yml — EXISTS, ok:true, 5 steps all ok, total 117s → matches exactly (box new/validate/generate through EmitPreMainCandyStages).
  • Both at calver 2026.194.1700, ~2 min after the stamped v2026.194.1658 binary → one binary, coherent window.
  • Confirmed the beds ran against the assembled relocated code: the author's worktree carries sdk@568abc0 + charly/generate.go delegating to toDeploykit().EmitPreMainCandyStages/... with the in-core render bodies deleted.
  • Byte-parity goldens: fedora (470) + arch (111) Containerfiles BYTE-IDENTICAL = the every-image coverage.

Checklist: 0 security/anti-tampering ✓ · 1 description ✓ · 2 change-class gate (correct beds, no fraud) ✓ · 3 tier fully tested and validated justified (changed paths ran live on the fresh assembled rebuild) ✓ · 4 R0 skills ✓ · 5 R1 zero-warnings (stale-binary anomaly RCA'd, R9) ✓ · 6 R2 (leg-2 split is sanctioned producer→consumer, not a dodge) ✓ · 7 R3 (DetectExternalizedBuilders / BuilderResolveInputFrom = single shared homes) ✓ · 8 R4 ✓ · 9 R5 (ADD-only; no transitional markers) ✓ · 10 R6/R8/R9 ✓ · 11 R10 disposable/fresh/zero-warn/coverage ✓ · 12 RDD/ADE/SDD (no new wire type/@go(-); repro no-op) ✓ · 13 concurrency/anti-cheat ✓ · 14 one atomic commit ✓ · 15 ARCHITECTURE GATE ✓ · 16 disposable-only ✓ · 17 go gates green ✓ · 18 CHANGELOG present ✓

placement: CORRECT — a kind-blind build-render MECHANISM (sdk-only deps) belongs in an sdk kit per the K3 boundary law; the render BODY leaves the kernel while the registry coupling stays host-side via function-value seams (not a per-concern wire seam). Advances the plugin-host end-state; eventual home is plugin-build (tracked K3 continuation), so sdk/deploykit is the correct intermediate. No regression.

Decision: All 18 items PASS. The only limitation — the assembled byte-parity cannot be re-run at leg 1 (the consumer is leg 2, not yet on main) — is inherent to producer-first cross-repo landing (B6); maximal verification was done (on-disk summaries reconciled exactly + relocated code confirmed running), and byte-parity is re-derived at leg-2 validation. Finalizing the merge-time CalVer, merging (squash), and tagging.

Cross-repo obligation: leg 2 must be the ATOMIC K3-A cutover (gitlink → this merged SHA, charly/go.mod require → the finalized v0 tag, delete the ~299/−343 charly render LOC + wire the seams, net core-LOC negative) — scoped to K3-A alone, not the broad K3+K4 WIP. Enforced at leg-2 validation.

Assisted-by: Claude (analysed on a live system)

Evaluator version stamp for #39 — the K3-A build-time
BUILDER render engine relocation (producer half). CHANGELOG renamed
from the author's placeholder to the merge-time CalVer.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01BpWheWfgtQNkjxVDW12zFg
@atrawog
atrawog merged commit 7a58ff2 into main Jul 13, 2026
@atrawog
atrawog deleted the feat/k3a-render-fold branch July 13, 2026 17:29
atrawog added a commit that referenced this pull request Jul 17, 2026
…seams peer-dispatch) (#65)

* feat(spec): move DoMode/ExecContext/StepDoMode to spec (K3 #39)

DoMode (+DoAct/DoAssert/DoInstruct) lived in kit/planrun.go; ExecContext
(+CtxBuild/CtxDeploy/CtxRuntime) lived in deploykit/compiler_deps.go;
StepDoMode (pure over spec.Step) lived in kit/planspec.go. All three are
plain shared vocabulary types every consumer that classifies an Op/Step
needs (the plan walk in sdk/kit, the deploy-plan compiler in sdk/deploykit,
charly core's registry-coupled semantics, candy/plugin-box's independent
validate-engine re-derivation) — moved to sdk/spec so none of them need a
mechanism-kit import just for these types. kit and deploykit now reference
spec.DoMode/spec.ExecContext directly; their own internal call sites
(kit/runner.go, kit/planrun.go, deploykit/install_build.go) repointed.

Assisted-by: Claude Sonnet 5 (analysed on a live system)

* feat(kit): promote InspectImageLabels — reentry-class dissolution (K3)

Promotes charly/labels.go's defaultInspectLabels (a pure podman/docker
inspect + label-JSON parse, zero charly-core coupling) to sdk/kit as
InspectImageLabels, alongside the already-kit-owned ResolveRuntime/
ResolveLocalImageRef/LocalImageExists/EngineBinary/ErrImageNotLocal. This
lets candy/plugin-box's `labels` command call the whole local-image-label
probe directly, eliminating the charly/box_labels_cmd.go `__box-labels`
reentry (charly-side commit follows on the superproject branch).

Assisted-by: Claude Code Claude Sonnet 5 (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

* feat(deploykit): K3 render-seam production move — 5 seams go peer-dispatch

RenderService, the detection/external builder resolves, ValidateEgress, and
RewriteHeaderCopyForRemote were pure providerRegistry.resolve+Invoke dispatch
(or pure data + host-fs I/O over the CandyModel envelope) with zero live-loader
dependency — RDD-spiked live on the external-builder leg in a prior commit.
candy/plugin-build's render now calls them directly via
renderSeamCaller.invoke/resolveBuilderStage (InvokeProvider, no HostBuild
round-trip) instead of HostBuild("render-seam"). BuildServiceRenderContext is
promoted from charly/service_render.go so both the plugin's render and
charly's own (deploy-mode) RenderService share one source (R3).
rewriteHeaderCopyForRemote is promoted from charly/generate.go, operating on
the CandyModel interface (GetRemote/GetSourceDir/GetSubPathPrefix/GetName —
all already exposed) instead of the live *Candy map.

The 4 remaining seams (EmitPluginOp, localpkg, inline-builder,
ensure-builders) keep the HostBuild callback: EnsureBuilders/InlineBuilder
need the live loader's scan+connect machinery (rides K1); EmitPluginOp needs
a Go-level type-assertion (ProvisionActor/BuildEmitter) against a BUILTIN
provider's concrete type that only charly core holds (a builtin's generic
Invoke() is an intentional error-stub for the placement-invisible perf
invariant, so InvokeProvider can't substitute).

Assisted-by: Claude Code Claude Sonnet 5 (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

* feat(spec): FeatureEntity carries RAW plan, not the host-transformed form (K3)

Drops FeatureEntity's Summary/Steps(FeatureStep)/ValidationErrors — all
computed HOST-side from data that is itself sdk-portable (kit.KeywordOf,
kit.ValidatePlanSteps, deploykit.DescriptionInfo) — in favor of a raw
Plan []Step field. candy/plugin-feature (which already owns the list/
pending/validate grammar) now runs the summarize/validate transform
itself; charly/host_build_feature.go's enumerateFeatures needs no
kit/deploykit import as a result (charly-side commit follows).

Assisted-by: Claude Code Claude Sonnet 5 (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

* test(deploykit): port GenerateInitFragments/CandyCopySource tests from charly

The charly-core wrappers these tests exercised (Generator.generateInitFragments,
Generator.candyCopySource) were dead code (zero non-test callers) and are
being deleted as part of the K3 build-engine core-minimization cutover.
Neither GenerateInitFragments nor CandyCopySource had any test coverage of
their own in this package — the wrapper tests were the only coverage that
existed for this real production logic (fragment-assembly/port-relay naming,
local-vs-remote copy-source resolution). Port them here verbatim, calling
deploykit.Generator directly, so the coverage moves with the logic instead
of being silently dropped.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
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