Skip to content

feat(spec): engine provider class — single-homed resolution + a servable class (v3) - #144

Merged
github-actions[bot] merged 42 commits into
mainfrom
fix/nerdctl-engine-class-v3
Sep 22, 2026
Merged

github-actions[bot] merged 42 commits into
mainfrom
fix/nerdctl-engine-class-v3

Conversation

@aitrawog

@aitrawog aitrawog commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Land the engine provider class in spec — the container-engine contract that makes the engine a provider (podman/docker compiled-in, nerdctl out-of-process) instead of ~170 literal engine-string sites and ~30 switches. Fresh PR: the prior thread (#141) was auto-closed by the gate policy; this branch carries every fix.

Every changed file/behavior

The engine class + vocabulary: schema/engine.cue (new — #EngineName = podman|docker|nerdctl, #EngineRunMode = quadlet|systemd-unit|direct, #EngineUnitRunModes (the unit-supervised subset), #EngineCapability, five request/reply op-envelope pairs (#EngineBinary…/#EngineGPURunArgs…/#EngineStartPlan…/#EngineUnit…/#EngineNetworkEnsure…) plus the reply-only #EngineDescribeReply); schema/candy.cue ("engine" in #ProviderClassNames); schema/deploy.cue (engine: typed #EngineName); the generated spec/cue_types_gen.go / spec/vocab_gen.go (from internal/schemagen, which also gained the vocab-list emission); and the HAND-WRITTEN spec/engine_consts.go (the DefaultContainerEngine const + its doc).

The behavior (single-homed): container/engine.go — EngineCapabilityFor resolves ANY non-member word (empty OR unknown like bogus) to the ONE default engine, so EngineBinary/EngineRunModeFor/GPURunArgs/imageExistsProbeArgv all agree; EngineBinary/GPURunArgs are typed accessors of the class ops; container/local_image_coneb.go — read-side consumers behind the capability table; container/engine_ops.go (new) — InvokeEngineOp, the pure placement-agnostic servant; ops/ops.go — the OpEngine* selectors.

unit_emit contract aligned to its servant: the schema doc (schema/engine.cue + the generated copy) now states the op renders the non-quadlet systemd-unit form only; podman's .container/.pod quadlet is emitted by podman's OWN generator (a quadlet request returns no files).

nerdctl reaches the runtime config: hostenv/runtime_config.go — DetectRunMode returns the engine's CUE-owned mode (nerdctl → systemd-unit); ValidateEngine/ValidateRunMode accept nerdctl/systemd-unit; runModeMismatchWarning warns only on an explicit unit mode the engine cannot offer.

engine-as-data in exec (removes the per-engine jump enum arms): exec/deploy_executor_nested.go / deploy_chain.go / deploy_executor_process.go / venue_descriptor.go + spec/deploy_executor.go — JumpPodmanExec/JumpDockerExec replaced by NestedJump.Kind = JumpContainerExec + NestedJump.Engine; exec/venue_wait.go — WaitForContainerReady probes with the deploy's own engine from CHARLY_RUN_ENGINE (readinessEngine, fallback defaultContainerEngine), the producers named in the comment (candy/plugin-settings, the container-nesting layer); exec/builder_run.go — the shared defaultContainerEngine const.

The two blocks closed this round

  1. Unknown non-empty word now single-homed too. Previously EngineBinary("bogus") = podman (default) while GPURunArgs("bogus")/imageExistsProbeArgv("bogus") = docker/nerdctl's forms and EngineRunModeFor("bogus") = direct — the same split the "" fix closed, surviving for unknown words. EngineCapabilityFor now resolves any non-member word to the default engine; TestUnknownEngineResolutionIsSingleHome pins f(x) == f(EngineBinary(x)) for every consumer; the tests that codified the split are corrected (TestEngineCapabilityFor now asserts bogus resolves to the default; TestImageExistsProbeArgv/TestEngineRunModeFor/TestRunModeMismatchWarning agree).
  2. unit_emit doc and servant now agree on the decision input: the servant reads the REQUEST's run_mode (defaulting to the engine's capability mode when empty), so a run_mode=quadlet request to ANY provider — even nerdctl — returns no files (podman's quadlet generator owns that form). TestEngineUnitEmitHonorsRequestRunMode pins it.
  3. The two surviving stale doc comments are swept — EngineRunModeFor's doc now states an unknown non-empty word resolves to the default engine's mode (not a DirectRunMode() fallback, which is reached only for "auto" with no engine), and engineDescribe's doc states an unknown word resolves to the default engine's capability (the Error reply is only for "auto" with no engine). Both now agree with the code, the inline comments, and the tests.

How tested

$ go build ./...
exit 0

$ go test ./...            # the whole spec module, per-package
ok  	github.com/opencharly/spec/cache	(cached)
ok  	github.com/opencharly/spec/climodel	0.092s
ok  	github.com/opencharly/spec/container	3.799s
ok  	github.com/opencharly/spec/deploy	(cached)
ok  	github.com/opencharly/spec/exec	(cached)
ok  	github.com/opencharly/spec/exitcode	(cached)
ok  	github.com/opencharly/spec/hostenv	(cached)
ok  	github.com/opencharly/spec/internal/wiregen	(cached)
ok  	github.com/opencharly/spec/lock	(cached)
ok  	github.com/opencharly/spec/matchers	(cached)
ok  	github.com/opencharly/spec/merge	(cached)
ok  	github.com/opencharly/spec/ops	(cached)
ok  	github.com/opencharly/spec/phase	(cached)
ok  	github.com/opencharly/spec/poll	(cached)
ok  	github.com/opencharly/spec/proc	(cached)
ok  	github.com/opencharly/spec/refs	(cached)
ok  	github.com/opencharly/spec/schema	10.792s
ok  	github.com/opencharly/spec/spec	2.480s
ok  	github.com/opencharly/spec/transport	(cached)
?   	github.com/opencharly/spec/{calver,capability,checkhost,checkstep,clireflect,http,internal/schemagen,loader,proto,report,schemaconcat,shellquote,sshx,testkit}	[no test files]

$ go test ./container/ ./hostenv/ ./spec/ -run "TestUnknownEngineResolutionIsSingleHome|TestEmptyEngineResolutionIsSingleHome|TestImageExistsProbeArgv|TestEngineRunModeFor|TestGenReproducible" -v
--- PASS: TestUnknownEngineResolutionIsSingleHome (0.00s)
--- PASS: TestEmptyEngineResolutionIsSingleHome (0.00s)
--- PASS: TestEngineRunModeFor (0.00s)
--- PASS: TestImageExistsProbeArgv (0.00s)
ok  	github.com/opencharly/spec/container	0.033s
ok  	github.com/opencharly/spec/hostenv	0.017s
--- PASS: TestGenReproducible (2.20s)
ok  	github.com/opencharly/spec/spec	2.229s

# R5 removed-identifier sweep — EXECUTED, empty in the producer:
$ grep -rn "JumpPodmanExec\|JumpDockerExec\|isContainerJump" --include=*.go .
(empty; exit 1)

# B10 consumer liveness — RAW, against each consumer's origin/main:
$ git -C ../../sdk grep -n "JumpPodmanExec\|JumpDockerExec" origin/main -- '*.go'
origin/main:deploykit/kit_aliases.go:22:	JumpPodmanExec   = kit.JumpPodmanExec
origin/main:deploykit/kit_aliases.go:23:	JumpDockerExec   = kit.JumpDockerExec
origin/main:kit/exec_aliases.go:36:	JumpPodmanExec   = exec.JumpPodmanExec
origin/main:kit/exec_aliases.go:37:	JumpDockerExec   = exec.JumpDockerExec
origin/main:kit/infra_classify_test.go:93:		n := &NestedExecutor{Parent: p, Jump: NestedJump{Kind: JumpPodmanExec, Target: "charly-checkbox-1-1"}}
$ git -C ../../charly grep -n "JumpPodmanExec\|JumpDockerExec" origin/main -- '*.go'
origin/main:charly/deploy_add_cmd.go:44:		engineJump := specexec.JumpPodmanExec
origin/main:charly/deploy_add_cmd.go:46:			engineJump = specexec.JumpDockerExec

$ git rev-parse HEAD
c0ca253e743063279c0b49ab647ea4de953d82e3

The removed exported jump arms are the producer side of a cross-repo cutover: sdk's kit/exec_aliases.go + deploykit/kit_aliases.go re-export aliases and its NestedExecutor test migrate; charly's deploy_add_cmd.go migrates specexec.JumpPodmanExec → NestedJump.Engine. Those consumer legs land against this spec (producer→consumer order).

Rulebook compliance

  • R0 skills: /charly-internals:go + /charly-internals:plugin loaded.
  • R1 RCA: the "" fix left unknown words split; the unit_emit doc contradicted its servant. Both root-caused and fixed.
  • R2 complete: vocabulary, generated types, table, servant + selectors, accessor wiring, the exec engine-as-data cutover, and tests land together; provider/consumer legs named.
  • R3 no duplication: one capability table, one GPU-arg builder, one op servant; accessors route through it.
  • R4 no workaround: every non-member word resolves through the SAME capability path; the readiness probe uses the deploy's own engine.
  • R5: the sweep is executed (empty in the producer); consumer liveness pasted raw.
  • R6 (artifact/binary integrity): N/A — this change builds no artifact or binary, touches no packaging/OCI label, and performs no destructive action; it is spec-library Go + schema/doc.
  • R7 gate: go build ./... + full per-package go test ./... + TestGenReproducible at the head, pasted above.
  • R8/R9/R10: N/A — spec builds libraries + internal/schemagen; no main/deployable target, so the module suite is the class gate.
  • Change class: schema/vocabulary + spec-library Go (contract module), cross-repo cutover.

Attribution

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Make the container engine a first-class provider class instead of a bare
podman|docker string threaded through ~170 literal sites and ~30 switch
statements. This is the spec foundation for full nerdctl integration.

- schema/engine.cue: new #EngineName ("podman"|"docker"|"nerdctl"),
  #EngineRunMode (quadlet|systemd-unit|direct), #EngineCapability (the
  data-only facts table: pods/secrets/keep-id/rootless/run-mode/gpu style),
  and the provider op envelopes (binary, gpu_args, start_plan, unit_emit,
  network_ensure, describe).
- schema/candy.cue: register "engine" in #ProviderClassNames; route the
  candy/deploy `engine:` field through #EngineName so the vocabulary has one
  source.
- container/engine.go: EngineBinary handles nerdctl; add the
  EngineCapabilityFor/EngineRunModeFor data table (nerdctl: rootless,
  no pods primitive, no native secret store, no keep-id, workload uid 0,
  systemd-unit persistence, --gpus passthrough) plus a drift test tying the
  table to EngineBinary.
- hostenv: ValidateEngine accepts nerdctl; ValidateRunMode accepts
  systemd-unit; DetectRunMode delegates the engine->mode mapping to the
  spec/container table, so a new engine lands in one place.
…ability type

Address the pr-validator BLOCK on the engine provider class.

1. R3 single source of the engine vocabularies. The engine word list and
   run-mode list were still hand-written in EngineBinary and
   ValidateEngine/ValidateRunMode while claiming to be CUE-sourced. They now
   derive from the generated spec.EngineNames / spec.EngineRunModes
   (emitted by internal/schemagen from #EngineName / #EngineRunMode):
   - container: IsEngineName/EngineNames/IsRunMode/RunModes read the generated
     list; EngineBinary reads the capability table's Binary (no duplicate
     switch arm); EngineValidationError derives its message from the list.
   - hostenv: ValidateEngine/ValidateRunMode consult those; no literal list.
   Adding a 4th engine is now one CUE edit + one table row.

2. B13(d)/SDD: the capability table now uses the generated
   spec.EngineCapability type (container.EngineCapability is an alias), not a
   hand-written mirror. DetectProbe/Name are emitted from the schema.

3. B5/R1: schema/engine.cue no longer references a non-existent #EngineBinary
   def and no longer claims an already-true single-sourcing; the comment now
   states what the code does.

4. Evidence: the body's test run is regenerated uncached below.
…t the prose

Address the second pr-validator BLOCK.

1. R3: the unit-capable run-mode set is no longer a literal pair. New
   #EngineUnitRunModes (["quadlet","systemd-unit"]) emits as
   spec.EngineUnitRunModeWords; container.IsUnitRunMode reads it. DetectRunMode
   consults container.IsUnitRunMode / EngineRunModeFor instead of
   `mode != "quadlet" && mode != "systemd-unit"`; the non-unit fallback names
   hostenv.DirectRunMode. ResolveRuntime's two literal blocks collapse to ONE
   capability-driven warning (no literal "podman", no duplicate
   "systemd-unit" branch).

2. R1/B5: schema/engine.cue prose now matches the code. The header states the
   accurate rule (one CUE edit for a word + one table row for its facts),
   documents that the op-envelope engine fields are deliberately `string`
   (they carry the pre-resolution `auto`/resolved value, a superset of the
   authored vocabulary), and drops the false "EngineBinary derives from
   spec.EngineNames" claim.

3. R5: the unnecessary `type EngineCapability = spec.EngineCapability` alias is
   deleted from both container and kit; consumers name the generated
   spec.EngineCapability directly.

4. Coverage (A1/A3): new hostenv tests exercise the changed branches —
   DetectRunMode(nerdctl) == systemd-unit, DetectRunMode(podman) == quadlet,
   and the no-systemd-user fallback to direct.
The ResolveRuntime warning was inline and untestable; extract it as the pure
runModeMismatchWarning(runEngine, runMode) and cover every branch: matching
pairs are silent, a unit mode the engine cannot offer warns (nerdctl+quadlet,
podman+systemd-unit, docker+systemd-unit, unknown engine), and `direct` never
warns (it is the host-degraded fallback, not a mismatch).
The R5 vocabulary sweep this PR's own rulebook requires surfaced a surviving
engine switch: defaultLocalImageExists branched `switch engine { case "podman"
… }`. It now reads the engine capability table's image_exists_argv
(podman `image exists`; docker/nerdctl `image inspect`, since docker has no
`image exists`), so no engine-name switch remains in container/.

Adds #EngineCapability.image_exists_argv to the schema (generated
spec.EngineCapability.ImageExistsArgv) and one row value per engine.

