Skip to content

defaults.buildkit never reaches the build drive: the loader's walk envelope (spec.LoadedProject) carries no Defaults, so the authored block is dropped #1306

Done
opencharly/spec
#448

Description

@aitrawog

Category

category:delivery

Type

type:fix

Remedy / files the remedy will touch

the loader's defaults projection: spec #LoadedProject (+ its materialize) and charly/host_build_loader_floor.go's MaterializeLoadedProject merge — the project's defaults: block must survive the walk->materialize round trip

Cited design decision or org-rulebook rule (or none)

none

Classification

Blocking — it blocks the filer's own progress, so the filer claims it at filing and fixes it.

Evidence (verified: commands with output, file:line, measurements)

Reproduced 2026-11-27 with charly built from the pin bump (spec v0.2026331.1221,
sdk v0.2026331.1440, plugin-build v0.2026331.1456), against a mini project that authors:

defaults:
  buildkit:
    max_parallelism: 2
    reserved_space: "50GB"
    max_used_space: "60GB"
    min_free_space: "7GB"
$ charly -C mini box validate
charly box validate: OK — checked 2 boxes, 6 distros, 7 builders; 0 warnings, 0 errors
$ charly -C mini box build testreuse        # exit 0
$ grep -E "max-parallelism|reservedSpace|maxUsedSpace|minFreeSpace" \
      "$XDG_CACHE_HOME/charly/buildkitd/buildkitd.toml"
  max-parallelism = 4          <- NOT the authored 2
  reservedSpace = "100GB"      <- NOT the authored 50GB
  maxUsedSpace = "100GB"
  minFreeSpace = "10GB"

So cfg.Defaults.Buildkit is nil at resolve (plugin-build resolve.go: Buildkit: def.Buildkit).

SPEC IS NOT THE FAULT — a plain decode populates it:

$ go test ./spec/ -run TestZZDefaultsBuildkit -v
PROBE buildkit=&{MaxParallelism:2 ReservedSpace:50GB MaxUsedSpace:60GB MinFreeSpace:7GB}

The drop is in the loader chain: spec.LoadedProject (the walk envelope) has NO Defaults
field (spec/cue_types_gen.go: type LoadedProject struct carries EmbeddedDefaultsDigest
only), and charly/host_build_loader_floor.go materializes
merged := &spec.UnifiedFile{} from that envelope via
loaderkit.MaterializeLoadedProject, so merged.Defaults stays zero and
uf.Defaults.Buildkit is nil plugin-side.

Consequence: the authored defaults.buildkit surface is INERT. The 100 GB GC default still
applies (it is sdk-side), so the cache fix ships; only the AUTHORING of daemon settings is lost.

Mechanism

the loader materializes a fresh spec.UnifiedFile from spec.LoadedProject, which has no Defaults field, so merged.Defaults is zero and every authored defaults.* key the materialize step does not separately re-apply (buildkit) is lost before the plugin resolves

Missed control

the authored shape was validated by the #NodeDoc gate and pinned by a plugin unit test on a hand-built BoxConfig, so neither the loader round trip nor an end-to-end authored project was exercised; the surface was declared live on that basis

Blast radius

the whole authored defaults.buildkit surface (GC budget, worker knobs, gcpolicy, extra) is silently ignored while the shape validates and the build succeeds — invisible to the operator

Root fix

carry the project defaults through the walk envelope (or re-read them plugin-side) and assert them in a test that authors the block in a project file and checks the resolved reply's Buildkit

Spike (its result, or none with the reason)

none: the observation is the instrument (authored 50/60/7GB vs the written 100GB/4 daemon config, plus the YAML-decode control); the remedy is a loader-carried field

Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Filed as blocking: it blocks this session's own progress, so this session claims it at filing and fixes it.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  2. added
    category:delivery
    type:fix
    on Nov 27, 2026
  3. self-assigned this
    on Nov 27, 2026
  4. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Claiming: I filed this while landing the buildkit wave (#1292) and it invalidates a claim I had made, so it is mine to fix.

    The authored defaults.buildkit surface is INERT until the loader carries the project defaults through the walk envelope. The pin bump for the wave is opening with exactly that scope stated: the pins deliver the sdk-side 100 GB GC default and plugin-build's ref reuse (both proven live), and the authored block becomes live when this issue lands.

    Fix site, from the evidence in the issue: spec.LoadedProject has no Defaults field and charly/host_build_loader_floor.go materializes a fresh spec.UnifiedFile from it, so merged.Defaults is zero. Producer-first: the carrying field is spec-side (plus its materialize), then the charly loader leg, then a bump.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  5. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — fixed by opencharly/spec#448 (merged, tag v0.2026331.1553) and proven end to end on the consumer.

    mergeBoxConfig now carries defaults.buildkit through the walk→materialize merge (it was missing from the per-field list, so the block validated and then vanished).

    Consumer proof — a project authoring max_parallelism: 2 / reserved_space: 50GB / max_used_space: 60GB / min_free_space: 7GB, built with a binary carrying the fix:

    $ # project charly.yml authors: buildkit: {max_parallelism: 2, reserved_space: 50GB,
    $ #                            max_used_space: 60GB, min_free_space: 7GB}
    $ charly -C mini box build testreuse        # fresh XDG_RUNTIME_DIR/XDG_CACHE_HOME
    $ grep -E "max-parallelism|reservedSpace|maxUsedSpace|minFreeSpace" \
          "$XDG_CACHE_HOME/charly/buildkitd/buildkitd.toml"
      max-parallelism = 2
      reservedSpace = "50GB"
      maxUsedSpace = "60GB"
      minFreeSpace = "7GB"
    

    Before the fix (same project, same command) the drive wrote max-parallelism = 4 and the sdk
    defaults 100GB/100GB/10GB, because mergeBoxConfig did not carry DefaultValues.Buildkit
    through the walk→materialize merge.

    Before the fix the same project wrote max-parallelism = 4 and the sdk defaults 100GB/100GB/10GB. The consumer pin lands in #1307.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

category:deliverytype:fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions