Skip to content

feat(schema): microVM artefact arms — a raw/ext4 rootfs and a kernel in the VM-box contract - #229

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/firecracker-artifact-contract
Oct 14, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/firecracker-artifact-contract

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

Adds the microVM artefact arms to the VM-box contract, and the in-image layout record that lets one image carry two files. Closes #228.

A microVM's root drive is not one of the existing disk-image arms: the producer that works on a device-less host — mke2fs -t ext4 -d <tree> <file>, measured as umbrella ledger probe P3 on a host with no loop device, no device-mapper and no privileged container — yields a file, and the VMM boots it together with a separate kernel. Neither had a provenance arm, and the delivery vehicle (sdk/deploykit.EmitVmBoxAt → an OCI image whose labels carry #VmBoxMetadata on ai.opencharly.vm.box) could describe only one file at one fixed path.

The five files in the diff, each accounted for:

File Change
schema/vm_box_metadata.cue #VmBoxSource.kind += rootfs, kernel; their arm fields (format, disk_mib, sha256, release, cmdline); the new #VmBoxArtifacts def; #VmBoxMetadata.artifacts?
schema/vm_box_metadata_test.go new — five CUE gates over the arms, the layout record and the metadata shape
spec/vm_box_labels.go VmBoxLabelMap["Artifacts"] — the entry the repo's own completeness gate demanded
spec/vm_box_metadata_test.go the label round-trip test gains a microVM-shaped second case
spec/cue_types_gen.go generated by charly task cue-gen — never hand-edited

What each artefact carries, and why it is not duplicated. What a file is lives on #VmBoxSource: a rootfs records the image whose tree was materialised, its format and the size it was built at (the deploy needs the size to decide whether the delivered filesystem must grow — a truncated file alone does not grow the filesystem inside it); a kernel records its digest, its release and its command line, which for a TAP network is where the guest's address is delivered (ip=<guest>::<host>::<mask>::<iface>:off) and therefore belongs to the artefact rather than to each deploy that boots it. Where a file is lives on #VmBoxArtifacts — rootfs_path and kernel_path, and nothing else, so no fact is stated twice (R2). The disk-only shapes keep today's path conventions untouched (/disk.qcow2, /disk/disk.img), which stay constants in the reader.

Wire compatibility. Every added field is optional, following the file's own convention for optional nested records — a value with omitempty, exactly as source does — so an artefact published before this change keeps parsing (gated below).

How tested

Five new CUE gates, and the module's own repo gates, all on the committed head (2cba4f0):

$ go test ./schema/ -run 'VmBox' -v
  --- PASS: TestVmBoxSource_MicroVMArmsAccepted        (rootfs + kernel arms, with their facts)
  --- PASS: TestVmBoxSource_DiskOnlyArmsUnchanged      (the six existing arms still validate)
  --- PASS: TestVmBoxArtifacts_Accepted                (the layout record, and its closedness)
  --- PASS: TestVmBoxMetadata_MicroVMShapeAccepted     (the whole microVM-shaped metadata record)
  --- PASS: TestVmBoxMetadata_PublishedArtifactStillParses  (an artefact predating the change)
  --- PASS: TestVmBoxSourceAcceptsContainerDiskProvenance   (the pre-existing gate, unchanged)
$ go test ./...                                      → exit 0, 24 packages ok
$ gofmt -l schema/ spec/                             → (empty)
$ golangci-lint run ./schema/... ./spec/...          → 0 issues
$ charly task cue-gen                                → reproducible (TestGenReproducible passes)

Controls — each gate made to fail by removing its own schema line:

$ <drop "rootfs" | "kernel" from the closed kind enum>   → --- FAIL: TestVmBoxSource_MicroVMArmsAccepted
$ <remove the artifacts record from #VmBoxMetadata>      → --- FAIL: TestVmBoxMetadata_MicroVMShapeAccepted

The strongest control here was not written by me — the repo's own completeness gate failed on the first run of this change:

$ go test ./...
  --- FAIL: TestVmBoxLabelCompleteness
      spec.VmBoxMetadata fields without VmBoxLabelMap entry: [Artifacts]
  FAIL  github.com/opencharly/spec/spec

