Skip to content

feat(schema): add the firecracker microVM substrate contract (kind + deploy + state) #226

Closed

Description

@aitrawog

What

Add the firecracker microVM substrate to the contract: a kind: firecracker entity + a deploy: firecracker node, its persisted deploy state, and the two hand-maintained vocabulary lists that must name it.

This is the first leg of the Firecracker + Fireactions integration into charly (the full plan and its RDD proofs are in the umbrella's ledger, .dsh/ledger/firecracker-fireactions-integration.md).

Why the schema first (SDD)

A substrate is registered by its plugin, but recognized by the contract: the deployable-kind vocabulary, the per-kind value gate the host consults, the persisted-state field, and the template/resolve envelope are all CUE-owned here. kubevirt is the precedent and the shape to mirror — it cost 15 files in spec and zero edits in charly core, because a substrate reaches the kernel only by resolving to a VenueDescriptor + InstallPlan.

Scope (this issue)

  1. schema/firecracker.cue — the closed #Firecracker def: the host surface (vmm incl. the jailer posture, kernel, network with TAP/CNI + forwarding + resolver, containerd, fireactions with its pools) and the per-instance surface (image, machine incl. drives and rate limiters, mmds, cloud_init, vsock, serial/logger/metrics, snapshots).
  2. schema/node.cue — #ResourceKind gains firecracker; #FirecrackerValue: (#Firecracker | #DeployValue).
  3. schema/firecracker_client.cue — the host↔plugin internal wire family.
  4. schema/substrate_template.cue + schema/resolvedproject.cue — the resolve-to-envelope form and the template map arm.
  5. schema/deploy.cue — firecracker_state + #FirecrackerDeployState.
  6. schema/firecracker_test.go — the same gates kubevirt has: the derived KindValueDefs entry, ResourceKinds membership, a realistic template accepted through the value gate, and an unknown key rejected.
  7. Regenerate with charly task cue-gen (a clean second run must be a no-op).

Venue decision, stated here because it is the load-bearing one: a Firecracker microVM is reached over SSH, so it reuses venue: "ssh" and adds no new venue value. It must therefore omit exclusive_venue — otherwise the libvirt arm of IsVmVenue (ssh ∧ exclusive) would misroute it into charly vm build/vm create, which is exactly the bug fe624e5 fixed for kubevirt.

Two residue gaps fixed in passing

While touching these enums, two kubevirt leftovers get closed, each proven by a claim-keyed grep in the PR:

  • schema/deploy.cue's closed target?: enum still lists six words (kubevirt was never added).
  • schema/status.cue's #SubstrateKind still lists six while the hand-written Go const in spec/status_types.go already has SubstrateKubevirt.

Not in this issue

  • The image/kernel artefact contract (a #VmBoxSource/#VmBoxMetadata arm for a raw rootfs + a separate kernel) — that is its own cutover.
  • The plugin, the host-install layer and the beds — they follow, producer-first, in their own repos.

Assisted-by: DSH deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Oct 14, 2026

    @aitrawog
    ContributorAuthor

    CLAIM — I am taking #226.

    Plan, in the order I will do it: the #Firecracker def and its nested blocks, the #FirecrackerValue gate + #ResourceKind membership, the client wire family, the resolve-to-envelope form and the template map arm, firecracker_state, the four gates in firecracker_test.go, then charly task cue-gen (a second run must be a no-op) and GOWORK=off go test ./... / go build ./....

    The venue decision is the load-bearing one and is stated in the issue: a Firecracker microVM is reached over SSH, so it reuses venue: "ssh" and adds no venue value, and it must omit exclusive_venue — otherwise IsVmVenue (ssh ∧ exclusive) would misroute it into charly vm build/vm create, the exact bug fe624e5 fixed for kubevirt.

    Also closed in passing, each proven by a claim-keyed grep in the PR body: the target?: enum in schema/deploy.cue and #SubstrateKind in schema/status.cue, neither of which was extended when kubevirt was added.

    Evidence for the whole integration — including the live microVM boot, the network, and the fireactions guest contract — is in the umbrella ledger at .dsh/ledger/firecracker-fireactions-integration.md.

    Agent: dsh-firecracker (DSH / deepseek-v4.1-flash)

    Assisted-by: DSH deepseek-v4.1-flash (analysed on a live system)

  2. self-assigned this
    on Oct 14, 2026
  3. aitrawog commented on Oct 14, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the contract is implemented and the PR is open: opencharly/spec#227, head 4a02503, branch feat/firecracker-substrate-contract (off fresh main ad8ccff).

    Done in this PR: the closed #Firecracker def (host surface + per-instance surface), the #FirecrackerValue gate and #ResourceKind membership, the host↔plugin wire family, the resolve-to-envelope form + template-map arm, firecracker_state on #Deploy and #DeployState, and the substrate discriminator on both the CUE and the hand-written Go side. Seven gates, three of them controlled by removing their own schema line; cue-gen reproducible, 24 packages ok, lint 0 issues.

    The two residue gaps named in the issue are fixed here, and the grep that proves them is pasted in the PR body with an exact anchor — grep -m1 'target?: (', because a bare target?: also matches bed_target?: and misreports the count.

    Two authoring-side anomalies, root-caused and fixed before the commit rather than left in the history:

    1. My first snapshotter test asserted on CUE's disjunction prose ("the rejection must name the offending field") — a claim about an error message, which the tool does not contract to. Replaced with the behaviour that matters: both legal values (devmapper, blockfile) accepted AND both unusable ones (overlayfs, native) refused.
    2. A control script of mine restored a file with git checkout -- <file>, which discards uncommitted edits and silently reverted three schema files mid-round. Recovered in full and re-verified (grep + full suite + regen) before the commit, and the control method is now snapshot-and-restore instead of git-checkout-to-HEAD. Control: commit before running any mutation control.

    One ledger correction this work produced, per R1: the ledger listed a version.cue bump for this work item, but the repo's own AGENTS.md states the #SchemaVersion stamp, the charly.yml version: field and the equality gate were deleted (CHANGELOG/0.2026270.938.md) — there is nothing to bump, and the ledger line is being corrected rather than followed.

    Next: watch #227 for the validator verdict and fix or rebut every finding before the next push; then, producer-first, the consumer pin bump and the plugin leg. Next update: on the verdict.

    Agent: dsh-firecracker (DSH / deepseek-v4.1-flash)

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

  4. aitrawog commented on Oct 14, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — by opencharly/spec#227, merged as ada497a and tagged v0.2026287.1134 (tag-on-merge wrote CHANGELOG/0.2026287.1134.md from the PR body).

    What landed: the closed #Firecracker def (host surface + per-instance surface), #FirecrackerValue and the #ResourceKind membership, the host↔plugin wire family, the resolve-to-envelope form and the template-map arm, firecracker_state on #Deploy and #DeployState, and the substrate discriminator on both the CUE and the hand-written Go side — plus the two residue gaps this issue named (target?: and #SubstrateKind, which had drifted from the Go consts), each with a gate that fails without it.

    Nine gates, every acceptance gate asserting completeness; charly task cue-gen reproducible; 24 packages ok; lint 0 issues. Two review rounds: the first found the def's header contradicting the def (image required while the comment permitted a host-only template), and controlling that fix exposed a defect in my own acceptance gates — plain Validate() accepts a missing required field as incomplete, so those gates could not fail. Both are fixed, with the measured controls in the PR.

    The consumer leg is not in this PR and is the next step: the umbrella pins spec through a gitlink (Policy B), so charly task sync + a pin-bump PR takes v0.2026287.1134, after which the plugin legs (WI-3 sdk, WI-4 plugin-substrate, WI-5 plugin-firecracker) can be built against it.

    Agent: dsh-firecracker (DSH / deepseek-v4.1-flash)

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

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions