Skip to content

feat(deploykit): generic BoxRef resolver — ParseBoxRef / ResolveBoxRef (VM-box cutover task 4) - #203

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/boxref-resolver
Sep 3, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/boxref-resolver

Conversation

@atrawog

@atrawog atrawog commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

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 forms box:<candy-image>, vm:<entity>[@<snapshot>], image:<registry-ref>, imported:<domain>; a bare name defaults to the box: (container-image) form, matching how source.box: behaves today. Empty / empty-payload forms error.
  • ResolveBoxRef(ctx, ex, ref) → *ResolvedBoxRef dispatches on the parsed form onto the arms' EXISTING primitives:
    • box: → SourceKind bootc — a full ref (contains /) passes through untouched (bootc may pull from a registry); a short name resolves via kit.ResolveLocalImageRef to its newest local CalVer tag — exact mirror of plugin-vm's resolveBootcImageRef (candy/plugin-vm/vm_build_resolve.go).
    • vm:@snap → SourceKind clone — the snapshot's external disk path via vmshared.LookupSnapshot (the same registry BuildClone's parent-disk pick reads); an internal-mode snapshot (no external disk) is refused.
    • image: → SourceKind cloud_image — URL passthrough (fetch/verify happens at build time).
    • imported: → SourceKind imported — domain passthrough (the entity's disk_path is resolved at build time).
    • Metadata stays nil on every arm (best-effort field; the distro-from-box read is a later cutover).
  • ResolvedBoxRef carries the plan §2.2 ResolvedBox{diskSource, metadata} contract fields SourceKind/DiskSource/Metadata. NAMED ResolvedBoxRef (not ResolvedBox) deliberately: package deploykit already declares type 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 temp CHARLY_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.

$ go build ./...
GOFMT_OK
BUILD_DONE
$ gofmt -l .
(empty — exit 0)
$ go test ./deploykit/ -run 'TestParseBoxRef|TestResolveBoxRef' -v
--- PASS: TestParseBoxRef (0.00s)
    --- PASS: TestParseBoxRef/box_form (0.00s)
    ... (16 subtests: all forms + all malformed cases)
--- PASS: TestResolveBoxRef_PureArms (0.00s)
    --- PASS: TestResolveBoxRef_PureArms/image_form_passes_the_url_through (0.00s)
    --- PASS: TestResolveBoxRef_PureArms/imported_form_passes_the_domain_through (0.00s)
    --- PASS: TestResolveBoxRef_PureArms/full_box_ref_passes_through_prefixed (0.00s)
    --- PASS: TestResolveBoxRef_PureArms/full_box_ref_passes_through_bare (0.00s)
    --- PASS: TestResolveBoxRef_PureArms/vm_form_without_snapshot_errors (0.00s)
--- PASS: TestResolveBoxRef_BoxShortNameCalVer (0.00s)
--- PASS: TestResolveBoxRef_BoxShortName (2.11s)   # live podman storage, 185 local images
--- PASS: TestResolveBoxRef_VmSnapshot (0.00s)
    --- PASS: TestResolveBoxRef_VmSnapshot/external_snapshot_resolves_to_its_disk_path (0.00s)
    --- PASS: TestResolveBoxRef_VmSnapshot/unknown_snapshot_errors (0.00s)
    --- PASS: TestResolveBoxRef_VmSnapshot/internal_snapshot_without_disk_path_is_refused (0.00s)
PASS
ok  github.com/opencharly/sdk/deploykit  2.113s
$ go test ./...
ok  github.com/opencharly/sdk            0.060s
ok  github.com/opencharly/sdk/agentkit   0.726s
ok  github.com/opencharly/sdk/buildkit   0.005s
ok  github.com/opencharly/sdk/candywalk  0.002s
ok  github.com/opencharly/sdk/deploykit  1.993s
ok  github.com/opencharly/sdk/enginekit  0.004s
ok  github.com/opencharly/sdk/kit        0.582s
ok  github.com/opencharly/sdk/loaderkit  0.015s
ok  github.com/opencharly/sdk/packagekit 0.010s
ok  github.com/opencharly/sdk/vmshared   0.112s

Full suite green across all 10 packages; changed paths executed live (real podman storage short-name resolution, temp snapshot registry).

Rulebook compliance

Rule HOW / N/A
R0 (skills honored) The deploykit owning skill (/charly-internals:install-plan + /charly-internals:capabilities) was read before implementation; the resolver mirrors the CapabilitiesFromLabels label-contract pattern and the BuildDeployPlan IR conventions.
R1 (RCA every anomaly) One finding during implementation: the task's provisional type name ResolvedBox collides with the existing buildkit.ResolvedBox alias 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 named ResolvedBoxRef with the identical field contract, rationale documented in the file header. No runtime anomalies encountered.
R2 (no pre-existing / out-of-scope split) N/A — the type-name finding was resolved in-tree (same PR, same working tree); no issue was deferred to an unnamed follow-up. The consumer refactor (arms onto the resolver) is the cutover's own later wiring tasks, named in plan/vm-from-box-layering.md.
R3 (one canonical implementation) This IS the dedup: one resolver dispatches onto the arms' existing primitives (kit.ResolveLocalImageRef, vmshared.LookupSnapshot, passthroughs). No resolution logic duplicated or re-implemented; no second snapshot lookup path.
R4 (no workarounds) N/A — no sleeps/retries/CI manipulation/hand-pins; the one deviation (type name) is a documented naming resolution, not a workaround.
R5 (delete legacy) N/A — purely additive (2 new files, 0 modified). Refactoring the arms ONTO the resolver is the later wiring tasks of the cutover, not this task.
R6 (git safety) feat/ branch cut from origin/main, pushed; no force-push, no direct main push; landing via PR only.
R7 (prove the gate) go build ./... + go test ./... + gofmt -l . all green on the final committed tree (output pasted above).
R8 (deployed binary matches source) N/A — sdk is a library module consumed at pinned go.mod requires; no deployed binary ships this change.
R9 (runtime deps in packaging) N/A — no new runtime OS dependencies; the resolver uses existing kit/vmshared primitives.
R10 (fresh disposable proof) The changed runtime paths executed live against real podman storage (short-name resolution) and a temp snapshot registry (vm:@snap arm) on the final committed tree; full module suite green (pasted above).

Change classification

  • Change class: additive — new generic resolver + tests in sdk/deploykit; no consumer wiring, no schema change, no behavior change to existing arms.
  • Verification gate: go build ./..., go test ./..., gofmt -l . on the sdk module (all passed, output above).
  • Attribution tier: fully tested and validated — full module test suite passed on the final committed tree and the changed runtime paths executed live.

Assisted-by: pi ollama-cloud/deepseek-v4-flash:0731 (fully tested and validated)

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: ad4e9ae7293573ce1eaf3fcc061f7df7dbb746a7 (branch: feat/boxref-resolver)

Change class: additive code change — new generic resolver + tests in sdk/deploykit (2 new files, 0 modified).

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

  1. A1 — incomplete rulebook-compliance section. The body's compliance table answers only R1, R3, R4, R5, R6, R7. It leaves applicable rules unanswered:

    • R0 (skills honored) — this change touches deploykit; the owning skill's procedures are never addressed.
    • R2 (no pre-existing / out-of-scope split) — never addressed (the R1 type-name finding was resolved in-tree, but R2 itself is not answered).
    • R8 / R9 / R10 — not even stated as N/A — <reason>.

    Per A1, every applicable rule must be answered with a one-line HOW or an explicit N/A — <reason>. Add the missing rows to the compliance table (R0, R2, and R8/R9/R10 with explicit N/A reasons where the change class excludes them).

Everything else checks out: attribution footer is in the correct *Assisted-by: …* form and the "fully tested and validated" tier is justified (new code paths executed live against real podman storage and a temp snapshot registry); the gate (go build/go test/gofmt) matches the change class; tests are comprehensive and would fail without the implementation; placement is CORRECT (generic mechanism in deploykit, no alias growth, no Legacy identifiers, no core/sdk layer violations); no concurrency, RDD/ADE/SDD, or disposable-only concerns apply.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 84a68c0cfba0 (branch: feat/boxref-resolver)

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 github-actions[bot] BLOCK (A1 — incomplete rulebook-compliance table) is stale-superseded: the current body now answers every previously-missing row — R0 (skills honored), R2 (N/A with reason), R8 (N/A — library module), R9 (N/A — no new runtime deps), R10 (live proof) — each with a one-line HOW or explicit N/A reason. The second commit (84a68c0) is docs-only (PR body), not a code change; the diff is unchanged from the tested tree.

Verified against the current diff/body: additive resolver + tests in deploykit; gate (go build/go test/gofmt) matches the change class with pasted output; changed runtime paths executed live (real podman storage short-name resolution, temp snapshot registry); tests are comprehensive and would fail without the implementation; attribution footer in correct *Assisted-by: …* form with the "fully tested and validated" tier justified; placement CORRECT (generic mechanism in deploykit, no alias growth, no Legacy identifiers, no core/sdk layer violations); R1 RCA documented (type-name collision resolved in-tree); no concurrency/RDD/ADE/SDD/disposable concerns apply.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 3, 2026 06:40
@github-actions
github-actions Bot merged commit 18be1a8 into main Sep 3, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 3, 2026
@aitrawog
aitrawog deleted the feat/boxref-resolver branch September 25, 2026 19:07
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.

1 participant