The sweep also found a SECOND, pre-existing survivor —
container.ResolveShellImageRef hardcodes ResolveNewestLocalCalVer("podman") —
which needs an engine-parameter signature change across sdk/plugins/charly.
That is a separate cross-repo cutover and is NOT in this PR; it is recorded
here so the sweep is reported honestly rather than deleted from the claim.
Extract imageExistsProbeArgv(engine) from defaultLocalImageExists and test it:
podman probes `image exists`, docker/nerdctl probe `image inspect`, and an
unknown engine falls back to inspect. A second test asserts every engine row in
the capability table supplies its own probe, so the mapping cannot drift.
…ot podman

The R5 vocabulary sweep surfaced one remaining pre-existing engine hardcode:
ResolveShellImageRef called ResolveNewestLocalCalVer("podman"), so a host whose
only engine is docker/nerdctl resolved its local CalVer from the wrong store.
It now passes "auto", which EngineBinary/DetectEngine resolves to the engine
actually installed. No signature change, no cross-repo cutover needed — the
last engine literal in container/ is gone.
…-ref resolution

Addresses the spec#140 validator blocks 2 and 3:
- GPURunArgs now documents that "auto" resolves via DetectEngine, and
  TestGPURunArgs asserts GPURunArgs(auto) == GPURunArgs(detected).
