Repository navigation
feat(deploykit): generic BoxRef resolver — ParseBoxRef / ResolveBoxRef (VM-box cutover task 4) - #203
Conversation
…f over all four VM source forms
Review — BLOCKHead SHA: Change class: additive code change — new generic resolver + tests in Security screen: PASS — no embedded directives, no scope mismatch (diff matches the body's accounting exactly), no secrets/exfiltration, no weakened guardrails, no new deps, no self-modifying security changes. Blocks
Everything else checks out: attribution footer is in the correct Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no embedded directives, no scope mismatch (diff = 2 new files, body accounts for both), no secrets/exfiltration, no weakened guardrails, no new deps, no self-modifying security changes. Checklist: All applicable rules PASS or NA. The prior Verified against the current diff/body: additive resolver + tests in Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
VM-box cutover task 4 (plan/vm-from-box-layering.md §2.2): the generic BoxRef resolver — ONE resolver over every VM source form, so no caller re-implements per-kind resolution (R3). The source arms keep their schema shape; this is the generic engine underneath them.
Adds
sdk/deploykit/box_ref.go:ParseBoxRef(ref)parses the four formsbox:<candy-image>,vm:<entity>[@<snapshot>],image:<registry-ref>,imported:<domain>; a bare name defaults to thebox:(container-image) form, matching howsource.box:behaves today. Empty / empty-payload forms error.ResolveBoxRef(ctx, ex, ref) → *ResolvedBoxRefdispatches on the parsed form onto the arms' EXISTING primitives:box:→ SourceKindbootc— a full ref (contains/) passes through untouched (bootc may pull from a registry); a short name resolves viakit.ResolveLocalImageRefto its newest local CalVer tag — exact mirror of plugin-vm'sresolveBootcImageRef(candy/plugin-vm/vm_build_resolve.go).vm:@snap→ SourceKindclone— the snapshot's external disk path viavmshared.LookupSnapshot(the same registry BuildClone's parent-disk pick reads); an internal-mode snapshot (no external disk) is refused.image:→ SourceKindcloud_image— URL passthrough (fetch/verify happens at build time).imported:→ SourceKindimported— domain passthrough (the entity's disk_path is resolved at build time).ResolvedBoxRefcarries the plan §2.2ResolvedBox{diskSource, metadata}contract fieldsSourceKind/DiskSource/Metadata. NAMEDResolvedBoxRef(notResolvedBox) deliberately: package deploykit already declarestype ResolvedBox = buildkit.ResolvedBox(buildkit_aliases.go, used by 49 files) for the pod/box BUILD-graph result — a different domain that cannot share the name in one package (R1 finding during implementation, documented in the file header).Tests (
deploykit/box_ref_test.go): parse table over all forms + malformed inputs; pure resolve arms (image:/imported:/full-ref box:); deterministic short-name CalVer election via the spec/container var swap plugin-vm's own tests use; a live short-name arm against real local container storage (skips when no engine/images); and the vm:@snapshot arm against a minimal snapshot registry under a tempCHARLY_VM_STATE_DIR(external resolves, unknown errors, internal refused).How tested
All commands ran on the final committed tree (branch
feat/boxref-resolver, commit ad4e9ae) inside the sdk module.Full suite green across all 10 packages; changed paths executed live (real podman storage short-name resolution, temp snapshot registry).
Rulebook compliance
ResolvedBoxcollides with the existingbuildkit.ResolvedBoxalias in package deploykit (used by 49 files). RCA: the alias is the pod/box BUILD-graph result — a different domain; renaming it would be a 49-file scope explosion. Resolution: result type namedResolvedBoxRefwith the identical field contract, rationale documented in the file header. No runtime anomalies encountered.kit.ResolveLocalImageRef,vmshared.LookupSnapshot, passthroughs). No resolution logic duplicated or re-implemented; no second snapshot lookup path.go build ./...+go test ./...+gofmt -l .all green on the final committed tree (output pasted above).Change classification
go build ./...,go test ./...,gofmt -l .on the sdk module (all passed, output above).Assisted-by: pi ollama-cloud/deepseek-v4-flash:0731 (fully tested and validated)