Repository navigation
feat(deploykit): VM box image emitter + reader — EmitVmBox / VmCapabilitiesFromLabels - #202
Merged
Merged
Conversation
…litiesFromLabels Task 2 (sdk half) of the VM-box cutover: a VM box is an OCI image whose labels carry the VM metadata contract (spec.VmBoxMetadata, whole-struct JSON on ai.opencharly.vm.box) and whose layer carries the disk artifact. - bump github.com/opencharly/spec to v0.2026246.554 (the tag-on-merge tag of spec PR #90, which landed VmBoxMetadata/VmBoxSource/LabelVmBox/VmBoxLabelMap) - EmitVmBox: scratch Containerfile (COPY disk /disk.qcow2 + vm.box/version/ description labels) via podman build into local storage - VmCapabilitiesFromLabels: engine inspect -> ai.opencharly.vm.box -> unmarshal - tests: label round-trip, spec completeness gate, live podman emit/read-back
Review — PASSHead SHA: Security screen: PASS — no embedded instructions, no scope mismatch (all 4 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, spec dependency bump is a legitimate tag-on-merge pin for the new functionality. Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
…egs) (#358) * chore(deps): adopt spec v0.2026280.2244 (the sdk#315 and sdk#253 consumer legs) Bumps `require github.com/opencharly/spec` v0.2026276.0 -> v0.2026280.2244 via `go get` + `go mod tidy` (the toolchain, never a hand-pin) and adapts the two consumer surfaces the adopted range changes: 1. spec#208 removed `spec.LocalPkgInstallStep.Version` (with its view round-trip) after #354 deleted the field's only writer. The dead-vestige guard added in that PR asserted the field was EMPTY, which no longer typechecks; it now asserts STRUCTURALLY that the type has no `Version` field at all — a reinstated assignment is a compile error, and the reflection check keeps the vestige from creeping back as a field without a writer. 2. spec#202 made a ref's identity its PROJECT identity, not the enclosing repository (the fix for the false import back-edge sdk#253 measured as three namespace failures). `loaderkit.RepoIdentity` is a plain alias of `spec.RepoIdentity`, so the stale expectation in `TestRepoIdentity` is updated to the project identity and the reason is recorded at the assertion: stripping `@github.com/o/r/candy/x:v1.2.3` to `github.com/o/r` is the PRE-#202 behaviour. This closes the residual the sdk#253 dossier named — "sdk's own go.mod still pins spec v0.2026276.0 (a pin bump, not the defect)" — in the same range. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * docs(deploykit): reconcile one retirement's provenance to what is retained The validator's R1/R5 finding is correct and the divergence was introduced by this hunk: one event — "the field lost its only writer" — was attributed three ways (sdk#315 in the new comment, sdk#313 in the new error string directly beneath it, and sdk#354 in the PR body), and the guard-adding PR was attributed to #354. Measured, rather than picked from the three: - #315 does NOT resolve as a pull request; it is the ISSUE, now CLOSED: "deploykit: install_build.go still assigns the now-unpopulated EffectiveVersion (dead after sdk#313)". - the assertion this change replaces — the retained evidence, itself tagged sdk#315 — said the box's EffectiveVersion "lost its only writer in sdk#313". - opencharly/spec#208 is the spec-side PR of that retirement (the field and its view round-trip), which is what this change adapts to. - #354 is a loaderkit fix ("the candy-manifest fallback runs the one desugar step (#323, #315)"), not the field's retirement, so naming it as the writer's deleter or the guard's author was false. The comment and the error string now both say the same thing: the writer was already lost in sdk#313; the retirement is tracked by ISSUE sdk#315 and landed on the spec side as spec#208. No PR number is invented for the guard: the commit that added it could not be measured from this checkout (`git log -S` on its text finds nothing here), so the text names the issue instead of guessing a number. Refs #315, opencharly/spec#208 Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Task 2 (sdk half) of the VM-box cutover (plan/vm-from-box-layering.md §2.1: "a VM box is an OCI image whose labels carry the VM metadata contract and whose layers carry the disk artifact"). The spec half (spec PR #90, MERGED) landed
spec.VmBoxMetadata+VmBoxSource+LabelVmBox = "ai.opencharly.vm.box"+ theVmBoxLabelMapcompleteness gate; this PR lands the sdk emitter/reader that bakes and reads that contract on real box images.Changes (4 files, +275):
go.mod/go.sum— bumpgithub.com/opencharly/specv0.2026243.707→v0.2026246.554(the tag-on-merge tag of spec PR fix(spec): CUE-convert the arbiter wire types + remove the qemu-shutdown-only state_dir field #90's merge commit; carries VmBoxMetadata + LabelVmBox + VmBoxLabelMap).go mod tidyclean.deploykit/vm_box_emit.go(new) — the VM box image emitter + reader:EmitVmBox(engine, ref, meta, diskPath): stages a temp Containerfile (FROM scratch,COPY <disk> /disk.qcow2,LABEL ai.opencharly.vm.box=<whole-struct JSON>+ai.opencharly.version=<meta.Version>+ai.opencharly.description=<JSON>), runspodman build -t <ref>with the disk's own directory as the build context (the disk is never copied), removes the temp Containerfile. The disk COPY is the layer; the labels are the contract. Engine binary viacontainer.EngineBinary; label values quoted withspec/shellquote.ShellQuoteexactly like the pod-side WriteLabels emitter.VmCapabilitiesFromLabels(engine, ref):container.InspectLabels(the same inspect seamCapabilitiesFromLabels→ExtractMetadatauses) → readsai.opencharly.vm.box→ unmarshal into*spec.VmBoxMetadata. Mirrors theErrImageNotLocalwrap when the image is absent locally.deploykit/vm_box_emit_test.go(new):TestVmBoxMetadataLabelRoundTrip— marshal a populated VmBoxMetadata → unmarshal → DeepEqual (the label contract round-trips through the sdk's pinned spec).TestVmBoxLabelCompleteness—spec.CheckVmBoxLabelCompleteness()nil (every field covered by the label map).TestVmBoxEmitReadBackRoundTrip— LIVE integration test (podman IS available on this host): emits a 1-byte fixture "disk" with a fully-populated metadata contract into local podman storage, reads it back, asserts DeepEqual equality, and asserts the image has exactly ONE layer (the disk COPY). Skips witht.Skipwhen podman is absent.How tested
go build ./...— exit 0 (no output).gofmt -l .— empty.go test ./...— all packages ok:New tests, verbosely (from the committed tree, R10):
Podman availability finding:
podman version 6.1.0IS present on this host (/usr/bin/podman, rootless store/home/atrawog/.local/share/containers/storage), so the integration test ran LIVE — a scratch image with the fixture disk layer + labels was actually built in local podman storage and inspected back.golangci-lint run ./deploykit/: zero findings on the new files (the 2 remaining repo findings are pre-existing ininit.gogocyclo andoci_target_user_reset_test.gostaticcheck — untouched files).Rulebook compliance
container.InspectLabels/LocalImageExistsinspect seam (the same onedeploykit.ExtractMetadatare-exports); the completeness gate is imported from spec (CheckVmBoxLabelCompleteness), not re-implemented; label quoting reusesspec/shellquote.ShellQuote. No second inspect implementation.git show --statconfirms exactly the 4 intended files.go build ./...+go test ./...+gofmt -l .all green FROM THE COMMITTED TREE (re-run aftergit commit, output above), including the live podman integration test.Change classification
Assisted-by: pi ollama-cloud/deepseek-v4-flash:0731 (fully tested and validated)