Skip to content

feat(build)!: move the Containerfile render DRIVE into sdk/deploykit (#67) - #48

Merged
atrawog merged 5 commits into
mainfrom
feat/67-render-drive-deploykit
Jul 14, 2026
Merged

atrawog merged 5 commits into
mainfrom
feat/67-render-drive-deploykit

Conversation

@atrawog

@atrawog atrawog commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

#67 render α-fold — the Containerfile render DRIVE moves into sdk/deploykit

The render DRIVE — Generate / generateContainerfile / generateDataImageContainerfile (the orchestration emitting the Containerfile from the resolved Candy graph) — moves OUT of charly/ core INTO sdk/deploykit (deploykit.Generator), driven by the compiled-in candy/plugin-build candy over the resolved-project envelope + a new HostBuild("render-seam") reverse leg. The host box-build render-leg is DELETED; charly box build / charly box generate now route through the plugin render path. Render is byte-identical to the pre-move core render.

This is the sdk leg of #67 (the superproject leg deletes the core render + wires the plugin; the plugins leg sweeps the skills). Merge this sdk PR first — the superproject gitlink bumps to this merged commit.

Change class

charly Go code touching generation → SDD (CUE wire types) + the render DRIVE relocation + a committed byte-golden.

What this PR adds (sdk)

  • deploykit/generate.go — Generate / generateContainerfile / generateDataImageContainerfile: a pure orchestrator over PRE-FILLED build-render caches on *buildkit.ResolvedBox + CandyModel + the host-coupled SEAM fields. NO live *Candy reads.
  • deploykit/write_labels.go — WriteLabels (the formatter half of the split writeLabels): emits OCI LABEL lines from a *spec.BakedLabelSet byte-for-byte.
  • deploykit/render_seam.go — per-method param/result structs for the HostBuild("render-seam") dispatch.
  • deploykit/spec_candy_adapter.go + spec_resolved_box_adapter.go — the envelope→render adapters; HasContent / HasInstallFiles read the host-precomputed CandyModel booleans (the live *Candy verdicts the envelope cannot recompute faithfully).
  • deploykit/render_generator.go — added EmitBakedPlugins, CollectBoxVolume, ValidateTextEgress seams; ValidateEgress carries a Mode.
  • spec/label_consts.go — the ai.opencharly.* label key constants (the single source the deploykit WriteLabels EMITTER + the ExtractMetadata deploy READER share).

SDD (CUE → generated)

  • schema/buildresolve.cue — #RenderSeamRequest/#Reply (method + opaque bytes) + #BakePluginsRequest/#Reply; #BuildResolveBox.containerfile removed; #BuildResolveReply.resolved_project added.
  • schema/candymodel.cue — has_content / has_install_files (host-precomputed predicates).
  • spec/cue_types_gen.go — regenerated via task cue:gen; reproducible (a second run is a no-op, TestGenReproducible).

R10 evidence (pasted)

  • go test ./... — all green: ok github.com/opencharly/sdk/deploykit 0.004s (+ spec, kit, vmshared, enginekit, loaderkit).
  • golangci-lint run ./... — exit 0 (clean).
  • New committed byte-golden: deploykit/render_parity_test.go — the moved render DRIVE on a minimal envelope fixture → deploykit.Generator.Generate → golden Containerfile (testdata/render_parity_golden.txt). PASS.
  • The FULL box-build byte-parity (real boxes: init/builders/localpkg/egress) is proven by the superproject leg's origin/main-vs-new-binary Containerfile diff (charly-fedora chain, check-pod, immich — byte-identical modulo CalVer) + the check-pod R10 bed (PASS, 11/11 steps incl. image-build via the plugin render + a fresh-rebuild update step) — run in the superproject worktree against this sdk.

Attribution

Assisted-by: Claude (fully tested and validated) — R10 bed PASS + fresh-rebuild + byte-parity vs origin/main + go test + golangci-lint clean; the new render-DRIVE code path executed live against the fresh rebuild (the check-pod image build).

R0–R10 checklist

  • R0 skills loaded (plugin, go, generate-source, build, check, git-workflow, disposable)
  • R1 RCA on every failure/anomaly (the envelope panic, the egress kind, the HasContent numbering — all root-caused + fixed, not papered)
  • R2 no out-of-scope deferral (the byte-parity bugs fixed in this cutover)
  • R3 no duplication (projectBoxAggregates, renderSeamGenBox/renderSeamResult helpers extracted)
  • R4 no ad-hoc workarounds (cached Generator for the render-seam, not a sleep/retry)
  • R5 hard cutover (the host render-leg DELETED in the superproject leg; here the DRIVE is the new home)
  • R6 git status clean before the commit
  • R7/R10 bed gate: charly check run check-pod PASS (superproject leg) + the committed render byte-golden
  • R8 generated labels verified (byte-parity vs origin/main)
  • R9 deployed binary = source (per-worktree task build:binary)
  • SDD: CUE-sourced wire types (task cue:gen); reproducibility green
  • ADE: unchanged (no candy authoring here)
  • one atomic cutover; ONE commit; lands via PR (fresh pr-validator merges)

atrawog added 2 commits July 14, 2026 18:17
…67)