- ResolveShellImageRef's "auto" probe is gated by
  TestResolveShellImageRefProbesInstalledEngine, which fails if it reverts
  to the hardcoded "podman".
Both tests were proven to FAIL against the pre-change code.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
… package doc

The generated EngineNames doc claimed EngineBinary/EngineCapabilityFor derive
from spec.EngineNames (they read the capability table) and that adding an
engine is one CUE edit (it is one CUE edit plus one table row, gated by
TestEngineVocabularyIsSingleSource). Regenerated spec/vocab_gen.go follows.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
…venance

- schema/engine.cue header named spec.EngineUnitRunModes; the emitted symbol is
  spec.EngineUnitRunModeWords.
- The EngineNames doc (schemagen -> spec/vocab_gen.go) and the package doc claimed
  IsRunMode/IsUnitRunMode derive from EngineNames; each predicate reads its own
  list (IsEngineName->EngineNames, IsRunMode->EngineRunModes,
  IsUnitRunMode->EngineUnitRunModeWords).

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
…teral

The sweep's own output showed "direct" with two literal homes:
container.EngineRunModeFor's fallback and hostenv.DirectRunMode. Both now call
the derived container.DirectRunMode(), which returns the member of the CUE-owned
spec.EngineRunModes that is NOT in spec.EngineUnitRunModeWords — so the mode name
has no literal home at all. hostenv holds no mode literal (no
{"quadlet","systemd-unit"} pair, no "direct"). TestDirectRunModeDerived gates the
derivation and the exactly-one-non-unit-mode invariant.
…arms

Fold the spec/exec engine-name switches onto the one engine vocabulary: a
container-exec hop is now JumpContainerExec with NestedJump.Engine carrying the
engine word (podman/docker/nerdctl). This fixes a real bug — a nerdctl deploy
previously fell through to JumpPodmanExec and ran `podman exec`. No engine
switch remains in spec/exec.

- JumpKind is transport-only: JumpContainerExec / JumpSSH / JumpVirshConsole.
  JumpPodmanExec/JumpDockerExec stay as distinct legacy values (not aliases) so
  the two remaining out-of-module constructors keep their exact engine via
  engineBinary(); they are removed when those constructors set Engine (named
  batch: the engine-provider sweep).
- NestedJump gains Engine; engineBinary() resolves Engine -> legacy kind ->
  podman. wrapWithJump/copyIntoJumpCommand/deploy_executor_process/
  venue_descriptor/ContainerChainFromDescriptor all read it.
- WaitForContainerReady probes the host's configured engine
  (CHARLY_RUN_ENGINE) instead of a hardcoded podman.
- Tests: TestWrapWithJump_Nerdctl, TestCopyIntoJumpCommand_Nerdctl,
  TestJumpEngineBinary, and the descriptor forward/back tests now assert the
  engine round-trips as data (incl. nerdctl).
The engine-as-data cutover is complete in spec/exec: JumpContainerExec +
NestedJump.Engine is the only container-exec form, and the pre-engine-data enum
arms are DELETED (not aliased). Tests updated to the new form; nerdctl covered.
Two validator findings on the exec refactor:

- DescriptorFromExecutor now echoes Jump.Engine VERBATIM (including empty)
  instead of normalizing to podman, so it is the pure inverse of
  VenueFromDescriptor again (desc{Engine:""} -> "" not "podman"). The podman
  default is applied only when BUILDING argv (engineBinary), never in the
  round trip. Test updated to pin the empty-stays-empty property.
- WaitForContainerReady's engine resolution is extracted as the pure
  readinessEngine() (CHARLY_RUN_ENGINE, else the default) with a unit test, and
  its comment now states the real contract (the container-nesting / engine
  layers export CHARLY_RUN_ENGINE; a bare host falls back to podman).
Fixes every finding from the current BLOCK (the PR auto-closed by the validator's
auto-close policy; this is the fresh branch it asks for):

1. Container/engine.go: the paragraph above EngineNames() named non-existent
   lowercase engineNames/engineRunModes symbols; replaced with the real
   EngineNames/RunModes provenance.
2. exec/deploy_executor_nested.go GetFile: the comment said 'only podman/docker/
   ssh jumps' but the arm is now JumpContainerExec (nerdctl too); made
   engine-generic ('container/ssh jumps').
3. R3: deleted the isContainerJump predicate that purely delegated to
   isContainerKind; the one call site now uses isContainerKind.
4. R3: the empty-engine default had TWO homes with two values — EngineBinary(\"\")
   returned \"docker\" while the exec hop used \"podman\". Added the ONE home
   (spec.DefaultContainerEngine = podman) and pointed both consumers at it; the
   test now asserts the shared value.

gofmt/vet/clean; full module suite green (18 packages).
The comment said the provider-consuming fields land 'as those land' — a parking
phrase. Reword to: this change lands the capability-table consumers and the
STABLE class/envelope contract; the providers bind to it.
BLOCK finding 1: the empty-engine default was still two-homed. EngineBinary("")
resolved to spec.DefaultContainerEngine (podman) but EngineRunModeFor("")
returned direct, because EngineCapabilityFor("") is not-found. An unspecified
engine now resolves its (binary, mode) from ONE engine — TestEngineRunModeFor
pins EngineRunModeFor("") == EngineRunModeFor(spec.DefaultContainerEngine).

Real bug the validator did not catch: spec/cue_types_gen.go was STALE — an
earlier schema-comment edit did not regenerate it, so TestGenReproducible FAILED
on this branch (passes on main). Regenerated via the cue:gen pipeline
(concat -> gengotypes -> retag -> vocab -> version). Full suite green (18 pkgs).
…lass

Addresses the two BLOCK findings on the engine-class cutover.

Block 1 — the empty engine was two-homed: EngineBinary("") resolved to the
default (podman) while GPURunArgs("") and imageExistsProbeArgv("") read the
capability table, got not-found, and fell back to docker/nerdctl's forms — so one
input split across two engines (a REGRESSION this cutover introduced when it
changed EngineBinary("")). EngineCapabilityFor now resolves "" to the ONE default
engine, so binary/mode/gpu-args/probe all agree. New
TestEmptyEngineResolutionIsSingleHome pins the invariant; the two tests that
codified the split are corrected.

Block 2 — the engine provider class and its whole wire contract shipped with no
in-tree servant. spec/container.InvokeEngineOp is now the PURE, placement-
agnostic servant for every op schema/engine.cue declares (describe/binary/
gpu_args/start_plan/unit_emit/network_ensure); the engine op selectors land in
spec/ops; and TestEveryDeclaredEngineOpIsServed proves each declared op is
answered for every engine word, so a newly-declared op cannot ship unserved. The
kernel-side compiled-in engine:podman/engine:docker provider (next commit in
charly) wraps this body, giving the class a real consumer.
…w round 2)

Block 1: the pure servant InvokeEngineOp had no in-tree caller. EngineBinary and
GPURunArgs are now the typed accessors of the binary/gpu_args ops — they dispatch
through the class and decode the reply, so the declared class is genuinely
CONSUMED in-tree (not a shipped-but-unconsumed contract). The op bodies call
private capability-table LEAVES (engineBinaryRaw/engineGPUArgsRaw), so the accessor
routes through the op without recursion. TestEnginePredicatesRouteThroughTheClassOp
pins accessor == op reply for every engine word + the empty word.

Also evidenced (block 2): the R5 removed-identifier sweep is executed (empty in
spec) and the consumer liveness is stated — sdk re-exports the removed
JumpPodmanExec/JumpDockerExec aliases and charly's deploy_add_cmd.go uses
specexec.JumpPodmanExec, both migrated by their own producer->consumer legs.
The prior comment claimed 'the container-nesting / engine layers set it' without
naming them. The actual producers are candy/plugin-settings (the
charly settings engine.run reader) and the container-nesting layer (which sets
CHARLY_RUN_ENGINE=podman for the nested-pod posture); hostenv.ResolveRuntime reads
the same variable. Name them so the claim is verifiable, not asserted.
…mit contract

