Repository navigation
feat(schema): W3.1 selection surfaces — deploy rootful, containerd namespace, VM-backend vocabulary - #275
Conversation
…d namespace, VM-backend vocabulary W3.1's one precedence rule (flag > deploy entity > env > settings file > built-in default) had no schema-owned source at two of its levels, and the VM-backend vocabulary had no generated Go accessor, so a resolver would have had to carry word literals. This is the producer leg that supplies them. - `#RootfulMode` — the CLOSED rootful-launch vocabulary (auto | machine | sudo | native) shared by `engine.rootful`, `CHARLY_ENGINE_ROOTFUL` and the new per-deploy `rootful:`; cue-gen emits it as spec.RootfulModes. - `#Deploy.rootful` — the per-deploy level, admitted as a deploy selector (`#DeployTraits.selectors` gains "rootful") so the loader can reject it on a substrate that does not declare it, without a substrate-name switch. - `#VmBackendName` — the VM-backend PROVIDER words (libvirt | qemu | krun); `#VmBackend` keeps `auto` as its resolution default. cue-gen emits spec.VmBackends, so `--backend` / `CHARLY_VM_BACKEND` / `vm.backend` are validated against the schema, never a literal. - `hostenv.ContainerdConfig.Namespace` + `RuntimeConfig.Containerd` + `ResolvedRuntime.Namespace` — the settings-file level, resolved as settings > the engine capability's `namespace` fact (containerd: "default"); no env mirror, per the plan's table. The generated files are the `charly task cue-gen` output; a second run is a no-op (spec.TestGenReproducible). The new schema tests fail on the pre-change tree (field not allowed / def missing / selector rejected) and the namespace tests fail to compile there (no ResolvedRuntime.Namespace). Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
Review — PASSI reviewed all 9 changed files against the PR body and re-derived every claim. The change is a coherent, additive contract-producer leg with matching tests and generated artifacts. Correctness
TestsThe new tests are substantive and would fail without the change:
The body's fail-without evidence is internally consistent: the quoted build error Security & scopeNo secrets, no injection surface (the namespace is an inert string from settings), no new dependencies, and no consumer repos touched — consistent with the stated scope boundary. CommentsThere are zero comments in the thread, so nothing to disposition. No maintainer sign-off is present, and none is required for the change to stand on its own evidence, which it does. Minor (non-blocking) observations
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ontainerd target (#457) * feat(deploykit): the W3.1 selection resolvers — engine, VM backend, containerd 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) * fix(deploykit): delete the dead precedence-level machinery and the unreachable 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) --------- Co-authored-by: Andreas Trawoeger <[email protected]>
Summary
The producer leg for W3.1's selection model. The plan's one precedence rule — flag > deploy entity > env > settings file > built-in default — had no schema-owned source at two of its levels, and the VM-backend vocabulary had no generated Go accessor, so a resolver would have had to carry word literals. This change supplies all three surfaces in the contract module, CUE first:
#RootfulMode+#Deploy.rootful(schema/engine.cue,schema/deploy.cue) — the CLOSED rootful-launch vocabularyauto | machine | sudo | native, already the setplugin-settingsaccepts forengine.rootful, now also the per-deploy selector.#DeployTraits.selectorsgains"rootful", so the loader can reject it on a substrate that does not declare it without switching on a substrate name.#VmBackendName+#VmBackend(schema/vm.cue) — the provider wordslibvirt | qemu | krunare now their own def;#VmBackendkeepsautoas the resolution default.schemagenemitsspec.VmBackendsandspec.RootfulModes, so--backend/CHARLY_VM_BACKEND/vm.backendand--rootful/CHARLY_ENGINE_ROOTFUL/engine.rootfulare validated against the schema, never a literal.containerd.namespace(hostenv/runtime_config.go) —ContainerdConfig.Namespace,RuntimeConfig.Containerd, andResolvedRuntime.Namespace, resolved as settings > the engine capability'snamespacefact (containerd:"default"). No env mirror, matching the plan's table (containerd.namespace| — |namespace:|--namespace).Generated artifacts (
spec/cue_types_gen.go,spec/vocab_gen.go) are thecharly task cue-genoutput, committed; a second run is byte-identical (hashes below).Scope boundary: this is the producer. The
sdkresolvers (ResolvePodEngine,ResolveVmBackend,ResolveContainerdTarget) are the next leg and will bump to this merge's tag; theplugin-substratepod traits must declare"rootful"in a consumer leg before the loader admits a per-deployrootful:on a pod;plugin-settingsgains thecontainerd.namespacekey as a consumer leg. No consumer repo is touched here.How tested
Every command below ran on the committed tree.
charly task cue-gentwice is a no-op. Both runs exited 0 and each run's owncheck: regen is reproducible — TestGenReproduciblestep passed. The generated files' hashes are identical across the two runs:charly box validate: rc 0 —OK — checked 1 candy, 7 distros, 7 builders; 0 warnings, 0 errors.Coverage fails without the change. The new tests were copied onto a throwaway worktree at
origin/main(3099d05) and run there:All pass on this head. The namespace tests pin all three arms: the settings value wins; the capability default applies when unset; a plausible env var (
CHARLY_CONTAINERD_NAMESPACE) is ignored, so no accidental env level.Two environment notes, both RCA'd, neither a code finding:
1.27.3(export-data format 5), which the pinnedgolangci-lintv2.13.2 cannot typecheck (export data version 5 is greater than maximum supported version 4). CI usessetup-gofromgo.mod(go 1.26.0); running lint locally with thego1.26.0toolchain gives0 issues. The initial failure was a toolchain mismatch that died before analysis — it never produced a finding.schema/*.cueis notcue fmt-clean on pristineorigin/main(every file listed). The W3.1-added constructs are absent fromcue fmt --diffafter alignment; the pre-existing drift is filed asopencharly/spec#274rather than riding this contract change.Rulebook compliance
/charly-internals:go,plugin,git-workflow,strict-policy,root-cause-analyzer,go-quality,cutover-policy, plus this repo'sAGENTS.md.cue fmtdrift are the only anomalies; each has an RCA above, and the drift is filed (#274). No warnings survive the gate.#RootfulModeand#VmBackendNameare CUE defs, their Go lists are generated; no hand-written parallel list.go.modtoolchain reproduces CI; no linter was installed manually (~/go/binwas already present), no suppression added.#VmBackend's word set is unchanged semantically (auto | libvirt | qemu | krun)..worktrees/w31/specoff freshorigin/main;git statusclean before and after; one commit; no submodule checkout edited.origin/mainand green here; the namespace resolution runs live inhostenvtests.specis a Go module, no binary; no new runtime OS dependency.disposablebed (AGENTS.md: the merge gate is the org-widecharly/pr-validator, and.github/workflows/ci.ymlis the module's gate). The CI gate ran on the committed tree, andcharly box validateis 0 warnings / 0 errors.cue_types_gen.go,vocab_gen.go);cue-gentwice is a no-op.Change classification
Additive contract producer (
spec): three new surfaces plus their generated artifacts. No authored key is removed or reshaped, so no migration entry is owed;#VmBackendkeeps its meaning and default. Downstream order: this merge → tag →sdkbumps itsrequire github.com/opencharly/specand lands W3.1 → consumer legs (plugin-substrateselector declaration,plugin-settingscontainerd.namespace,plugin-deploy-pod/plugin-podresolver adoption).Filed issues
opencharly/spec#274—schema/*.cueis notcue fmt-clean on pristinemain; pre-existing, non-blocking, fix is one formatting commit plus a CI step.Closes #273
Agent:
containerd-crabbox-program/w31· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)