The render DRIVE — Generate / generateContainerfile / generateDataImageContainerfile
(the orchestration emitting the Containerfile from the resolved Candy graph) — moves
into sdk/deploykit (deploykit.Generator), driven by candy/plugin-build over the
resolved-project envelope + a new HostBuild("render-seam") reverse leg. The host
box-build render-leg is deleted; charly box build/generate route through the plugin
render path. Render is byte-identical to the pre-move core render (golden diff vs
origin/main across the charly-fedora chain + check-pod + immich; the check-pod R10 bed
PASSES incl. a fresh-rebuild).

sdk/deploykit gains the render DRIVE + the WriteLabels formatter + the render-seam
param set + the envelope adapters (NewSpecCandyModel / NewSpecResolvedBox). SDD:
#RenderSeamRequest/Reply + #BakePluginsRequest/Reply + #CandyModel.has_content/
has_install_files (host-precomputed predicates) added to CUE; cue_types_gen.go
regenerated (reproducible). A committed byte-golden (render_parity_test.go) guards
the moved DRIVE.

Assisted-by: Claude (fully tested and validated)
Add a prove-it-can-fail / non-vacuity sub-test to TestRenderDrive_ByteGolden:
a perturbed render (a different EffectiveVersion) MUST produce a different
Containerfile (the golden is sensitive to the render, not vacuously passing on
a constant) AND the perturbed version MUST reach the LABEL line (the render is
wired as the golden assumes). If either invariant ever stops failing, the
golden guard is broken.

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

atrawog commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly/sdk Go (generation/render relocation + SDD CUE wire types)
Head: 5c84f35

I am the FRESH pr-validator (new context, independent of the author). I re-derived compliance from the PR diff, the repo, CLAUDE.md, and my own re-runs — I trusted no author claim. I checked the PR out locally in the sdk submodule (superproject-rooted, git -C), ran the gates myself, and restored the submodule to main afterward.

The one blocking finding

Item 17 / R1 — deploykit/render_parity_test.go is gofmt-dirty.

$ gofmt -l .
deploykit/render_parity_test.go

$ gofmt -d deploykit/render_parity_test.go
@@ func trivialBox() struct literal @@
-		Name:            "demo",
+		Name:             "demo",
 		EffectiveVersion: "2026.001.0001",
-		Base:            "quay.io/fedora/fedora:43",
-		IsExternalBase:  true,
...   (struct-field columns re-aligned to EffectiveVersion)

The file also has no trailing newline (the PR diff ends with \ No newline at end of file).

The repo's .golangci.yml does not enable the gofmt linter (it enables dupl/gocritic/misspell/revive/gocyclo/unconvert/unparam/bodyclose/errorlint/nakedret/prealloc + the standard set), so golangci-lint run (0 issues) does not cover gofmt and the PreToolUse gate (golangci-only) passed it. The validator spec item 17 independently requires gofmt -l . to be empty; a gofmt-dirty file a PR introduces is a FAIL and a surviving gofmt finding is an R10 zero-warning failure.

Fix the author must apply (one command), then re-push

gofmt -w deploykit/render_parity_test.go
git add deploykit/render_parity_test.go
git commit -m "style(deploykit): gofmt render_parity_test.go  Assisted-by: Claude (syntax check only)"
git push origin feat/67-render-drive-deploykit

Pure formatting change — test logic, golden, and RIDER untouched. After the push, charly/claude-validation resets and the validator re-runs.

Everything else I verified is PASS