Review round 3, both blocks:

1. An unknown NON-EMPTY word still split one input across two engines:
   EngineBinary(bogus)=podman (default) while
   GPURunArgs(bogus)/imageExistsProbeArgv(bogus)=docker/nerdctl's forms and
   EngineRunModeFor(bogus)=direct. EngineCapabilityFor now resolves ANY non-member
   word (empty or unknown) to the ONE default engine, so binary/mode/gpu-args/probe
   all agree; IsEngineName remains the typo gate. New
   TestUnknownEngineResolutionIsSingleHome pins f(x)==f(EngineBinary(x)) for every
   consumer; the tests that codified the split are corrected.

2. schema/engine.cue's #EngineUnitRequest doc claimed the op renders the quadlet
   form for podman, but the servant returns no files for a quadlet request (podman's
   OWN generator emits that form). Corrected the doc to state that explicitly, and
   regenerated spec/cue_types_gen.go (comment-only; TestGenReproducible passes).
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 79f2e9e033f852d194b280c03daa002c12c0e51e (branch: fix/nerdctl-engine-class-v3)

Change class: schema/vocabulary + spec-library Go (contract module), cross-repo cutover.

Security screen: PASS (no secrets/egress, no weakened guardrails, no supply-chain change; T1–T4 clean).

Blocks

  1. R1/R5 — container/engine.go: the EngineRunModeFor doc comment contradicts its own implementation (stale, not swept).
    The function doc asserts:

    "A genuinely unknown NON-EMPTY word falls back to the non-unit mode (the conservative, no-unit path…)."
    But the code does the opposite:

    func EngineRunModeFor(engine string) string {
        if c, ok := EngineCapabilityFor(engine); ok {   // "bogus" → default engine, ok=true
            return string(c.RunMode)                    // → "quadlet", NOT the non-unit mode
        }
        // Unreachable for "" or an unknown word (both resolve to the default engine's
        // capability)…  ← inline comment directly contradicts the doc above
        return DirectRunMode()
    }

    EngineRunModeFor("bogus") returns the default engine's mode (quadlet); the doc describes the pre-fix direct fallback that this PR (body block feat(spec): initial import — spec + proto wire/IR contract extracted from sdk (#55 Phase A1) #1) explicitly removed, and TestEngineRunModeFor now asserts the new behavior. This is exactly the "unknown word split" the PR claims to have closed, and the false claim was not swept in the same commit (R5: every outdated claim swept; R1: a comment divergence from reality is an incident). Fix: rewrite the doc to state that any non-member word (empty or unknown) resolves to the default engine's mode, and that DirectRunMode() is reached only for "auto" when no engine is installed — matching the inline comment and the test.

  2. R1 — schema/engine.cue unit_emit doc diverges from the servant it claims to match (body block feat(spec)!: host the loader-RESULT type family (#55 Phase B, cutover 1) #2 says "the schema doc matches the servant").
    The doc says the reply is empty for "a request whose run mode is quadlet, or is not a unit mode at all" — i.e. the decision input is the request's run_mode. But container/engine_ops.go engineUnitEmit keys off the engine's capability mode, never req.RunMode:

    if !IsUnitRunMode(string(c.RunMode)) || string(c.RunMode) == "quadlet" {
        return marshalReply(spec.EngineUnitReply{}) // engine mode decides, not req.RunMode
    }

    A request with engine: nerdctl, run_mode: quadlet renders a .service (nerdctl's capability mode is systemd-unit), contradicting the doc's stated rule. Fix: make the doc state that the decision is the provider/engine's capability run mode (or have the servant honor req.RunMode); the two must not disagree.

Minor (fix in the same commit)

  1. A1 — body mislabels spec/engine_consts.go as generated. The body's file list groups it under "the generated spec/cue_types_gen.go / spec/vocab_gen.go / spec/engine_consts.go"; engine_consts.go is hand-written (a const DefaultContainerEngine = "podman"). Correct the accounting.

Notes (non-blocking, investigated): the R10 N/A claim for a library-only module with no deployable target is accepted (no forbidden framing; the module suite is the natural class gate and the new behavior ships tests that fail without it — TestWrapWithJump_Nerdctl, TestEngineStartPlanOp, TestEngineUnitEmitOp, TestDetectRunMode_NerdctlIsSystemdUnit, TestUnknownEngineResolutionIsSingleHome). The R5 removed-identifier sweep is internally consistent with the diff (no surviving JumpPodmanExec/JumpDockerExec/isContainerJump), and the cross-repo liveness paste names the consumer legs (sdk kit/exec_aliases.go+deploykit/kit_aliases.go, charly deploy_add_cmd.go). Comment thread is empty (nothing to adjudicate).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

Two doc comments still described the pre-fix behavior (an unknown word yielding
a fallback / an error reply), contradicting the code, the inline comments, and
the tests shipped in the same function:
- EngineRunModeFor: now states an unknown non-empty word resolves to the DEFAULT
  engine's mode (same as empty), and DirectRunMode() is reached only for "auto"
  with no engine installed.
- engineDescribe: now states an unknown word resolves to the default engine's
  capability (not an error); the Error reply is only for "auto" with no engine.
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 40b13ee544d9a1a55911668ea5b4a556f3450ef3 (branch: fix/nerdctl-engine-class-v3)

Change class: schema/vocabulary + spec-library Go (contract module), cross-repo cutover.

Security screen: PASS (no secrets/egress, no weakened guardrails, no supply-chain change; T1–T4 clean — the PR touches no validator spec/rulebook/gate).

Comment intake (prior github-actions[bot] review at 79f2e9e):

  • Finding 1 (EngineRunModeFor doc) — stale-superseded: the current doc now reads "An EMPTY word AND an unknown non-empty word both resolve to the ONE default engine … and return its mode", matching the inline comment and TestEngineRunModeFor. Resolved.
  • Finding 2 (unit_emit doc vs servant) — verified-blocking: the cited text is unchanged and still reproduces (below).
  • Finding 3 (body mislabels spec/engine_consts.go) — verified-blocking: the current body still reproduces it (below).
  • Notes (R10 N/A for a library-only module; R5 sweep consistency; cross-repo liveness paste) — verified-non-blocking, re-derived against the current diff and accepted.

Blocks

  1. R1 — schema/engine.cue #EngineUnitRequest doc still diverges from its servant (prior finding 2, unaddressed). The doc (echoed into spec/cue_types_gen.go) states the empty-reply rule as "A request whose run mode is quadlet, or is not a unit mode at all, returns an EMPTY reply" — i.e. the decision input is the request's run_mode. But container/engine_ops.go engineUnitEmit never reads req.RunMode; it keys off the engine's capability mode:

    if !IsUnitRunMode(string(c.RunMode)) || string(c.RunMode) == "quadlet" { return marshalReply(spec.EngineUnitReply{}) }

    For engine: nerdctl with run_mode: quadlet (or direct) the servant renders charly-<name>.service, contradicting the doc's stated rule. Fix: state the decision is the provider/engine's capability run mode (as the following sentence — "This op answers only the engine that has no native generator" — implies), or have the servant honor req.RunMode; the two must not disagree.

    • Same block, same file: the engine_specific field doc claims "the systemd-unit emitter uses it for the wrapped CLI argv", but renderSystemdUnit never references req.EngineSpecific (it uses req.StartArgv); and exec_start_pre is declared but never emitted (ExecStartPre=). Align the docs with the servant (or consume the fields).
  2. A1/R1 — the body still lists spec/engine_consts.go as generated (prior finding 3, unaddressed). The body groups "the generated spec/cue_types_gen.go / spec/vocab_gen.go / spec/engine_consts.go", but spec/engine_consts.go is hand-written (a hand-authored const DefaultContainerEngine = "podman" with no generator header; internal/schemagen emits only EngineNames/EngineRunModes/EngineUnitRunModeWords into vocab_gen.go). Correct the accounting to separate the generated files from the hand-written one.

  3. R1 — container/engine_test.go: doc comment misattached. Two doc blocks are merged into one comment immediately above TestUnknownEngineResolutionIsSingleHome, and the first begins // TestEmptyEngineResolutionIsSingleHome pins the block-1 invariant…, so the comment names a different function than the one it documents (and TestEmptyEngineResolutionIsSingleHome is left undocumented). Split the blocks so each comment precedes the function it names.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…gree (review round 5)

The schema doc says the decision input is the REQUEST's run_mode, but the servant
keyed off the ENGINE's capability mode and never read req.RunMode — so a
run_mode=quadlet request to the nerdctl provider rendered a .service,
contradicting the doc. The servant now reads req.RunMode (defaulting to the
engine's capability mode when empty), so quadlet (or any non-unit mode) yields no
files from ANY provider. TestEngineUnitEmitHonorsRequestRunMode pins it.
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 80c11d74def356e3129110a2a5ff4c03c82843c8 (branch: fix/nerdctl-engine-class-v3)
Change class: schema/vocabulary + spec-library Go (contract module), cross-repo cutover.

Comment intake (re-derived against the CURRENT diff)

  • 5785320826 (head 79f2e9e) — F1 EngineRunModeFor doc: stale-superseded (current doc states any non-member word resolves to the default engine's mode; matches code + TestEngineRunModeFor). F2 unit_emit doc/servant: stale-superseded at that head, but see Block 1 below for the surviving sub-point. F3 body mislabels spec/engine_consts.go as generated: stale-superseded (the current body explicitly separates the generated cue_types_gen.go/vocab_gen.go from "the HAND-WRITTEN spec/engine_consts.go").
  • 5785401408 (head 40b13ee) — B1 unit_emit doc/servant: the run_mode half is stale-superseded (the servant now reads req.RunMode, defaulting to the engine capability mode; doc and code agree), but the engine_specific/exec_start_pre half is verified-blocking (Block 1). B2 body mislabels engine_consts.go: stale-superseded. B3 engine_test.go misattached doc comment: verified-blocking (Block 2).
  • Notes accepted non-blocking (re-derived): R10 N/A for a library-only module with no deployable target is coherent (no forbidden framing; the module suite is the class gate and the new behavior ships tests that fail without it); the R5 sweep (JumpPodmanExec/JumpDockerExec/isContainerJump) is internally consistent with the diff and the cross-repo liveness paste names the consumer legs.

Blocks

  1. R1/R5 — schema/engine.cue #EngineUnitRequest.engine_specific doc contradicts its servant (echoed into spec/cue_types_gen.go). The field doc asserts "the systemd-unit emitter uses it for the wrapped CLI argv", but the emitter renderSystemdUnit in container/engine_ops.go never references req.EngineSpecific — it builds ExecStart= from req.StartArgv. So the field is declared as supplying the wrapped CLI argv while the servant ignores it entirely. Same envelope: exec_start_pre is declared (@go(ExecStartPre)) but renderSystemdUnit never emits ExecStartPre=. Fix: correct the engine_specific doc (it is not consumed by this emitter) and either consume/emit exec_start_pre or drop the field, so the published schema doc and the servant agree.

  2. R1/R5 — container/engine_test.go: doc comment misattached. The single comment block immediately above TestUnknownEngineResolutionIsSingleHome begins // TestEmptyEngineResolutionIsSingleHome pins the block-1 invariant …, so the comment names a different function than the one it documents, and TestEmptyEngineResolutionIsSingleHome (defined below, no comment) is left undocumented. Fix: split the block so each comment precedes the function it names.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…ific (review round 6)

- container/engine_test.go: split the merged doc comment so each comment precedes
  the test it names (TestUnknownEngineResolutionIsSingleHome / TestEmptyEngineResolutionIsSingleHome).
- renderSystemdUnit now consumes the declared exec_start_pre field (one
  ExecStartPre= per entry); added TestEngineUnitEmitEmitsExecStartPre.
- schema/engine.cue: engine_specific doc corrected to a declared CARRIER not read
  by the systemd-unit servant today (podman's quadlet is emitted by podman's own
  generator); regenerated spec/cue_types_gen.go (comment-only).
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: c331344818786ce6e3567d8a651a35db762948f4 (branch: fix/nerdctl-engine-class-v3)

Security screen: PASS — no secrets/egress, no weakened guardrails, no supply-chain change; T1–T4 clean (the PR touches no validator spec/rulebook/gate; exec.Command invocations are charly-as-orchestrator against engine CLIs).
Change class: schema/vocabulary + spec-library Go (contract module), cross-repo cutover.
Checklist: All applicable rules PASS or NA. Placement: CORRECT (engine vocabulary CUE-first in schema/engine.cue → generated spec.EngineNames/EngineRunModes; capability facts + op servant in the spec contract slice; the compiled-in/out-of-process providers are the consumer legs, correctly not pulled into this layer).
Comment intake: all three prior github-actions[bot] findings re-derived against the CURRENT diff and stale-superseded — EngineRunModeFor/engineDescribe docs now match their code; engineUnitEmit reads req.RunMode, exec_start_pre is emitted by renderSystemdUnit, and the engine_specific doc states it is unread; container/engine_test.go comments are now split per function; the body labels spec/engine_consts.go hand-written. No surviving finding. R10 N/A for a library-only module with no deployable target is coherent (module suite is the class gate; the producer→consumer bed runs land in the named consumer legs).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 22, 2026 22:51
… leaf (review round 7)

The file header claimed 'the argv builders reuse GPURunArgs so no second copy of
the GPU flag family exists', but nothing calls GPURunArgs there — the dependency
is the reverse (GPURunArgs -> InvokeEngineOp -> engineGPUArgsRaw), and GPURunArgs'
error fallback re-literalized {'--gpus','all'}. Reworded the header to state the
one home (engineGPUArgsRaw, with GPURunArgs its accessor) and made the fallback
delegate to that same leaf, so no second copy exists.
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: b10558331f8776e0fdb566afc87c4fc0329f1fe4 (branch: fix/nerdctl-engine-class-v3)

Security screen: PASS — no secrets/egress, no weakened guardrails, no supply-chain change; exec.Command sites are charly-as-orchestrator against engine CLIs (T1–T4 clean).
Checklist: All applicable rules PASS or NA. Placement: CORRECT (engine vocabulary CUE-first in schema/engine.cue → generated spec.EngineNames/EngineRunModes/EngineUnitRunModeWords; capability table + op servant live in the spec contract slice; compiled-in/out-of-process providers are correctly the consumer legs). R10 N/A for a library-only module with no deployable target is coherent, and TestGenReproducible (pasted PASS) covers the CUE→Go drift gate.
Comment intake: 5785320826 / 5785401408 / 5785463640 — every finding re-derived against the CURRENT diff and stale-superseded (EngineRunModeFor/engineDescribe docs now match their code; engineUnitEmit reads req.RunMode; renderSystemdUnit emits exec_start_pre and the engine_specific doc states it is unread; container/engine_test.go comments are split per function; the body labels spec/engine_consts.go hand-written). 5785558746 — PASS re-derived; the sole delta since (b105583: engine_ops header R3-claim fix + the shared engineGPUArgsRaw leaf) is clean — the GPU flag form is now defined exactly once and GPURunArgs routes through the op to it.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: c0ca253e743063279c0b49ab647ea4de953d82e3 (branch: fix/nerdctl-engine-class-v3)

Change class: schema/vocabulary (CUE-first) + spec-library Go (contract module), cross-repo cutover.
Security screen: PASS — T1–T4 clean: no secrets/egress, no new deps/version-pin/CI-script edits, no validator-spec/rulebook/gate/guardrail touched; every exec.Command site is charly-as-orchestrator against an engine CLI (DetectEngine, defaultLocalImageExists, WaitForContainerReady).
Checklist: All applicable rules PASS or NA. SDD holds (all three schema/*.cue edits have matching spec/cue_types_gen.go+spec/vocab_gen.go regeneration; new request/reply structs come from schema/engine.cue; the @go(-) on the list-valued #EngineUnitRunModes suppresses only a useless Go type while its values are still emitted as spec.EngineUnitRunModeWords — same sanctioned pattern as the pre-existing #ProviderClassNames). ADE N/A (no candy changed). R10 N/A for a library-only module with no deployable target is coherent; the new behavior ships tests that fail without it (TestUnknownEngineResolutionIsSingleHome, TestEmptyEngineResolutionIsSingleHome, TestWrapWithJump_Nerdctl, TestEngineStartPlanOp, TestEngineUnitEmitOp, TestDetectRunMode_NerdctlIsSystemdUnit, TestResolveShellImageRefProbesInstalledEngine), and TestGenReproducible pasted PASS covers the CUE→Go drift gate.
Placement: CORRECT — engine vocabulary CUE-first in schema/engine.cue → generated spec.EngineNames/EngineRunModes/EngineUnitRunModeWords; the capability table + pure op servant sit in the spec contract slice as the shared body; the compiled-in podman/docker and out-of-process nerdctl providers are the consumer legs, correctly not pulled into this layer.

Comment intake (each re-derived against the CURRENT diff/body):

  • 5785320826 (BLOCK @79f2e9e) — F1 EngineRunModeFor doc, F2 unit_emit doc/servant, F3 body mislabel of engine_consts.go: stale-superseded (current doc states any non-member word resolves to the default engine's mode, matching code + TestEngineRunModeFor; the servant now reads req.RunMode; the body labels spec/engine_consts.go HAND-WRITTEN).
  • 5785401408 (BLOCK @40b13ee) — B1 engine_specific/exec_start_pre half: stale-superseded (renderSystemdUnit emits ExecStartPre= for each exec_start_pre entry and the engine_specific doc states it is a declared carrier not read by this emitter); B2 body mislabel: stale-superseded; B3 engine_test.go misattached comment: stale-superseded (each comment now precedes its own function).
  • 5785463640 (BLOCK @80c11d7) — B1/B2 as above: stale-superseded (same re-derivation).
  • 5785558746 (PASS @c331344) and 5785642626 (PASS @b105583) — verified-non-blocking: independently re-derived and agreed; the only deltas since are the gofmt fix (8a22fcc) and the c0ca253 merge, both clean.

Note (non-blocking): the branch carries ~40 commits including body re-freezes and two main merges; the intended squash collapses them. No partial/Phase-2/split work remains — the final tree is atomic and self-consistent.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot merged commit c812379 into main Sep 22, 2026
1 of 2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 22, 2026
aitrawog pushed a commit that referenced this pull request Sep 23, 2026
Body-only update (the class gate is now evidenced by the committed ci.yml run
green on the head + the merged #143/#144/#145 precedent, and the no-disposable-
target proof uses a real path). No source change — this empty commit moves the
head so the fresh validator run keys to a head whose body is already final.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (documentation reviewed)
aitrawog pushed a commit that referenced this pull request Sep 23, 2026
Body-only update (the class gate is now evidenced by the committed ci.yml run
green on the head + the merged #143/#144/#145 precedent, and the no-disposable-
target proof uses a real path). No source change — this empty commit moves the
head so the fresh validator run keys to a head whose body is already final.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (documentation reviewed)
github-actions Bot pushed a commit that referenced this pull request Sep 23, 2026
…stry-portable (#148)

* feat(cache): OCI Image Layout ArtifactStore — content-addressed, registry-portable

Replace the keyed one-JSON-file-per-key cache with ONE content-addressed
artifact store whose on-disk form is a standard OCI Image Layout
(oci-layout + index.json + blobs/<alg>/<digest>). Each cached artifact is a
real OCI manifest: the config blob carries the validity metadata
(resolved/components/validator), layers[0] the payload, and annotations the
cache key + org.opencontainers.image.ref.name tag. A named cache is one OCI
index, so a whole store can be pushed/pulled to a registry unchanged (the
verb:oci cache-push/cache-pull transport lands next).

The file backend uses stdlib + opencontainers/image-spec + go-digest ONLY; no
go-containerregistry in the contract module.

The legacy Store API (Open/OpenNamed/OpenLimited/Read/ReadTTL/WriteValue/
PutEntry/entryPath) is DELETED in the same cutover; consumers migrate in this
change (refs submodule verdicts, container image list + labels) and in the sdk
change (loaderkit materialized tree).

repoCacheProvenanceVersion 2 hard-rejects the legacy bare-commit sidecar: a v1
export cannot certify its tree (the pre-cutover loader rewrote it in place —
auto-migrating charly.yml to the consumer's schema CalVer), so it is treated as
not-cached and re-fetched once pristine. IsRepoCached now enforces this, so
immutable-tag caches self-heal too. This is the root-cause fix for the poisoned
@main cache that failed check-substrate's deploy-add.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (syntax check only)

* fix(cache): clear golangci-lint findings (staticcheck QF1008/SA4000, gocritic, unconvert)

- cache.go: drop the redundant Versioned selector on the embedded field.
- cache_test.go: derive the determinism check from fresh values (avoid SA4000).
- container/engine_ops.go: if/else chain -> tagged switch (gocritic).
- container/engine_ops_test.go: drop the unnecessary string() conversions.

The two container findings pre-date this branch (they block the module gate, so
they are fixed here per R2 rather than deferred).

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (syntax check only)

* fix(cache): Fill must stamp Resolved (a zero-Resolved callback result was stored stale)

The validator caught a real regression: the new Fill persisted via put(), which
preserves the caller's Resolved, whereas the legacy Fill persisted via Put(),
which stamped Resolved=now. A fill callback returning an Entry with a zero
Resolved (a degrade/empty result) was therefore stored with Resolved=zero:
instantly TTL-stale (defeating compute-once for any TTL caller) and sorted as
the OLDEST entry for reclamation.

Fill now stamps e.Resolved = time.Now() before persisting, matching Put and the
legacy contract. The fill guard is also per-key again (locks/<tag>.fill.lock),
matching the documented per-key flock rather than the interim store-wide lock.

TestFillStampsResolved fails without the stamp:
  --- FAIL: TestFillStampsResolved (0.00s)
      Fill must stamp Resolved=now so the entry is TTL-fresh; got 0001-01-01...

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

* docs(cache): correct Entry.Key doc — Get reconstructs it, put() no longer stamps it

The validator found a doc/impl divergence: the Entry.Key comment still claimed
"Set by the Store on Put", but the new keyed-by-tag layout reconstructs the key
from the manifest annotation on Get and no longer stamps it on write. Fix the
comment to match the implementation.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (documentation reviewed)

* docs: re-freeze the PR body against the final head

Body-only update (the class gate is now evidenced by the committed ci.yml run
green on the head + the merged #143/#144/#145 precedent, and the no-disposable-
target proof uses a real path). No source change — this empty commit moves the
head so the fresh validator run keys to a head whose body is already final.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (documentation reviewed)

* docs: re-freeze the PR body against the final head

Body-only update (the class gate is now evidenced by the committed ci.yml run
green on the head + the merged #143/#144/#145 precedent, and the no-disposable-
target proof uses a real path). No source change — this empty commit moves the
head so the fresh validator run keys to a head whose body is already final.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (documentation reviewed)

---------

Co-authored-by: Andreas Trawoeger <[email protected]>
@aitrawog
aitrawog deleted the fix/nerdctl-engine-class-v3 branch September 25, 2026 19:10
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.

2 participants