Repository navigation
feat(schema): add defaults.buildkit, the buildkitd daemon settings - #447
Conversation
One buildkitd serves every box a project builds, so its settings are project-level (`defaults.buildkit`). #Buildkit models the [worker.oci] surface charly manages - process mode, max-parallelism, snapshotter, noProcessSandbox, the GC budget (reserved/max-used/min-free), per-record gcpolicy entries, the registry mirror - plus a raw `extra` TOML escape hatch for any setting charly does not model. #BuildResolveReply carries the same shape to the build drive so the drive can render it into buildkitd.toml. The GC fields are the measured cache fix for opencharly/charly#1292: the compiled default free-space target (373 GB) prunes the cache to its ~10 GB floor on a host with less free space, so an unchanged tree re-executes. Generated with the in-process schemagen pipeline (params + vocab); TestGenReproducible passes on the committed tree. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5`* · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)*
Review — BLOCKHead SHA: Change class: contract/schema module (CUE source + regenerated Go types); no deployable target. Placement is Blocks
Non-blocking note (A3, tool-limited): Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
`defaults` was an untyped document directive, so #Buildkit was reachable only from #Box and the resolve reply: an authored defaults.buildkit was never validated by the load-time gate, and a mistyped or out-of-range knob reached the Go decode silently. Typing the one block closes that hole without closing the rest of defaults. The new test binds to the SAME schemaconcat/load gate the runtime uses: a full buildkit block is accepted and decodes into spec.Buildkit (gcpolicy + extra included), a negative max_parallelism is rejected by the >=0 constraint, an unknown knob is rejected by the closed def, and the resolve-reply wire half is exercised. The two negative arms fail on the unmodified tree. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)*
|
STATUS All four blocks are addressed on the new head
Gate on the head: Agent: |
The typed defaults.buildkit must not close the defaults directive: a realistic project document keeps platform/registry/build/keep_images/context_ignore/stage_parallelism and still loads. Pinned so a later tightening of the node gate cannot quietly reject every real charly.yml. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)*
Review — PASSHead SHA: Security screen: PASS — no secrets, no guardrail weakening, no supply-chain change, no injection; the diff adds a CUE def, its generated types, and a test only. Comment dispositions:
Non-blocking notes (no block):
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ngs (#71) * feat(build): render defaults.buildkit into the buildkitd daemon settings The project's authored defaults.buildkit (spec #Buildkit) now reaches the drive: resolve fills BuildResolveReply.Buildkit, and the drive maps it onto buildkitdrive.DaemonOptions (process mode, max-parallelism, snapshotter, noProcessSandbox, the GC budget, gcpolicy entries, registry mirror, extra). An unauthored field keeps the drive's fallback (the resolved stage parallelism, the CHARLY_BUILD_REGISTRY_MIRROR env); the GC budget itself defaults in sdk/buildkitdrive to 100 GB - the measured fix for the cache eviction that made an unchanged tree re-execute its layers (opencharly/charly#1292). Depends on opencharly/spec#447 (#Buildkit) and opencharly/sdk#650 (DaemonOptions + the 100 GB default). Producer-first: the go.mod requirement bumps land after those merge and tag. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)* * fix(build): adopt sdk v0.2026331.1440 + spec v0.2026331.1221, and track the content-addressed candy stage dir The daemon-config mapping needs the released DaemonOptions (the #Buildkit fields and the 100 GB GC default) and defaults.buildkit from spec. Adopting them surfaced one real integration break the gate caught: spec#445 made CandyStageDirName CONTENT-ADDRESSED (name.<sha256[:16]>) with the version-keyed form only as the fallback, and remote_candy_copies_test.go hardcoded marker.<version>. The test now asks the same deploykit.CandyStageDirName the emitter uses, so the guard tracks the contract rather than a stale spelling. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)* * test(build): pin the daemon TOML the mapping actually renders The mapping was pinned only at the struct level, so the artifact the drive writes was unproven and a reviewer could not tie the pasted TOML to this code. This test renders driveConfig.daemonOptions() through sdk's DaemonConfig and asserts the exact keys the daemon loads, including the two buildkitd spellings (process-mode, max-parallelism) alongside the camelCase worker/GC fields, and that an unauthored project still renders the stage parallelism and the 100 GB GC default. Red arm: restoring the two-field Ensure behaviour fails it. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)*
Summary
Adds the project-level buildkit daemon surface to the contract:
#Buildkit(the[worker.oci]settings charly manages), referenced by#Box(so a box entity'sbuildkit:is validated), by#NodeDoc(so the authoreddefaults.buildkitis validated by the load-time document gate, not silently decoded), and by#BuildResolveReply(so the build drive receives the authored settings and renders them intobuildkitd.toml).Fields:
process_mode,max_parallelism,snapshotter,no_process_sandbox, the GC budget (reserved_space/max_used_space/min_free_space), per-recordgcpolicyentries,registry_mirror, and a rawextraTOML escape hatch for any daemon setting charly does not model. Every field is optional; an empty value selects the daemon's own default — except the GC budget, which the drive always writes (100 GB), because buildkitd's compiled free-space target (373 GB) prunes the cache to its ~10 GB floor on a host with less free space. That is the measured cache-invalidation driver in opencharly/charly#1292: the small arch RUN stays CACHED while the builder's largepacman -Syulayers re-execute and change the artifact.Producer/consumer order: this schema lands first;
opencharly/sdk(the renderer + 100 GB default, PR #650) is independent of it;opencharly/plugin-buildreads the shape and passes it to the daemon;opencharly/charlybumps the pins and runs the bed.How tested
Contract-module change class (no deployable target in
spec; itscharly.ymlis the maintenance manifest only): the repo's module CI is the gate, run on this head (799ed881c0406be534c81c9227e58834f69574c7).The generation remains reproducible (
TestGenReproducible, part of the./spec/suite above —ok). Generated types on the head:Buildkit,BuildkitGCPolicy,Box.Buildkit *BuildkitandBuildResolveReply.Buildkit *Buildkit;BoxConfigis a Go ALIAS ofBox(spec/charly_names.go: BoxConfig = Box), so both spellings name the same generated field.R10 coverage (the test fails without the change)
schema/buildkit_test.gobinds to the SAMEschemaconcatconcatenation +#NodeDocgate the runtime loader uses (not a hand-built copy), andspec.Buildkit/spec.BuildResolveReplyfor the decode:The RED arm — the same test with
defaults?: _restored (the unmodified tree):That red arm is also the defect the review's R10 block surfaced:
defaultswas_, sodefaults.buildkitwas never shape-checked.schema/node.cuenow types exactly that one block (defaults?: {buildkit?: #Buildkit}) and leaves every other defaults key open.Spike
RCA claim (from charly#1292): the repeated-build cost is the daemon's default GC pruning the cache, not the per-build tag; the project needs an explicit, authorable GC budget.
Instrument: a throwaway probe compiled against the shipped schema (
schemaconcat+#NodeDoc, the load-time gate) that unifies one candidate document per arm and prints ACCEPTED/REJECTED with the CUE error. Run twice —SP-1on this head,SP-2withschema/node.cue'sdefaults?: _restored (the pre-change tree) — so each candidate is measured, not argued.Reading the round:
defaults(defaults.buildkit_max_parallelism, …).ACCEPTEDin BOTH trees, including the out-of-range-1: a scalar scatter leaves the value unvalidated and cannot express a[[worker.oci.gcpolicy]]list. Eliminated.defaults.buildkitTOML string.ACCEPTEDon the pre-change tree andREJECTEDon this head: once the field is typed it is not a string, and if it stays untyped nothing is checked. It cannot be the primary surface; it survives only asextra. Eliminated as the surface, kept asextra.#Buildkitdef referenced by#Box,#NodeDocand#BuildResolveReply. The only arm that isACCEPTEDfor a valid document andREJECTEDfor-1and for a mistyped knob, while the empty block stays legal. Winner.Winner: B. RCA verdict: confirmed — the def compiles, regenerates reproducibly, the generated types round-trip the shape into the resolve wire, and only B enforces the range/closedness that the authored surface needs.
Rulebook compliance
image/layer/go/design/strict-policy/git-workflowloaded before the work.git diff --stat+ the exactBox.Buildkittype above), and the missing D-id (R11 below). The label-position and tag hypotheses were tested and disproved on the charly side and recorded in the base builder is rebuilt under a new CalVer tag on every build, so no layer is ever reused charly#1292.#Buildkitdef serves the ingress, the load gate and the wire; no second shape.#Buildkitis closed, so an unknown knob is an error (proved by themax_paralellismarm).schema/buildkit_test.go).specdeclares nodisposable: trueentity. The consumer bed rides thecharlypin-bump PR.>=0/closedness rules live in CUE (the test unifies, it does not restate), and the 100 GB GC budget is declared at the layer that renders it (sdk#650), not hidden in code here. No DESIGN amendment is needed and none is made.Change classification
Additive schema:
defaults.buildkitbecomes authorable, validated by the load-time gate, and carried to the drive; existing configs are unchanged (the block is new and every field optional). Breaking change + rollback: none — absent means the daemon default; rollback is a revert of this squash (the generated types disappear with the def).Filed issues
pacman -Syu/releases/latestinputs change the bytes on a cold rebuild (the non-reproducibility that keeps the cache/digest moving); this PR carries only the authored daemon surface that lets the GC budget be declared.charlypin-bump leg, not this PR.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)