Repository navigation
feat(distro): ovmf_family becomes a distro trait - #61
Conversation
The second item of batch B4, and the producer leg for it.
The OVMF firmware family was a hand-maintained `ovmf_distro_aliases:` map kept in
TWO byte-identical copies - charly/charly.yml and
plugin-vm/candy/plugin-vm/build_defaults.yml. Verified identical, line for line.
Every new distro had to be added to both, and adding it to only one was silent.
It is a property of the distro exactly like format, ssh_unit and init, so it
becomes the fourth #DistroTrait field and generates into spec.DistroOvmfFamilies
beside DistroFormats / DistroSSHUnits / DistroInits.
OPTIONAL, deliberately. The ABSENCE is meaningful: an id with no family keeps
today's behaviour, where ovmfCandidatesForDistro tries the union of all families
and the not-found error emits the generic install hint. archarm (aarch64 firmware
paths differ) and alpine stay unset, as they were before - an unproven family
would be worse than the fallback. Generating that required a tolerant collector,
distroTraitOptional, since distroTrait errors on a missing field.
Two corrections fall out of keying by real distro ids:
- cachyos gains a family it never had. The alias table predated the distro, so a
CachyOS host fell through to the union - which is exactly the host the cstream
VM beds run on.
- "alma" is gone. It was never a #DistroID (the id is almalinux), so that row
could not match a validated distro: a dead entry that read like coverage. The
test asserts every key IS a #DistroID so a second one cannot appear.
The two YAML copies are deleted in the consumer legs (charly, plugin-vm), which
follow this tag.
Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq
Review — BLOCKHead SHA: Change class: schema/vocabulary change (CUE) + generator + generated Go + test. Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives. The Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
distroTraitOptional was a near-verbatim copy of distroTrait - same lookup, same iteration, same id-unquoting, same string extraction - differing only in whether a missing field errors or is skipped. That is the R3 pattern, and copying twenty lines to change one branch is exactly what it forbids. Unified into distroTrait(schema, field, required). All four traits call it. The parameter carries a real distinction rather than a flag for its own sake: format, ssh_unit and init are declared by EVERY id, so a missing one is a vocabulary bug and must fail generation. ovmf_family is optional and its ABSENCE is meaningful - an id with no family stays on the all-families OVMF fallback instead of being pinned to a layout nobody verified - so erroring there would force a guess for archarm and alpine. The non-empty guard moves under `required` for the same reason: only a required trait proves #Distros was populated at all, and an optional one may legitimately be empty. Generated output is unchanged - vocab_gen.go is byte-identical after regeneration, which is what makes this a refactor rather than a behaviour change. Caught by the pr-validator.
Review — BLOCKHead SHA: Change class: schema/vocabulary change (CUE) + generator + generated Go + test. Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives. The Blocks
Comment intake
Notes (non-blocking)
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives. The Checklist: All applicable rules PASS or NA. Comment intake:
Placement: CORRECT — the trait belongs in the spec CUE schema, generated into Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
The second item of batch B4, and its producer leg.
The OVMF firmware family was a hand-maintained
ovmf_distro_aliases:map kept in twobyte-identical copies —
charly/charly.ymlandplugin-vm/candy/plugin-vm/build_defaults.yml:Every new distro had to be added to both, and adding it to only one was silent.
It is a property of the distro exactly like
format,ssh_unitandinit, so it becomes the fourth#DistroTraitfield and generates intospec.DistroOvmfFamiliesbesideDistroFormats/DistroSSHUnits/DistroInits.Optional, because the absence is meaningful
An id with no family keeps today's behaviour:
ovmfCandidatesForDistrotries the union of allfamilies and the not-found error emits the generic install hint.
archarm(aarch64 firmware pathsdiffer) and
alpinestay unset, as they were — an unproven family is worse than the fallback.Generating an optional trait needed
distroTraitto take arequired bool. The first version ofthis PR added a separate
distroTraitOptional— a near-verbatim copy differing only in themissing-field branch. The validator blocked it as R3 duplication, correctly, and the two are now one
function.
The parameter carries a real distinction rather than being a flag for its own sake:
format,ssh_unitandinitare declared by every id, so a missing one is a vocabulary bug and must failgeneration. The non-empty guard moves under
requiredfor the same reason — only a required traitproves
#Distroswas populated at all.Two corrections that fall out of keying by real distro ids
cachyosgains a family it never had. The alias table predated the distro, so a CachyOS hostfell through to the union — and that is exactly the host the cstream VM beds run on.
almais gone. It was never a#DistroID(the id isalmalinux), so that row could not matcha validated distro: a dead entry that read like coverage.
How tested
TestDistroOvmfFamiliesasserts more than the mapping:archarmandalpineare absent, so the fallback is preserved rather than accidentallynarrowed;
#DistroID— the assertion that makes a second deadalma-style rowimpossible, rather than just removing this one.
Rulebook compliance
/charly-internals:vm-spec(OVMF/VM internals) and/charly-image:layerloaded beforeediting.
alma/almalinuxdivergence was investigated rather than copied forward; it is adead row, not a distro charly supports under another name.
applies to the generator itself: the first revision duplicated
distroTrait, the validator caughtit, and the two collectors are now one. Generated output is byte-identical after that refactor,
which is what makes it a refactor.
live in other repos and must keep working until they read the new table.
git statuschecked; branch off freshmain; no force-push, no bypass.change (it does not compile).
task cue:gen, no hand-edited generated Go.Change classification
cue:gen+ module suite + lint.analysed on a live system— the table is generated and asserted, but noOVMF lookup reads it until the consumer legs land.
Not covered — the consumer legs
charly— deleteovmf_distro_aliases:fromcharly.ymland theparseEmbeddedOvmfDistroAliasespanic path.plugin-vm— delete the copy frombuild_defaults.ymland readspec.DistroOvmfFamilies.Until both land, the old copies remain authoritative, which is why this PR claims no behaviour
change. Deleting them is where the
cachyosandalmacorrections actually take effect.Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)