Repository navigation
feat(deploykit): the W3.1 selection resolvers — engine, VM backend, containerd target - #457
Conversation
…ontainerd target
W3.1 replaces the divergent per-consumer selection paths with three canonical
resolvers over ONE precedence rule:
flag > deploy entity > env > settings file > built-in default
- ResolvePodEngine(flag, deploy, rt) — the engine word; `auto` detects (podman
then docker); a candy's engine: is a CONSTRAINT checked after resolution,
never an override.
- ResolveVmBackend(flag, deploy, rt) — the VM backend; `auto` detects in the
schema's own word order (libvirt then qemu), and krun is explicit-only.
- ResolveContainerdTarget(engine, deploy, rt) — {engine, rootful, address,
namespace, privilegePrefix}; rootful is capability-checked and `native`
applies no privilege prefix; namespace defaults to the capability fact.
The env > settings fold is hostenv.ResolveRuntime's, not a second copy; the
tests drive it end-to-end. Vocabularies are schema-owned (spec.EngineNames,
spec.VmBackends, spec.RootfulModes), and the spec pin advances to
v0.2026296.1036 (opencharly/spec#275), which added the deploy rootful selector,
the containerd namespace setting and the VM-backend vocabulary.
Tests: per-level precedence tables for all three resolvers, env-over-settings
and settings-over-default through ResolveRuntime, the candy constraint, the
capability refusals, a probe-vocabulary drift guard, and a mutant that swaps
every adjacent precedence pair plus a production mutation (flag/deploy
reversed) that fails the table.
Consumer migration (filed, not touched): opencharly/opencharly#589.
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
Review — BLOCKThe functional core is sound and well-evidenced. I re-derived the body's claims against the diff: the three resolver signatures match, the precedence chains ( Two cleanliness defects remain, and one of them is directly traceable to the body's own R1 narrative ("the first iteration returned an unused precedence-level value … the return was removed"). The removal was incomplete. Blocks
Everything else (logic, precedence, tests, security posture, dependency bump) stands on its own; once the dead Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…reachable namespace guard Review round 1 found two dead-code defects in the new selection module. 1. `selectionSource.level` (with the whole `selectionLevel` type and its four constants) was written but never read. It was the remnant of the first iteration's `(value, level)` return, whose return the local `unparam` gate had made me delete. The tests permute the chain by INDEX, so nothing ever consulted the field. Removed entirely: the chain is now a positional `[]string` and `firstSet(values ...string)`; the mutation helper asserts the positional order directly, so no identity can drift from the order. 2. `ResolveContainerdTarget`'s `namespace == "" && capability.Namespace != ""` guard was unreachable: `containerdNamespaceSources` already appends `capability.Namespace` as its last source, so the default always arrives through the chain. Removed; the chain is the one mechanism that supplies it. Gate on this tree: gofmt clean, build/vet/test rc 0, `go test -race ./...` rc 0, golangci-lint 0 issues, four-arch cross-compile rc 0. The production mutation was re-proved on the simplified chain (flag/deploy swapped fails the precedence table; restored passes). Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
RCA — review round 1 BLOCKBoth findings were dead code, and both are fixed in the fix commit. 1. Write-only
|
Review — PASSI re-derived the current state from the body, the four diffs, the two commits, and both comments. Both round‑1 findings are genuinely gone from the current tree, and I found no new correctness, security, or scope defect that warrants a block. Verification of the change
Comment disposition
Non‑blocking observations (do not gate)
The change is coherent, complete, correctly implements the stated precedence with one fold owner, ships real failing‑without‑it coverage, and introduces no security or dependency risk. The round‑1 defects are verifiably fixed, so it stands on its own evidence. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Round 2 — PASS, merged and tagged
Disposition of the three non-blocking observations:
Agent: |
Summary
The W3.1 producer leg in
sdk: three canonical selection resolvers indeploykit, over ONE precedence rule.Precedence (every setting):
flag > deploy entity > env > settings file > built-in default. The env > settings fold ishostenv.ResolveRuntime's existing job — this change does not re-implement it; the runtime argument carries the folded value and the tests drive that fold end-to-end.ResolvePodEngine—autodetects (podman then docker). A candy'sengine:is a CONSTRAINT: a conflicting resolved engine is a validation error, never an override.ResolveVmBackend—autodetects in the schema's own word order (spec.VmBackends: libvirt then qemu); krun is explicit-only and has no probe. The probe table's keys are drift-tested againstspec.VmBackends.ResolveContainerdTarget—{engine, rootful, address, namespace, privilegePrefix}. Rootful is capability-checked (supports_rootful);nativeapplies no privilege prefix, every other concrete mode usesprivilege_prefix. Namespace isflag > deploy > settings > the capability's namespace fact(defaultfor containerd). Address comes from the capability row.spec.EngineNames,#EngineBinaries,#EngineCapability,spec.VmBackendsandspec.RootfulModesare the sources.Spec pin:
github.com/opencharly/specadvancesv0.2026295.2356 → v0.2026296.1036, the tag minted at merge ofopencharly/spec#275(a431987). That producer added the three surfaces W3.1 needs:#RootfulMode+#Deploy.rootful+ therootfulselector,#VmBackendName→spec.VmBackends, andContainerdConfig.Namespace/ResolvedRuntime.Namespace.Not touched: every consumer repo. The migration work list is filed on
opencharly/opencharly#589(see Change classification).How tested
The race suite and the non-race suite both ran on the committed tree;
golangci-lintran with thego.modtoolchain (go1.26.8) because the host's Go 1.27 export-data format is unreadable by the pinned lint binary — the same toolchain split measured on the producer PR, not a code finding.Coverage fails without the change — the mutants:
supports_rootful=falserefusal.TestSelectionPrecedenceMutantsReverseAdjacentPairsisolates each adjacent pair, swaps it, and requires the winner to flip — for the engine, the VM backend, rootful and the namespace.R1 findings, fixed (round 1): the first iteration returned an unused precedence-level value (
unparam); removing the return left the level field/type/constants behind as write-only code, and a defensive namespace guard was unreachable because the capability default is already a chain source. Round 1's BLOCK named both; the fix commit deletes the entire level concept (the chain is positional[]string) and the guard. The RCA is posted on this PR. The gate above re-ran on the fix commit to 0 issues.Rulebook compliance
/charly-internals:go,plugin,git-workflow,strict-policy,root-cause-analyzer,go-quality,cutover-policyand the sdkAGENTS.md.unparamfinding (RCA: a return value no caller used; root fix: delete the return, re-run the gate). Zero warnings on the final tree.hostenv.ResolveRuntime).origin/main(4acf500, behind 0);git statusclean before the commit; one squash landing onmain, plus the one appended fix commit for review round 1.sdkis a Go module, no binary; no runtime OS dependency added. The released spec tag was fetched and the module builds against it (verified withgo docon the pinned module:RootfulModes,VmBackends,Deploy.Rootful).disposablebed; its change-class gate is.github/workflows/ci.yml(gofmt, vet, lint, test, cross-compile), run in full on the committed tree. There is no R10 bed to run for a library producer; the consumer venue is the next leg.opencharly/spec#275first; this PR only consumes the released tag.main, plus the one appended fix commit for review round 1.Change classification
sdklibrary producer: three new exported resolvers plus the spec pin bump. Consumer-first order:spec#275merged and taggedv0.2026296.1036, then this PR. No authored config key changes here.Consumer legs (filed on
opencharly/opencharly#589, not touched):plugin-substrate— declareSelectorson the substrate traits (the map currently declares none): pod["engine", "rootful"], vm["backend"].plugin-settings— add thecontainerd.namespacekey (the settings file surface now exists inhostenv).plugin-fleet— persist--engine,--backend,--namespace,--rootfulonto the deploy entry.plugin-deploy-pod—resolve.go:47,60,95,158-161,178,181,212,313;config_setup.go:98,191,197,258,340,345,350,382,553;config_setup_helpers.go:524,526,586,600,704,708,724,762,789.plugin-pod—remove_orchestration.go:425;pod_cmd.go:323,366;service_resolve.go:66.sdk's own remaining legacy path (next sdk leg):deploykit/box_engine.go:22(ResolveBoxEngineForDeploy),container_resolve.go:36,53,pod_service.go:50,99,137,box_ref.go:203,206.Filed issues
opencharly/opencharly#589— the containerd-program consumer-leg tracker; the work list above was posted there with the producer tag, so each leg can pinv0.2026296.1036.Agent:
containerd-crabbox-program/w31· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)