That is coverage failing for exactly the right reason, and both halves it demanded are in this diff: VmBoxLabelMap gains the entry, and the label round-trip test now round-trips a microVM-shaped VmBoxMetadata — rootfs provenance arm plus the layout record — through the single ai.opencharly.vm.box label. That round-trip is the gate this work item is stated to need (ledger WI-2), and it is the repo's own, not an invention of this PR.

Rulebook compliance

  • R0 — skills loaded before the first action: /charly-internals:capabilities (the OCI-label contract and the completeness gate this change tripped), /charly-internals:go and /charly-internals:plugin (the SDD pipeline and the boundary law), /charly-internals:git-workflow; and the spec repo's own AGENTS.md read before acting in it.
  • R1 — one finding, raised by the repo itself and fixed in this change: the missing VmBoxLabelMap entry. RCA: I read the file's own R8 note and the capabilities skill (which describes the pod half's CapabilityLabelMap) and generalised from them, without checking whether the VM-box half has its own map — it does, and its completeness test is the enforcement. The missed control was reading the sibling's gate instead of the gate that owns this file. Root fix: the entry plus the round-trip case, above. The issue text's claim that no label machinery was involved is corrected on feat(schema): microVM artefact arms — a raw/ext4 rootfs and a kernel in the VM-box contract #228.
  • R2 — one place per fact: what an artefact is lives on #VmBoxSource, where it lives on #VmBoxArtifacts; the new record deliberately carries no format/sha256/cmdline, and the disk-only path conventions were not replaced by a second mechanism.
  • R3 — no workaround: the closed kind enum gains two real arms rather than the field being loosened to a free-form string, and the gates assert both directions (accepted arms and a refused word outside the enum).
  • R4 — the contract is the product; no prose routes around anything. The layout record exists because the reader genuinely cannot find two files without it.
  • R5 — nothing legacy added: no alias arm, no deprecated spelling, no shadow of the old path conventions.
  • R6 — git status --short clean on the head; one commit; PR-only landing; no force-push, no bypass.
  • R7 — every acceptance gate asserts completeness (cue.Concrete(true)), not merely "no error", and each has a control that fails without its schema line; the round-trip gate proves the emitted wire form rather than the struct's shape.
  • R8 — N/A — no live service boundary is crossed; the contract is validated in-process through the loader's own concatenation path and the label round-trip is pure Go.
  • R9 — N/A — this module ships no binary; the generated Go is compiled by the module's own gate.
  • R10 — change class: CUE contract + generated Go. The gates that own it are the module's own (cue-gen with its reproducibility check, build, the full 24-package suite, gofmt, golangci-lint — all green above) plus the org validate / validate run on this head. The consumer side (the sdk emitter/reader, WI-3) is the next producer-first leg and is deliberately not here.
  • HC — one cutover: the arms, the layout record, the label map and the round-trip coverage move together, and the completeness gate's demand is satisfied rather than deferred.
  • ARCH — the contract lives in the contract module; no mechanism, no emitter behaviour and no kernel-side kind knowledge is added here.
  • DISP / PIL — N/A — no disposable target is touched: this is the authored-config and wire contract, proven by the module's own gates on the committed tree. The RDD half that fixed this contract's shape (the rootfs producer on a device-less host) is recorded in the umbrella ledger.
  • CONC — N/A — no concurrency is involved in a schema definition.
  • QUAL — gofmt -l empty and golangci-lint 0 issues on the changed packages.

Change classification

Contract: CUE schema, two test files and one label-map entry, plus the regenerated Go. No runtime behaviour, no plugin, no consumer change. The wire effect is additive and optional-only, so no existing document changes meaning.

Attribution evidence (authoring runtime, not a config read). Harness DSH, dsh --version → 0.2.0-rc.2, DSH_PROFILE=web, DSH_SESSION_ID=session-1df63bd3-95ba-4edc-a628-63c2122888d7; model and provider read from the harness's own record of this session:

$ zstd -dc ~/.dsh/sessions/--home-atrawog-…--/session-1df63bd3-….v4.jsonl.zstd \
    | grep -oh '"model":"[^"]*"' | sort | uniq -c
    664 "model":"deepseek-v4.1-flash"
$ … | grep -oh '"provider":"[^"]*"' | sort | uniq -c
    664 "provider":"ollama-cloud"

Tier: fully tested and validated — every gate this change class declares passed on the committed head (cue-gen + reproducibility, build, the full suite, gofmt, lint), the five new gates were each proven to fail without their own schema line, one acceptance gate was proven to fail by the repo's own completeness test before the fix, and the round-trip gate exercises the real wire form.

Closes #228

Assisted-by: DSH deepseek-v4.1-flash (fully tested and validated)

…in the VM-box contract

A microVM's root drive is not one of the disk-image arms: the producer that works on a
device-less host (`mke2fs -t ext4 -d <tree> <file>`, umbrella ledger probe P3) yields a FILE,
and the VMM boots it together with a SEPARATE kernel. Neither had a provenance arm, and the
delivery vehicle could describe only one file at one fixed path.

- `#VmBoxSource` gains the microVM pair: `rootfs` (the file the VMM attaches, with the format
  it was built in and the size it was built at, because a truncated file does not grow the
  filesystem inside it) and `kernel` (the uncompressed vmlinux, with its digest, release and
  command line — for a TAP network the command line is where the guest's address is delivered,
  so it belongs to the artefact rather than to each deploy that boots it).
- `#VmBoxArtifacts` is the in-image LAYOUT: where the root drive and the kernel live in the
  image. It carries only paths; what each artefact IS stays on `#VmBoxSource`, so no fact is
  stated twice.
- `#VmBoxMetadata` gains the optional `artifacts` record, following the file's own convention
  for optional nested records (a value with omitempty, exactly as `source` does).

Every added field is optional, so an artefact published before this change keeps parsing.

The repo's OWN completeness gate caught what the change still owed, and both halves are fixed
here rather than deferred:

    spec.VmBoxMetadata fields without VmBoxLabelMap entry: [Artifacts]

so `VmBoxLabelMap` gains the entry, and the label round-trip test now carries a
microVM-shaped metadata record as its second case — proving the new record survives the single
`ai.opencharly.vm.box` label byte-for-byte, which is the gate this work item is stated to need
(umbrella ledger WI-2).

Gates: five new CUE gates (both arms accepted; the six disk-only arms still validating; the
layout record accepted and closed; the whole microVM shape accepted; an artefact published
before the change still parsing), each controlled by removing its own schema line and watching
it fail; the module's own suite green at 24 packages; `charly task cue-gen` reproducible;
gofmt clean; golangci-lint 0 issues.

Assisted-by: DSH deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 2cba4f00665d4b6cdf2f3380587b746f125c503e (branch: feat/firecracker-artifact-contract)