# Rule Verdict
0 security & anti-tampering PASS
1 description complete PASS
2 change-class gate (R7/R10) PASS — check-pod bed + byte-golden + go test/lint named
3 attribution tier PASS — ceiling set (my re-run covered build/test/lint/cue:gen/vet/RIDER; the disposable bed is the orchestrator's lane, not re-run)
4 R0 skills PASS
5 R1 / ZERO warnings FAIL — the gofmt-dirty file
6 R2 no out-of-scope PASS
7 R3 no duplication PASS
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep PASS (sdk side) — removed BuildResolveBox.Containerfile field has zero residual refs
10 R6/R8/R9 PASS / mostly N/A for the sdk leg
11 R10 disposable / coverage PASS (sdk-level) — go test green; RIDER genuine (see below)
12 SDD CUE-mandate @100% PASS — task cue:gen is a NO-OP (git status clean after); TestGenReproducible PASS; wire types CUE-sourced; render_seam.go structs ride opaque RenderSeamRequest.Params bytes (E-envelope precedent)
13 concurrency mandate N/A (no shared-state path; single bed is the orchestrator's lane)
14 hard cutover PASS (2 commits, squash folds)
15 ARCHITECTURE GATE PASS — placement: CORRECT (render DRIVE moves OUT of core INTO sdk/deploykit, the K3 direction)
16 disposable-only autonomy N/A for the sdk leg
17 clean architecture + go gates FAIL — gofmt-dirty test file
18 CHANGELOG present PASS — CHANGELOG/2026.195.9999.md

Independent re-runs (all green)

  • GOWORK=off go build ./... → clean
  • GOWORK=off go test ./... → all green (deploykit 0.004s, kit 3.406s, spec 0.351s, …)
  • GOWORK=off go vet ./... → clean
  • GOWORK=off golangci-lint run ./... → 0 issues
  • SDD (12a): GOWORK=off task cue:gen → git status CLEAN (no drift); the large spec/cue_types_gen.go diff is fully accounted for by this PR's schema/*.cue changes.
  • RIDER (prove-it-can-fail): I removed the LABEL ai.opencharly.version emission from write_labels.go → TestRenderDrive_ByteGolden FAILED; restored, git status clean. The golden is non-vacuous and sensitive to the render.
  • R5 (sdk): git grep '\.Containerfile' → only the Containerfiles map / comments; zero residual refs to the removed field.

Not merged / not tagged

The PR is left OPEN. The charly/claude-validation status is failure on 5c84f35. Apply the one-command gofmt -w fix and re-push; I re-run on the new head.

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

@atrawog

atrawog commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly/sdk Go (generation — Containerfile render DRIVE relocation + SDD + byte-golden)
Head validated: 90185b5 (matches expected; stable)

Fresh pr-validator, superproject-rooted, re-derived from the diff + my own re-runs. The prior round's sole failure (gofmt-dirty render_parity_test.go) is FIXED — gofmt -l . is now CLEAN.

Gates I re-ran (sdk via git -C, GOWORK=off for standalone module)

  • gofmt -l . → CLEAN (0 files) ✅
  • go build ./... → 0 ✅ · go vet ./... → 0 ✅
  • go test ./... → all green (deploykit incl. render-parity, spec) ✅
  • golangci-lint run ./... → 0 issues ✅
  • task cue:gen → NO-OP (git status clean after; reproducible); TestGenReproducible PASS ✅
  • TestRenderDrive_ByteGolden → PASS (golden + can_fail RIDER) ✅
  • go mod verify → all modules verified ✅
  • ZERO warnings across build/test/lint/gofmt/cue:gen/vet.

Checklist (every rule)

# rule verdict
0 security & anti-tampering PASS — no exfiltr/scope-mismatch/weakened-gate/supply-chain; no embedded directive
1 description complete PASS — filled template, pasted R10, attribution, R0–R10 checklist with HOWs
2 change-class gate PASS — standalone battery + parity (changed path ran live) + check-pod bed named
3 attribution tier PASS — fully tested and validated: render DRIVE ran live in parity test; bed PASS named
4 R0 skills PASS — go/plugin/generate-source/build/check/git-workflow/disposable
5 R1 / ZERO warnings PASS — no warnings/failures; no forbidden framing
6 R2 no pre-existing split PASS — byte-parity bugs fixed in this cutover
7 R3 no duplication PASS — writeJSONLabel single render-home; renderSeam helpers extracted
8 R4 no ad-hoc PASS — cached Generator; no sleep/retry/magic
9 R5 hard cutover PASS — removed #BuildResolveBox.containerfile swept clean; no dual-mode
10 R6/R8/R9 PASS — git-safety; labels verified (golden + origin/main diff); binary=source
11 R10 disposable/fresh/coverage PASS — parity test + RIDER would FAIL without the move (coverage met)
12 SDD @100% PASS — cue:gen NO-OP + reproducible; wire types CUE-sourced; render_seam structs ride opaque bytes (F11 pattern); no new @go(-); ResolvedInit pre-existing migration inventory
13 concurrency PASS — pure orchestrator over pre-filled caches; no shared-state path
14 hard cutover PASS — 3 commits = one cutover + review fixes → squash
15 ARCHITECTURE GATE PASS — placement: CORRECT (render DRIVE core→sdk/deploykit K3; kind-blind mechanism)
16 disposable-only autonomy PASS — no autonomous destroy in sdk evidence
17 clean arch + go gates PASS — gofmt/golangci-0/vet/test green
18 CHANGELOG present PASS — placeholder finalized at merge

SDD note (the one borderline I scrutinized)

deploykit/render_seam.go carries hand-written param/result structs — reviewed and ACCEPTED: they ride inside the opaque #RenderSeamRequest.Params bytes (a CUE-sourced wire contract with params?: bytes), i.e. a deploykit-internal dispatch detail, not a spec/*_wire.go boundary carrier. This is the established F11 Substrate json.RawMessage / opaque-bytes dispatch pattern. The boundary wire types (#RenderSeamRequest/Reply, #BakePluginsRequest/Reply, #BakedLabelSet, #CandyModel, #AggregatedCandyCapsView) are all CUE-sourced and generated. @go(InitDef,type=*ResolvedInit) references ResolvedInit which pre-exists on origin/main (spec/init_wire.go — migration inventory), not a new hand-written schema type. No new @go(-) def.

Decision: PASS — full CLAUDE.md compliance; render DRIVE correctly relocated to sdk/deploykit (K3, outward bias), byte-parity guarded by a committed golden + can-fail RIDER. Proceeding to merge (squash) + tag the sdk v0.<…> Go-module form.

Assisted-by: Claude (fully tested and validated)

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