Repository navigation
refactor(ovmf): read the distro family from the distro vocabulary - #178
Conversation
The consumer leg of spec#61. ovmfDistroAliases parsed an `ovmf_distro_aliases:` directive out of the consumer's embedded charly.yml; it now reads spec.DistroOvmfFamilies, generated from #Distros[id].ovmf_family - the same vocabulary that already supplies each distro's format, ssh_unit and init. Three things follow. The hand-maintained table is gone. It lived in TWO byte-identical copies (charly's charly.yml and plugin-vm's build_defaults.yml) that had to be edited together, and editing only one was silent. Deleting those copies is the next leg; this is what makes them unread. A startup panic is gone with it. parseEmbeddedOvmfDistroAliases panicked when the directive was absent, so a consumer embedding a defaults file without it crashed rather than degrading - and degrading was the DESIGNED behaviour for an unknown distro (union the families). The generated table cannot be absent. cachyos gains a family it never had. The alias table predated the distro, so a CachyOS host fell through to the union. Preserved deliberately: an unlisted distro still has NO entry, which is what selects the all-families union rather than a wrong firmware layout. That is asserted, not assumed. The new tests also make the candidate path testable for the first time. It reaches ovmfPathTable, which needs the UnmarshalEmbeddedDefaults hook that is nil in a bare unit test, so the test supplies a minimal ovmf_paths fixture. Worth noting that hook used to be needed for BOTH halves of the lookup; only the path data depends on an embedded file now. 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: runtime/code change — OVMF firmware-family lookup refactor (SDK Security screen: PASS (no scope mismatch, no secrets/exfiltration, no weakened guardrails; the Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
UnmarshalEmbeddedDefaults still documented itself as decoding "the ovmf_paths / ovmf_distro_aliases directives the OVMF resolver reads". The resolver stopped reading ovmf_distro_aliases in the previous commit; the hook now covers the PATH data only. Found by actually running the R5 sweep rather than asserting it - the validator was right to demand executed output, and the executed sweep turned up a real stale reference the diff alone did not show.
Review — BLOCKHead SHA: Change class: runtime/code change — OVMF firmware-family lookup refactor (SDK Security screen: PASS (no scope mismatch, no secrets/exfiltration, no weakened guardrails; the Blocks
This finding was raised by the prior review comment and still reproduces against the CURRENT body (head Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff matches description), no secrets/exfiltration, no weakened guardrails; the Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
The consumer leg of
opencharly/spec#61.ovmfDistroAliasesparsed anovmf_distro_aliases:directive out of the consumer's embeddedcharly.yml. It now readsspec.DistroOvmfFamilies, generated from#Distros[id].ovmf_family—the same vocabulary that already supplies each distro's
format,ssh_unitandinit.Three things follow.
The hand-maintained table is gone. It lived in two byte-identical copies — charly's
charly.ymland plugin-vm's
build_defaults.yml— that had to be edited together, and editing only one wassilent. Deleting those copies is the next leg; this is what makes them unread.
A startup panic goes with it.
A consumer embedding a defaults file without that directive crashed — even though degrading was
the designed behaviour for an unknown distro (union the families). The generated table cannot be
absent, so the panic has nothing to guard.
cachyosgains a family it never had. The alias table predated the distro, so a CachyOS hostfell through to the union — and that is the host the cstream VM beds run on.
Preserved deliberately
An unlisted distro still has no entry, which is what selects the all-families union rather than
pinning it to a wrong firmware layout. Asserted, not assumed:
How tested
TestOvmfDistroAliasesComeFromTheDistroVocabularychecks every mapping the old table carriedsurvives, that the unknown-distro gap survives, and that
cachyosis new.TestOvmfCandidatesUseTheFamilygoes further and checks the mapping is actually consumed — afamily that resolves but selects no candidates would be worse than no entry:
cachyosandarchyield the same candidates, which is what sharing a family buys;really the union.
That test also makes the candidate path testable for the first time. It reaches
ovmfPathTable,which needs the
UnmarshalEmbeddedDefaultshook — nil in a bare unit test, so the first runsegfaulted. The test now supplies a minimal
ovmf_pathsfixture.Worth noting: that hook used to be needed for both halves of the lookup. Only the path data
depends on an embedded file now.
The R5 sweep, executed
The function is gone. But the sweep found something the diff did not:
hooks.gostilldocumented
UnmarshalEmbeddedDefaultsas decoding "the ovmf_paths / ovmf_distro_aliases directivesthe OVMF resolver reads" — false the moment the resolver stopped reading them. Fixed in commit
5502a43. After it:All three remaining hits are deliberate historical notes explaining what the code used to do, in the
past tense. No live reference survives.
The first revision of this body asserted this sweep without running it. The validator blocked that,
correctly — and running it is what caught the stale comment.
Rulebook compliance
/charly-internals:vm-spec(OVMF/VM internals) loaded before editing.UnmarshalEmbeddedDefaultshook is unset in a bare test) rather than worked around by deleting the test.
behaviour for an unknown distro.
diff alone did not show, now fixed in a follow-up commit.
git statuschecked; branch off freshmain; no force-push, no bypass.boot VMs need a hypervisor. Hence the capped tier.
cachyosis absent, and the panic path is hit).Change classification
analysed on a live system— the lookup is exercised against the realgenerated table, but no VM was booted to confirm the firmware resolves on a CachyOS host.
Not covered — the two deletions this unblocks
charly— removeovmf_distro_aliases:fromcharly.yml.plugin-vm— remove it frombuild_defaults.yml, and updatebuild_defaults_keys_test.go, which currently asserts the key is present and decodes non-empty.Both are now dead data: nothing reads them after this. They are separate repos, so they cannot be
deleted in this commit.
Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)