Security screen: PASS — no secrets/egress, no weakened guardrails, no injected directives; body is data, not instruction.
Placement: CORRECT — pure contract layer (CUE schema + generated Go + label map + tests); no mechanism or kind knowledge added to core/sdk.
Checklist: All applicable rules PASS or NA (A1–A3, R0–R10, PIL/ADE/SDD, HC, DISP, QUAL, COORD). Body accounts for all 5 files; SDD source+generated change move together; label-completeness finding fixed in-tree with round-trip coverage; no forbidden framing; attribution footer present and tier consistent with the executed gates.
Comments: none to disposition (0 comments).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 14, 2026 12:12
@github-actions
github-actions Bot merged commit cd1d563 into main Oct 14, 2026
2 checks passed
github-actions Bot pushed a commit to opencharly/sdk that referenced this pull request Oct 14, 2026
… one VM box (#380)

* feat(deploykit): deliver the microVM shape — a rootfs and a kernel in one VM box

A microVM's root drive is a FILE the VMM attaches, and the kernel it boots with is a SEPARATE
file; the two usually live in different directories. The emitter could describe one file at one
fixed path, so a reader had nothing to find a second artefact by.

- The emitter's body is extracted into an artefact-LIST-driven builder (`emitVmBoxArtifacts`), so
  both shapes share ONE validation, staging rule, render and build (R2); `EmitVmBox` and
  `EmitVmBoxAt` keep their signatures and behaviour as thin wrappers.
- `EmitVmBoxMicroVM` delivers the root drive and the kernel at the shipped microVM paths
  (`/rootfs.img`, `/vmlinux`) and records the layout it WROTE in `spec.VmBoxMetadata.Artifacts`
  only AFTER the build succeeds — a failed emit leaves the caller's metadata untouched, so a label
  can never describe a box that was not built.
- Staging: when the artefacts share a directory it IS the context (today's behaviour — the file is
  never copied, buildah streams it into the layer); otherwise a context is staged in which a qcow2
  overlay is flattened and every other artefact is hardlinked, a byte copy only when the filesystem
  refuses the link, so a multi-gigabyte rootfs is still not copied.
- `go.mod` adopts the contract that carries the arms (`opencharly/spec#229`, merged `cd1d563`) —
  which required the alias deletion that landed separately as `#378`.

Gates on this tree, the module's own CI-equivalents: gofmt clean, build and vet rc=0, `go test`
rc=0 (15 ok packages), golangci-lint 0 issues, cross-compile amd64/arm64/arm/386. New coverage: the
two-artefact render (pure), the deterministic guards (nil metadata; a missing artefact refused
before anything is staged; a failed emit records NO layout), and a LIVE e2e that builds a real box
from two artefacts in DIFFERENT directories and asserts both land at their recorded paths, that the
label round-trips the layout AND the provenance, and that the sources survive — live podman,
skipping visibly without it. Both controls measured: dropping the kernel from the delivery fails the
e2e at `podman cp /vmlinux`, and dropping the layout recording fails it at the recorded-layout
assertion.

Also corrected: `AGENTS.md` still told a reader to bump the spec `#SchemaVersion`, which the contract
module deleted (R4); and the engine-guard helper's `engine` parameter — always "podman" in this
package — is removed rather than suppressed, since clean `main` reports 0 lint issues and this
change's added call surfaced that dead surface.

Assisted-by: DSH deepseek-v4.1-flash (fully tested and validated)

* test(deploykit): stop discarding the engine's stderr when the microVM e2e creates its container

The live e2e ran on the CI runner (so the engine was usable and the skip guard did its job) and
failed at `podman create` with nothing but `exit status 125` — because the helper used `.Output()`,
which keeps stdout and throws the engine's own reason away. A failing test that hides its cause
turns one read into a guessing game, and it is the same defect class as an unsubstantiated claim:
the evidence is discarded at the moment it is produced.

`CombinedOutput` now, with the command and the reference in the message, so the next CI failure
names its own cause.

Assisted-by: DSH deepseek-v4.1-flash (fully tested and validated)

* test(deploykit): create the e2e container with the placeholder a scratch image needs

The CI run named its own cause as soon as the engine's stderr stopped being discarded:

    podman create …: exit status 125: Error: no command or entrypoint provided, and no CMD
    or ENTRYPOINT from image

A `FROM scratch` image that only COPYs artefacts carries no CMD, and a runner whose podman enforces
the image config refuses to create a container from it. `create` executes nothing, so the command it
demands is inert.

- ONE helper (`createContainer`) now owns "make a container object to read a layer from": it supplies
  the placeholder, returns the engine's own output on failure, and is used by BOTH e2e tests. The
  pre-existing overlay e2e carried the same latent defect, shielded only by the `qemu-img` skip that
  runs above its own create.
- `strings` is dropped from the microVM e2e, which no longer trims the engine's output itself.

Gates: gofmt clean, `go vet` ok, `go test -count=1 ./...` rc=0 (15 ok packages, the live tests
included), golangci-lint 0 issues.

Assisted-by: DSH deepseek-v4.1-flash (fully tested and validated)

---------

Co-authored-by: Andreas Trawoeger <[email protected]>
charly-auto-merge Bot added a commit that referenced this pull request Oct 14, 2026
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.

feat(schema): microVM artefact arms — a raw/ext4 rootfs and a kernel in the VM-box contract

2 participants