Skip to content

feat(spec): CUE-source InstallContext + BuildStageContext keystones (P2/S1) - #7

Merged
atrawog merged 2 commits into
mainfrom
feat/keystone-buildctx
Jul 8, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/keystone-buildctx

Conversation

@atrawog

@atrawog atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Authors the two build-render context keystones — InstallContext (format install/prepare/cleanup templates) + BuildStageContext (builder multi-stage templates) — in schema/buildctx.cue (CUE single source), GENERATED into spec/cue_types_gen.go by task cue:gen. This replaces the hand-written *_wire.go idiom per operator direction (define wire types in CUE + auto-generate). Aliased in vmshared/spec_aliases.go so charly references them unchanged.

  • Spike-verified: CUE [...{...}] (the Repos field) → []map[string]any; [...#CacheMount] → []CacheMount; uid/gid forced to Go int via @go(,type=int); dual yaml+json tags automatic.
  • Standalone defs (not #Node/#Op, never user-authored) → no authored wire-key change → no schema version bump.

Change class

sdk Go — CUE schema + generated param types + aliases.

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: the SDD reproducibility gate + the CONSUMING charly build/test + a disposable bed that exercises the generated types (there is no sdk-standalone bed — the types are consumed by charly's build path).
  • Disposable target: check-builder-local (a disposable: true bed — builds the npm builder image that renders BuildStageContext/InstallContext, deploys ~/.npm-global to a host: local venue, checks, fresh-updates, tears down).
  • Fresh rebuild (R9): task build:charly → charly version matches; bed run on the fresh binary.
  • Did the CHANGED code path execute live? Yes — the CUE-generated types drove the npm builder build + format install in the bed.
$ (sdk) go test ./...            # all ok, incl TestGenReproducible PASS (cue:gen no-op)
$ (charly) go build/vet/test ./... # green — 16 consumers compile vs the generated types
$ task cue:gen  (2nd run)         # no drift (reproducible)
$ charly check run check-builder-local  (fresh binary)  →  PASS (steps=4), ok: true
    deploy-add ✓ 22s · check-live ✓ 5s · update ✓ 29s · cleanup ✓ 7s

Attribution tier

fully tested and validated — the CUE-generated types executed against a fresh rebuild in the disposable bed (all 4 steps green, both outputs pasted).

CLAUDE.md rule compliance

  • R0 skills: /charly-internals:go (the CUE→spec generation recipe + SDD) + /charly-internals:plugin (the wire-type/OpResolve contract).
  • R1 RCA: the first bed's cleanup failure was RCA'd to the stale-binary guard tripping on a mid-run charly/*.go edit (my process error, not the change) — rebuilt + re-ran clean (all 4 ✓).
  • RDD: the CUE-generation shape (esp. Repos []map[string]any + json/yaml tags) was spiked on the live gen pipeline BEFORE committing.
  • SDD: CUE is the single source; TestGenReproducible covers the new types; cue:gen is a no-op on a clean tree.
  • R3: collapses two hand-maintained structs into one CUE source. R5: the hand-written buildctx_wire.go was never committed; grep clean.
  • R2/R4/R6: N/A/clean. Hard cutover: one atomic sdk commit (the charly consumer side is the paired superproject PR, producer-first).
  • CHANGELOG: CHANGELOG/2026.189.0710.md staged.

Assisted-by: Claude (fully tested and validated)

…P2/S1)

Authors the two build-render context keystones in schema/buildctx.cue (CUE single
source) and generates them into spec/cue_types_gen.go via task cue:gen — not a
hand-written wire file. The Repos list-of-open-struct generates as []map[string]any;
[]#CacheMount → []CacheMount; uid/gid forced to Go int via @go(,type=int); dual
yaml+json tags automatic. Aliased in vmshared/spec_aliases.go so charly aliases them
unchanged. Standalone defs (not #Node/#Op) — no authored wire-key change, no schema
version bump. TestGenReproducible now covers them (cue:gen no-op; drift = R1).

First unit of the P2 keystone migration; establishes CUE-sourcing for the wire-type
family (replacing the hand-written *_wire.go idiom where the shape is a plain struct).

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

atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: sdk Go — CUE schema + generated param types + aliases (runtime class; gated on the consuming build + a disposable bed).

Independent re-validation (fresh context; author claims trusted for nothing — every gate re-run):

  • [PASS] 0. security & anti-tampering (T1–T4): diff is 4 additive files (CUE def + generated Go + 2 aliases + CHANGELOG); no secrets/exfiltration/network, no weakened gate, no supply-chain/dep change, no embedded directive to the validator. Scope matches description exactly.
  • [PASS] 1. description complete: template filled — Summary, Change class, How-R10-tested (bed named, disposable:true target, R9 fresh-rebuild, changed-path-executed-live, pasted output), Attribution, per-rule HOW. Not a promise; I reproduced every claim.
  • [PASS] 2. change-class gate matches evidence: runtime class → consuming build + disposable bed; no dry-run/rebuild-alone fraud. I re-ran the real bed on a fresh binary.
  • [PASS] 3. attribution tier justified: fully tested and validated — my own fresh-rebuild bed re-run is green (all 4 steps), changed types executed live.
  • [PASS] 4. R0 skills honored: /charly-internals:go (CUE→spec SDD recipe) + /charly-internals:plugin — CUE-first, @go()-annotated, task cue:gen regenerated, generated files not hand-edited.
  • [PASS] 5. R1 / zero warnings: zero warnings in every gate + the bed run; the body's stale-binary-guard RCA is a real root-cause, not a flake dismissal.
  • [PASS] 6. R2 no split: producer-first cross-repo ordering (sdk now, charly consumer PR after) is legitimate dependency sequencing, not an out-of-scope park.
  • [PASS] 7. R3 no duplication: collapses two hand-maintained structs into ONE CUE source.
  • [PASS] 8. R4 no workaround: none.
  • [PASS] 9. R5 hard cutover + grep: the 2 generated struct defs + 2 aliases are the SOLE definitions in sdk; no buildctx_wire.go exists (confirms "never committed"); purely additive, no transitional/dual-mode path.
  • [PASS] 10. R6/R8/R9: R6/R8 N/A; R9 — binary rebuilt from the working tree (bin/charly), /usr/bin/charly newer than every source, freshness guard clear.
  • [PASS] 11. R10: disposable-only bed check-builder-local (disposable:true), fresh update leg green, zero warnings; TestGenReproducible is the coverage that FAILS on any gen drift.
  • [PASS] 12. RDD/ADE/SDD: CUE single source; task cue:gen re-run by me = 0 drift; TestGenReproducible PASS; ADE N/A (no candy touched).
  • [PASS] 13. concurrency + anti-cheat: pure type-addition (no shared-state runtime path); no forbidden framing.
  • [PASS] 14. one atomic commit: exactly 1 commit on feat (4c153b4); no Phase-2/TODO; this is the P2/S1 keystone unit of a decomposed cutover program.
  • [PASS] 15. kernel/plugin boundary law: generated param types in sdk/spec (build-render context DATA, kind-agnostic) — no concrete-kind switch/map/field-read leaked into core.
  • [PASS] 16. disposable-only autonomy: the bed's destroy+rebuild ran on check-builder-local (disposable:true, explicit).
  • [PASS] 17. clean architecture + go gates: sdk gofmt -l . empty, go vet clean, go test ./... green, golangci-lint run ./... = 0 issues; consumer charly go build/vet/test ./... green (compiler = field-parity check). YAML↔Go plural/singular symmetry holds.
  • [PASS] 18. CHANGELOG present: placeholder CHANGELOG/2026.189.0710.md staged (finalized to the merge-time CalVer here).

SDD field-parity (the crux): I compared both CUE defs against the generated Go structs field-for-field — InstallContext (14) + BuildStageContext (17), all faithful: Repos []map[string]any (from [...{...}]), CacheMounts []CacheMount (from [...#CacheMount]), UID/GID Go int (from @go(,type=int), not int64), dual yaml+json tags. Re-running task cue:gen myself yielded 0 drift (committed == fresh gen). #SchemaVersion (2026.186.2323) UNCHANGED — correct: #InstallContext/#BuildStageContext are standalone defs, not referenced by #Node/#Op, so a pure generated-param-type addition warrants no version bump.

R10 bed (fresh rebuild, my re-run): charly check run check-builder-local → PASS (steps=4), overall ok: true — deploy-add ✓ 22s · check-live ✓ 5s · update ✓ 30s · cleanup ✓ 7s. Disposable target torn down; no residual deployment.

Decision: APPROVED. The change is correctly scoped, SDD-faithful, reproducible, and runtime-verified end-to-end against a fresh rebuild. Finalizing the merge-time CalVer and merging.

Assisted-by: Claude (fully tested and validated)

…keystones)

CUE-source InstallContext + BuildStageContext build-render keystones into
sdk/spec (P2/S1); pr-validator generated the merge-time CalVer at merge.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01LjLm6DGQasmXaXw2ZorwhE
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