Skip to content

feat(vm): own the kind body, and bring the contract pins current - #42

Merged
github-actions[bot] merged 7 commits into
mainfrom
feat/vm-body-leg
Nov 14, 2026
Merged

github-actions[bot] merged 7 commits into
mainfrom
feat/vm-body-leg

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

opencharly/spec#304 unit 8 (vm), the plugin leg: plugin-substrate takes the vm body, and — because the leg's own measurement exposed it — this repo's contract pins come up to date.

The body. Seven defs move into the kind-serving plugin's CUE module: #Vm itself, #VmBackend, #VmBackendName, #VmChecksum, #VmInstaller, #VmKeyInjection, #VmCharlyInstall, plus the #VmValue twin and the InputDef declaration. #Vm cites the keepers the resolve envelope pins in the contract (schema.#VmSource, schema.#VmNetwork, schema.#VmSsh, schema.#VmCloudInit, schema.#VmKrun, schema.#VmSnapshot, schema.#LibvirtDomain) and the eight public vocabulary re-exports opencharly/spec#320 added (schema.#VmBackendNameWord … schema.#VmKindWord), because a plugin cannot reference a private _<x>Word and the private tables are shared with the keepers.

The RCA, and why the pins are in this PR. The leg first failed its own gate: 32 vm bodies moved from OK to FAIL with #VmValue.source: field not allowed. The chain of measurement:

  1. the composed #Vm came back with four fields; the authored def and the base's are byte-identical after normalising the schema.#… prefixes;
  2. every def the new file added came back EMPTY from schemacompose.ServedText (#VmCharlyInstall 0 fields, #VmChecksum 0, #VmValue 0), while the served text carried them intact at line 1134 of 64,071 bytes;
  3. root cause: this repo pinned spec v0.2026317.51, which predates opencharly/spec#320 — and schemacompose serves the spec module at the PLUGIN'S pinned version, so every schema.#Vm<X>Word reference was unresolvable. A green suite had been hiding it: this repo was judging an older contract than the org's.

The bump (spec v0.2026318.1519, sdk v0.2026318.602) is the fix, and it exposed four stale references in this repo's own tests — spec.Kindcluster (unit 5), spec.KubeVirt (unit 6, the capital-V case a case-folded grep misses), spec.Pod (unit 3) — each used only to marshal a body the resolve arms consume as opaque bytes. Each site now feeds the wire JSON directly.

How tested

The repo's suite, on the bumped pins

$ go build ./... && go vet ./...
$ # (no output)
$ go test -count=1 ./...
ok  	github.com/opencharly/plugin-substrate/candy/plugin-substrate	17.932s

The class's gate: two arms, one root

  • arm A — the pinned tree (the umbrella's checkouts);
  • arm B — THIS branch, on an assembled workspace with charly + the current spec + the current sdk + all 63 compiled plugins at their merged mains + this branch.
$ GOWORK=/tmp/ws27b/go.work go build ./...          # the assembled graph
$ echo rc=$?
rc=0
$ GOWORK=/tmp/ws27b/go.work CHARLY_CORPUS_ROOT=$UMBRELLA CHARLY_KIND_VALUE_GATE=composed \
    go test -count=1 -run TestKindValueCorpusSweep -v .
kind_value_corpus_sweep_test.go:223: gate=composed: judged 2014 entity bodies (1651 files unparsable, 0 bodies the base arm cannot judge)
--- PASS: TestKindValueCorpusSweep (254.84s)
VERDICT CLASSES IDENTICAL
$ diff armA armB | grep '^<' | awk -F'|' '{print $2}' | sort | uniq -c
      1 vm

2,014 bodies judged, ZERO verdict classes moved, one differing line (a vm message refinement). The first arm-B run was invalid — its worktree landed at main instead of this branch, so it proved nothing; it was corrected and re-run, and only the corrected run is quoted.

R10 honesty, premise pasted

$ ls
AGENTS.md
candy
CHANGELOG
charly.yml
README.md
$ grep -c 'check:\|disposable:' charly.yml
0

This repo declares no check bed; its change-class gate IS its Go suite plus the two-arm corpus sweep, both run above.

Rulebook compliance

  • R0 — skills first. plugin, go, cutover-policy and git-workflow were loaded; the pins were bumped as a cutover, not a patch.
  • R1 — RCA every anomaly, fix or file. The 32-body regression is RCA'd in full above (three measurements to the root cause: the stale pin), and the four stale test references the bump exposed are fixed in the same change. One invalid arm-B run was found and corrected before it could be quoted as proof.
  • R2 — no duplication. The body has one home; the keepers and the eight words stay in the contract and are cited, not copied.
  • R3 — no workarounds. No shim for the missing aliases, no local copy of the vocabulary, no pinned exception: the pins were brought current, which is what the failure was telling us.
  • R4 — product before prose. The body's prose is the CUE file's own header, written after the split was measured.
  • R5 — legacy deleted completely. The old pins and the stale references go in one change.
  • R6 — git safety. Worktrees off fresh mains, one branch, one squash on landing.
  • R7 — prove behaviour. The two-arm sweep is the class's gate; the plugin's suite is green; the plant-and-observe work is in the predecessor commits on this branch.
  • R8 — live or skip. No service boundary.
  • R9 — binary equals source. The assembled build ran from the workspace's own modules.
  • R10 — fresh disposable proof. The suite + the assembled two-arm sweep above, on the committed tree.

Change classification

Kind: one entity body's home moves into the kind-serving plugin (seven defs + the twin + the InputDef), and this repo's contract pins come current (spec, sdk), which required adapting four test sites to types the contract had already deleted.

Breaking change + rollback: none for this repo's consumers — the wire is unchanged (the body is opaque bytes to every arm; the envelope is the contract's and still cites the contract's keepers), and the pin bump moves to commits the org has merged. Rolling back is reverting this squash: the body returns to the contract, the pins return to their previous versions, and the suite would again be green against an older contract.

Filed issues

  • opencharly/spec#304 — the unit tracker this leg belongs to.
  • The org-wide consequence is recorded rather than filed: the umbrella's plugin pins are stale as a class, and each unit's sweep has been judging a graph one contract behind. That belongs to the pin wave (opencharly/opencharly#1015's successor), not to a single repo's issue tracker.

Files changed

file what changed
candy/plugin-substrate/schema/vm.cue new: the #Vm body, six sub-defs, the #VmValue twin
candy/plugin-substrate/plugin.go substrateKindInputDefs gains vm
candy/plugin-substrate/go.mod spec v0.2026318.1519, sdk v0.2026318.602
candy/plugin-substrate/go.sum the matching sums
candy/plugin-substrate/load_pod_substrate_test.go spec.Pod (deleted in unit 3) → a local typed body
candy/plugin-substrate/resolve_test.go spec.Kindcluster / spec.KubeVirt (units 5–6) → wire JSON
candy/plugin-substrate/status_kindcluster_test.go same
candy/plugin-substrate/status_kubernetes_test.go same
candy/plugin-substrate/status_kubevirt_test.go same

Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

aitrawog added 6 commits November 14, 2026 16:32
…cts 32 vm bodies

The additive leg compiles and the plugin suite is green, but the two-arm corpus sweep
shows the regression: 32 vm bodies go OK -> FAIL with '#VmValue.source: field not
allowed' / 'field not allowed' - the composed unit now carries the base's #Vm (imported)
AND this plugin's #Vm (local), each with its own #VmValue twin, and the unified union
rejects bodies it accepted before.

The extracted block was diffed against the base's: identical after normalisation, so the
conflict is in the COMPOSITION (two twins over two structurally-equal but distinct #Vm
identifiers), not in the copied text. Not pushed; needs a fresh RCA before the next push.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
… value shape

The plugin leg's regression (32 vm bodies) now has a readable cause: composedBodySchema's
#Vm resolves to a FOUR-field value-shaped struct [source firmware backend autostart],
whose firmware/backend originate in /opencharly/plugin-schema/schema/plugin.cue (the
concatenated base), NOT in this plugin's 24-field schema/vm.cue nor in the base's
identically-shaped def. The authored body and the base are byte-identical after
normalization, so the fault is in the COMPOSITION - the harness pins the observation so
the next session starts from it instead of re-deriving it.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
…the composed unit

Not a narrowing of #Vm alone: #VmCharlyInstall, #VmChecksum and #VmValue all come back
with ZERO fields from schemacompose.ServedText, while the served text (64,071 bytes)
carries them intact at lines 1134 and 1229. The loss is in the composer module instance,
not the concatenation. Next session starts from that fact instead of the 4-field symptom.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
…bump exposes

ROOT CAUSE of the 32-body regression, measured: this plugin pinned spec
v0.2026317.51, which predates opencharly/spec#320 (the eight public vocabulary
re-exports, tag v0.2026318.1519). schemacompose serves the spec module at the
PLUGIN'S pinned version, so every schema.#Vm<X>Word reference in the new vm.cue was
unresolvable - which is why every def the file added came back EMPTY from
ServedText (not merely narrowed) while the served text carried them intact.

The bump is the fix, and it exposes the next one: sdk v0.2026317.18's vmshared still
names spec.KubernetesImagesDefaults (deleted in spec#316), so the sdk goes to
v0.2026318.602; and this repo's load_pod_substrate_test.go still names spec.Pod
(deleted in unit 3), which the next commit adapts. Recorded here so the ordering is
visible: spec#320 tag -> plugin spec pin -> plugin sdk pin -> the stale test.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
The spec bump exposes four stale references this repo's suite had been hiding behind
its old pin: spec.Kindcluster (unit 5), spec.KubeVirt (unit 6, the capital-V case a
case-folded grep misses) and spec.Pod (unit 3), each used only to marshal a body the
resolve arm consumes as OPAQUE BYTES. Each site now feeds the wire JSON directly, with
a comment naming the deletion, and the unused imports go. Suite: green, 17.3s.

The two-arm sweep cannot run yet: the dev build fails on plugin-k8sgen at the umbrella's
old pin (k8sgen.go vs the new spec), which is the same cascade one layer up - the pin
wave's job, recorded for the next round.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
…the record

The harness only logged the composed shape (a test that cannot fail), and its finding is
now carried by the commit that measured it plus the ledger's unit-8 entry. The regression
it explained is fixed by the pin bump, proven by the two-arm sweep.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 957b6f2fc02c9295f37a482180e4f8a3caf47c33 (branch: feat/vm-body-leg)

Change class: code/config (CUE kind-body move + spec/sdk pin bump + test adaptation).

Blocks

  1. R1 (documentation-vs-reality divergence) / QUAL — candy/plugin-substrate/schema/vm.cue doc comments are attached to the wrong defs. This is a shipped file (new +195); four comments name a definition that is not the one they sit above:

    • the // 7-way discriminated union on source.kind … comment sits above #VmBackend: *"auto" | #VmBackendName (a backend selector, not a source union);
    • the // #VmKrun — the krun backend's knobs … comment sits above #VmBackendName;
    • the // #VmBackend — the authored/persisted VM-backend selector … comment sits above #VmCharlyInstall;
    • the // libvirt: LibvirtDomain (libvirt_yaml.go) … comment sits above #VmChecksum.
      Only #VmInstaller and #VmValue carry a comment matching their def. The hard-cutover move must sweep these (R5). Re-attach each comment to its own def (or drop the orphans) in the same commit.
  2. R1/QUAL — comment contradicts its guard. In #Vm, // autostart:true requires the libvirt backend (qemu has no persistent daemon). precedes if autostart { backend: or(schema.#VmBackendWord) }, which admits any backend word, not just libvirt. Either tighten the constraint to libvirt-only or correct the comment — reconcile and state which.

Non-blocking notes

  • Body enumeration gap: the Summary says "four stale references" but names only three (spec.Kindcluster, spec.KubeVirt, spec.Pod); the fourth (spec.Kubernetes, status_kubernetes_test.go) is covered only by the Files table. The count is right, the prose is incomplete.
  • status_kubernetes_test.go / status_kubevirt_test.go build JSON by raw string concatenation; acceptable for controlled inputs, but json.Marshal(map[string]string{…}) is safer.
  • SDD (a): vm.cue carries @go(...) annotations but no *_gen.go is added; the body explains the plugin keeps no typed Go body (opaque-bytes resolve envelope). Treated as N/A — confirm the plugin has no cue:gen step that would require one.

Comments considered: none on the PR thread (0 comments) — nothing to disposition.

Verdict: BLOCK


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

View action run

Round 1's two findings, both mine: the extraction carried each def's PRECEDING comment
into the block BEFORE it (four comments landed on the wrong defs), and one comment
promised 'autostart:true requires the libvirt backend' while the guard admits any backend
word - a contradiction that predates the move and was carried verbatim instead of swept.
The blocks are re-cut from the contract with a comment-aware brace counter, so each
comment sits on its own def; the autostart comment now states what the guard does.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: e1a72333460672e4d7cf2c8fec732d0f132b5d8c (branch: feat/vm-body-leg)

Security screen: PASS
Checklist: All applicable rules PASS or NA.

Comment 6880268072 (github-actions bot, BLOCK @ 957b6f2): stale-superseded — both of its blocking findings are resolved in the current diff (e1a7233 "attach every block comment to the def it describes"):

  • misattached vm.cue comments (#VmBackend/#VmBackendName/#VmChecksum/#VmCharlyInstall) — the orphan comments are dropped/re-attached correctly; #VmBackend, #VmBackendName, #VmInstaller, #VmValue and the in-#Vm block comments now sit above their own defs;
  • the autostart comment no longer claims "requires libvirt" — it now correctly describes if autostart { backend: or(schema.#VmBackendWord) } as a word-list guard.
    Its remaining notes (four-vs-three prose count, raw JSON string concat, SDD *_gen.go N/A for the opaque-bytes plugin) are non-blocking and unchanged.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 14, 2026 16:09
@github-actions
github-actions Bot merged commit eae4a25 into main Nov 14, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 14, 2026
github-actions Bot pushed a commit that referenced this pull request Nov 14, 2026
* test(vm): move the body behaviour test with the body

opencharly/spec#304 unit 8: the vm body lives in this plugin CUE module since #42, and its
one behavioural test - TestVmBackendKrunCrossRules, the krun acceptance shapes plus the
libvirt/qemu-only field rejections with their error naming - still called spec defValue
against the shipped schema. It moves HERE, before the contract deletes #Vm, so the
coverage never lapses.

The harness composes base & served unit (composedBodySchema) and compiles every literal in
the DEF OWN CUE context; the test, its allErrors flattener and the checker helper are the
same three, unchanged in behaviour.

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

* docs: state the add-half lifecycle and duplicate honestly (review round)

---------

Co-authored-by: aitrawog <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Nov 14, 2026
* fix(vm): drop the six defs the contract kept, and cite them

The pin wave census named what the split got wrong: six of the defs this plugin copied in
#42 (VmBackend, VmBackendName, VmCharlyInstall, VmChecksum, VmInstaller, VmKeyInjection)
are ALSO declared in the contract after #321, because the keepers and the generator cite
them - D-PAT-2 dup findings at six lines. The plugin deletes its copies and cites
schema.#<Name> instead; #Vm and #VmValue remain the only defs whose home is here.

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

* docs(vm): the header says what actually came, and what is cited

Round 1: my schema.-prefix sweep hit the header's own inventory, leaving it claiming seven
defs arrived while marking six schema.-prefixed - the six this leg deletes. The header now
says #Vm and the twin are the only defs here, and names the six as keepers this file cites.
The blank run the excision left is collapsed too.

No generated Go: this plugin generates nothing from its schema (no schemaparams/CandyParams
in its Go); the wire types are the contract's, generated there.

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

---------

Co-authored-by: aitrawog <[email protected]>
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