Repository navigation
feat(schema): microVM artefact arms — a raw/ext4 rootfs and a kernel in the VM-box contract - #229
Conversation
…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)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no weakened guardrails, no injected directives; body is data, not instruction. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
… 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]>
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#VmBoxMetadataonai.opencharly.vm.box) could describe only one file at one fixed path.The five files in the diff, each accounted for:
schema/vm_box_metadata.cue#VmBoxSource.kind+=rootfs,kernel; their arm fields (format,disk_mib,sha256,release,cmdline); the new#VmBoxArtifactsdef;#VmBoxMetadata.artifacts?schema/vm_box_metadata_test.gospec/vm_box_labels.goVmBoxLabelMap["Artifacts"]— the entry the repo's own completeness gate demandedspec/vm_box_metadata_test.gospec/cue_types_gen.gocharly task cue-gen— never hand-editedWhat each artefact carries, and why it is not duplicated. What a file is lives on
#VmBoxSource: arootfsrecords the image whose tree was materialised, itsformatand 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); akernelrecords 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_pathandkernel_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 assourcedoes — 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):Controls — each gate made to fail by removing its own schema line:
The strongest control here was not written by me — the repo's own completeness gate failed on the first run of this change:
That is coverage failing for exactly the right reason, and both halves it demanded are in this diff:
VmBoxLabelMapgains the entry, and the label round-trip test now round-trips a microVM-shapedVmBoxMetadata— rootfs provenance arm plus the layout record — through the singleai.opencharly.vm.boxlabel. 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
/charly-internals:capabilities(the OCI-label contract and the completeness gate this change tripped),/charly-internals:goand/charly-internals:plugin(the SDD pipeline and the boundary law),/charly-internals:git-workflow; and thespecrepo's ownAGENTS.mdread before acting in it.VmBoxLabelMapentry. RCA: I read the file's own R8 note and thecapabilitiesskill (which describes the pod half'sCapabilityLabelMap) 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.#VmBoxSource, where it lives on#VmBoxArtifacts; the new record deliberately carries noformat/sha256/cmdline, and the disk-only path conventions were not replaced by a second mechanism.git status --shortclean on the head; one commit; PR-only landing; no force-push, no bypass.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.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.N/A — this module ships no binary; the generated Go is compiled by the module's own gate.cue-genwith its reproducibility check, build, the full 24-package suite, gofmt, golangci-lint — all green above) plus the orgvalidate / validaterun on this head. The consumer side (thesdkemitter/reader, WI-3) is the next producer-first leg and is deliberately not here.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.N/A — no concurrency is involved in a schema definition.gofmt -lempty andgolangci-lint0 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: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)