Skip to content

feat(build): build-resolve drive-model wire + shared image-build lock (P8b sdk half) - #31

Merged
atrawog merged 6 commits into
mainfrom
feat/p8b-build-engine
Jul 12, 2026
Merged

atrawog merged 6 commits into
mainfrom
feat/p8b-build-engine

Conversation

@atrawog

@atrawog atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

P8b sdk half — the build-resolve drive-model + the shared image-build lock

The sdk contract for P8b (the box-build podman DRIVE moves into candy/plugin-build; charly's host side becomes a resolve/render seam). Consumer: opencharly/charly#70.

  • schema/buildresolve.cue → generated spec.BuildResolveRequest/BuildResolveBox/BuildResolveReply (CUE-sourced, SDD). The HostBuild("build-resolve") seam envelope: CLI build inputs + GenerateOnly in; the resolved drive-model out (engine/platform, Order⊻Levels, per-image descriptors, resolved tunables). All plain/nested structs — Levels [][]string generates faithfully via cue exp gengotypes (no disjunction, no RawBody).
  • kit/filelock.go → ImageBuildLockPath + AcquireImageBuildLock — the per-image build-lock derived byte-identically across the module boundary (R3), so charly core + the compiled-in candy share one lock.
  • spec/deploy_wire.go — BuildRequest comment R5-swept.

⚠️ Landing dependency (R3, coordinated with T-P14a)

This branch's schema/buildresolve.cue carries a TRANSITIONAL #MergeRequest/#MergeReply (identical to T-P14a's finalized shape in sdk#28 schema/oci.cue) ONLY so P8b compiles before #28 merges. Merge order: #28 FIRST, then this branch rebases onto merged main and DELETES its transitional MergeRequest/MergeReply (imports spec.MergeRequest/MergeReply from #28, same shape → zero code change), rerunning task cue:gen. One home = oci.cue (team-lead ruling). Do not merge before #28 + the rebase.

Gate

task cue:gen reproducible; go build ./... + golangci-lint run (kit + spec) → 0 issues; the types are exercised end-to-end by the consumer's real charly box build (opencharly/charly#70 R10).

Assisted-by: Claude (fully tested and validated)

https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

atrawog added 3 commits July 12, 2026 14:26
… (P8b sdk half)

The sdk contract half of P8b (the box-build podman DRIVE moves into candy/plugin-build;
charly's host side becomes a resolve/render seam provider).

- schema/buildresolve.cue → generated spec.BuildResolveRequest/BuildResolveBox/BuildResolveReply:
  the HostBuild("build-resolve") seam envelope (CLI build inputs + GenerateOnly in; the resolved
  drive-model out — engine/platform, Order⊻Levels, per-image descriptors, resolved tunables). All
  plain/nested structs; Levels [][]string generates faithfully (no disjunction, no RawBody).
- kit/filelock.go → ImageBuildLockPath + AcquireImageBuildLock: the per-image build-lock derived
  byte-identically across the module boundary (R3), so charly core and the compiled-in
  candy/plugin-build share one lock (shared intermediate builds cold once; leaves fan out).
- deploy_wire.go BuildRequest comment R5-swept (the "engine STAYS host-side" claim corrected).

The transitional spec.MergeRequest/MergeReply the HostBuild("merge") seam uses are OWNED by P14a's
oci.cue (sdk#28, landing first); this branch rebases onto it and imports them (no parallel shape, R3).

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
…rop transitional local copy

sdk#28 (P14a's oci.cue MergeRequest/MergeReply) is merged into sdk main. Per the one-home
dedupe ruling, delete the transitional #MergeRequest/#MergeReply from schema/buildresolve.cue
(kept only for pre-#28 compilation) and regenerate — cue_types_gen.go now carries P14a's single
MergeRequest (ImageRef/MaxMB/MaxTotalMB/Engine/DryRun) + MergeReply, which the HostBuild("merge")
seam + the candy import. buildresolve.cue defines only the BuildResolve* family now.

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

atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly/sdk Go — producer wire types (CUE-sourced) + a shared kit build-lock helper
Head validated: df30685 (independent fresh clone; re-derived, no author claim trusted)

Checklist

  • [PASS] 0 · security (T1–T4) — diff = 3 generated wire structs + kit filelock helper + 1 test + comment sweep + CHANGELOG. No secrets/egress/eval, no scope mismatch, no guardrail/hook/branch-protection edits, no new deps (kit imports stdlib only), no validator manipulation.
  • [PASS] 1 · description — summary accounts for every file; in-repo gates pasted; runtime gate correctly deferred to consumer feat(deploykit,buildkit)!: W3 producer leg — localpkg + intermediates engine → sdk #70 (B6). Note: the body's "Do not merge before feat(spec): P14a status + OCI wire types (sdk producer half) #28 + rebase" caveat is stale — feat(spec): P14a status + OCI wire types (sdk producer half) #28 (ae98a93) is merged & an ancestor of HEAD, and df30685 already dropped the transitional copy. Not a blocker.
  • [PASS] 2 · change-class gate — go test + cue:gen reproducibility (re-run green) + consumer's real build (pasted in feat(deploykit,buildkit)!: W3 producer leg — localpkg + intermediates engine → sdk #70). No dry-run/rebuild-alone fraud.
  • [PASS] 3 · attribution tier — fully tested and validated grounded by feat(deploykit,buildkit)!: W3 producer leg — localpkg + intermediates engine → sdk #70's pasted R10 (charly box build fedora exit 0; 39-step build drives kit.AcquireImageBuildLock + BuildResolve* against a fresh rebuild). Matches sibling producer-wire-type PRs feat(spec): P10 command-plugin config/build seam wire types #27/feat(spec): P14a status + OCI wire types (sdk producer half) #28.
  • [PASS] 4 · R0 skills — go (SDD wire-type mandate), plugin (generic build-resolve envelope seam), install-plan (comment-only deploy_wire.go sweep).
  • [PASS] 5 · R1 / zero warnings — every re-run clean; no flake/transient framing.
  • [PASS] 6 · R2 — no pre-existing/out-of-scope split; P8b-followup is a documented separate cutover.
  • [PASS] 7 · R3 — lock UNIFIED into one shared kit impl; transitional #MergeRequest/#MergeReply duplicate DELETED → one home = oci.cue.
  • [PASS] 8 · R4 — blocking flock(LOCK_EX) primitive, not sleep/retry; no magic numbers.
  • [PASS] 9 · R5 — grep -rn MergeRequest schema/ → oci.cue only (buildresolve.cue = pointer comment); BuildRequest doc-comment swept. No dual-mode survives.
  • [PASS] 10 · R6/R8/R9 — N/A for a library repo (no image/binary); Containerfile byte-parity + task build:binary satisfied+pasted in feat(deploykit,buildkit)!: W3 producer leg — localpkg + intermediates engine → sdk #70; no new runtime OS dep.
  • [PASS] 11 · R10 — coverage: TestImageBuildLockPath fails without the new code; TestGenReproducible fails on CUE↔Go drift; cue:gen re-run = NO-OP.
  • [PASS] 12 · SDD @100% — (a) task cue:gen → git status CLEAN; (b) cue_types_gen.go DO-NOT-EDIT + byte-reproducible; (c) BuildResolve* are CUE defs → generated, no hand-written wire struct; (d) ZERO @go(-); (e) per-plugin .cue N/A.
  • [PASS] 13 · concurrency — the lock IS the sync primitive (serializes same-ref cold builds, fans out distinct leaves); proven in feat(deploykit,buildkit)!: W3 producer leg — localpkg + intermediates engine → sdk #70's real build. No idle/serial dodge.
  • [PASS] 14 · hard cutover — 3 feat commits fold to ONE via --squash; no Phase-2/TODO.
  • [PASS] 15 · kernel/plugin boundary — class-generic build-resolve wire envelope; no concrete-kind leak.
  • [PASS] 16 · disposable-only — N/A.
  • [PASS] 17 · go gates — gofmt -l empty · golangci-lint run ./... 0 issues · go vet clean · go test ./... green (all re-run; GOWORK=off).
  • [PASS] 18 · CHANGELOG — CHANGELOG/2026.193.1223.md (placeholder; finalized at merge).

Decision: Independently re-derived in a fresh clone at df30685. The build-resolve wire family is CUE-sourced and reproduces byte-for-byte (task cue:gen = NO-OP); the shared per-image build lock is a correct flock primitive with no TOCTOU and proper release; the R3 one-home for MergeRequest is confirmed (oci.cue only). All Go gates green, SDD mandate satisfied at 100%, attribution grounded by the consumer's pasted real-build R10. PASS → finalizing merge-time CalVer, squash-merging, and tagging.

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

atrawog added 3 commits July 12, 2026 15:07
pr-validator merge-time version stamp for #31.

Assisted-by: Claude (fully tested and validated)
…3.1308

Filename↔H1 integrity for #31 (git mv renames the file but not
its H1 heading).

Assisted-by: Claude (fully tested and validated)
@atrawog
atrawog merged commit ccd68e0 into main Jul 12, 2026
@atrawog
atrawog deleted the feat/p8b-build-engine branch July 12, 2026 13:11
atrawog added a commit that referenced this pull request Jul 15, 2026
…am to 1-op (#67)

## K5-Unit-1 Option A — fix the incomplete-seam violation + shrink the DeployStateHost seam to 1-op

The K5-Unit-1 cutover (#SDK-PR that landed 1b9f376) moved the deploy state-model body into `sdk/deploykit` but introduced an **incomplete-seam violation** (the kernel/plugin boundary law): the kind-blind kit gained a deploy-kind-specific R-item (`MarshalBundleNodeLegacy`) and the `DeployStateHost` seam threaded 3 ops that are either kind-blind kit primitives or deploy-kind-specific transforms that never belonged in a kind-blind kit. This cutover fixes the violation (Option A — clean the kit now; the consumer moves to their plugin homes are the immediately-following K4 wave, tracked not deferred).

### Seam shrinks 4-op → 1-op (`StateHostMechanisms`)

The ONE remaining field is `LoadUnifiedBundleConfig` (the kind-blind unified-loader M, K1-gated — it dies when K1 relocates `LoadUnified` to `sdk/loaderkit`, task #31):

- **`LatestSchemaVersion`** → collapsed to a direct `kit.LatestSchemaVersion()` call (a kind-blind kit primitive; the seam op was a redundant hop).
- **`AcquireDeployConfigLock`** → collapsed to a direct `kit.AcquireFileLock(path+".lock", true)` call (a kind-blind kit primitive; `acquireDeployConfigLock` was a thin charly alias of it).
- **`MigrateDeployEntity`** → removed (the deploy-kind-specific legacy→node-form transform is an R-item that contaminated the kind-blind kit; it was never the kit's to own).

### `MarshalBundleNodeLegacy` leaves the kit (the R-item fix)

`MarshalBundleNodeLegacy` (the deploy-kind-specific struct-body marshal with re-injected `target:`/`nested:`/`peer:`) is REMOVED from `sdk/deploykit/deploy_file.go`. It returns to `charly/deploy_nodeform.go` (beside `migrateDeployEntity`, where it lived pre-K5) as the REDESIGNED `marshalBundleNode` — the "Legacy" name AND the legacy struct-body shape dropped, fused with `migrateDeployEntity` into ONE clean canonical BundleNode → node-form marshal (the super leg of this cutover).

### `SaveBundleConfig` redesigned kind-blind

`SaveBundleConfig` is now a kind-blind file shell: it takes a `marshalNode` callback (the deploy-kind-specific node-form serializer the caller supplies) and does ONLY the version stamp (`kit.LatestSchemaVersion`), the `provides:` directive, the per-entry callback invocation, and the atomic tempfile+rename write with the fail-safe re-check. `SaveDeployState` + `CleanDeployEntry` thread the callback through to `SaveBundleConfig`.

### E/M justification (the 1-op seam)

`LoadUnifiedBundleConfig` is a kind-blind MECHANISM (M) — it loads ANY per-host `charly.yml` through the unified loader and returns its `ProjectBundleConfig`, never branching on a deploy kind. It lives in the seam (not in deploykit directly) ONLY because the `LoadUnified` orchestration has not yet relocated to `sdk/loaderkit` (K1, task #31): once K1 lands, plugin-bundle calls `loaderkit.LoadUnified` directly and this seam dies entirely. Tracked K1-exit + K4-exit tasks.

### Tests

`deploykit/deploy_state_test.go` updated to the new `SaveBundleConfig` callback signature + the 1-op seam. `MarshalBundleNodeLegacy` test removed (the marshal is tested charly-side, where it now lives). The sdk tests execute the changed code LIVE (`go test ./deploykit/` green; `go test ./...` green; `golangci-lint` 0 issues).

### BREAKING

- `MarshalBundleNodeLegacy` removed (public API)
- `StateHostMechanisms.LatestSchemaVersion` / `AcquireDeployConfigLock` / `MigrateDeployEntity` fields removed
- `SaveBundleConfig` / `SaveDeployState` / `CleanDeployEntry` signatures changed (added `marshalNode` callback)

### B2

This is B2 leg 1 (sdk). The super leg (charly gitlink bump + go.mod require bump + the redesigned marshal moved to charly/deploy_nodeform.go + the ~12 charly/ consumer call-site updates + deploy_state_host.go init shrink + the orchestrator's full disposable bed roster R10 CONCURRENTLY) follows.

*Assisted-by: Claude GLM 5.2 Cloud (analysed on a live system)*
aitrawog pushed a commit that referenced this pull request Nov 19, 2026
Stripping (K1, task #31) left '// : once K1 lands ...' in the StateHostMechanisms block

-- a fragment with no subject. The regex removed a parenthetical and the sentence around it

was not rebuilt, so the result was neither present tense nor English.

The K1-exit task reference goes too: it names when the seam dies, not what it does.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)
github-actions Bot pushed a commit that referenced this pull request Nov 19, 2026
… construction (#581)

* docs(deploykit): D-CODE-4 sweep, deploy-file and the render-generator construction

DESIGN.md:2649 -- D-CODE-4, comments describe present code; history goes to CHANGELOG/.
Fifteen historical comment sites across deploy_file.go and
render_generator_from_project.go, rewritten to present tense with every load-bearing reason kept.

deploy_file.go said the former trailing-variadic form silently fell back to the process env,
that SaveDeployConfig no longer depends on the DeployStateHost package var, that ExportAllBox
was relocated from charly/deploy.go (K5-Unit-1, the #67 keystone) and that the former
per-deploy version: is GONE. It now says why ctx is REQUIRED (no fail-open fallback exists, so
an omitting caller fails to compile), that the host-coupled leg is injected, that the state
model is built from the SAME envelope inspect/list/validate consume, and that the box overlay
carries no version:.

render_generator_from_project.go said plugin-build's former buildRenderGenerator was the sole
caller, that the whole HostBuild(render-seam) kind is DELETED, that ExtraRef REPLACES the former
ensure-builders host round-trip, and that several seams were closed by P8b/W3. It now states
the shared construction source, that no hostBuild and no render-seam kind exist, and why
on-demand per-word connect needs no second copy of the scan machinery.

Comment-only, proven by the ranged git diff filter. build, vet and gofmt clean;
go test ./deploykit/ ok.

This is deploykit fourth unit. 136 of the widened-class sites remain, named by file and count
in opencharly/opencharly#1147.

Agent: lead
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

* docs(deploykit): drop the phase and campaign tags the first pass left behind

The body claimed only the relocations and the phase tags are gone, and fourteen phase

references and one campaign narrative survived -- K3, K5-Unit-1, W3, #55 W3 B4, #67,

K-wave 2 cone R1, S-K5, coneB-buildtail, and the paragraph recounting that five of nine

seams went first.

A phase tag says when the code moved, not what it does; the campaign paragraph is

history D-CODE-4 sends to CHANGELOG. Both are gone; every reason is kept.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

* docs(deploykit): repair the comment my tag-stripping regex left dangling

Stripping (K1, task #31) left '// : once K1 lands ...' in the StateHostMechanisms block

-- a fragment with no subject. The regex removed a parenthetical and the sentence around it

was not rebuilt, so the result was neither present tense nor English.

The K1-exit task reference goes too: it names when the seam dies, not what it does.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

* docs(deploykit): remove the five relocations the tag-stripping left behind

Stripping (K5-Unit-1) left the sentence it qualified: Relocated from charly/deploy.go

survived five times in deploy_file.go, so the body's claim that only the relocations

and the phase tags are gone was false in the same file.

This is the third time in this PR family that a regex removed a tag and left the sentence

around it: a tag lives inside a sentence, so the sentence is what has to be rewritten.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

* docs(deploykit): rewrite the file header, which was a relocation narrative in one block

deploy_file.go opened with relocated out of charly/deploy.go, the PURE helpers were already

here, and this cutover moved the state-model bodies -- history for a block of eight lines.

It now states what the file holds and lists the same bodies. render_generator's Every

former host-coupled seam becomes Every seam that would need it, which says the same thing in

the present.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

---------

Co-authored-by: aitrawog <dsh-opencharly@local>
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