Skip to content

feat(distro): ovmf_family becomes a distro trait - #61

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/distro-ovmf-family
Aug 28, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/distro-ovmf-family

Conversation

@atrawog

@atrawog atrawog commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

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 two
byte-identical copies
— charly/charly.yml and plugin-vm/candy/plugin-vm/build_defaults.yml:

$ diff <(sed -n '144,153p' charly/charly/charly.yml) \
       <(sed -n '42,51p' plugin-vm/candy/plugin-vm/build_defaults.yml)
BYTE-IDENTICAL

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, because the absence is meaningful

An id with no family keeps today's behaviour: 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 — an unproven family is worse than the fallback.

Generating an optional trait needed distroTrait to take a required bool. The first version of
this PR added a separate distroTraitOptional — a near-verbatim copy differing only in the
missing-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_unit and init are declared by every id, so a missing one is a vocabulary bug and must fail
generation. The non-empty guard moves under required for the same reason — only a required trait
proves #Distros was populated at all.

Two corrections that 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 — and that 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.
var DistroOvmfFamilies = map[string]string{
	"almalinux": "fedora", "arch": "arch", "cachyos": "arch", "centos": "fedora",
	"debian": "debian", "endeavouros": "arch", "fedora": "fedora", "manjaro": "arch",
	"rhel": "fedora", "rocky": "fedora", "ubuntu": "debian",
}

How tested

$ task cue:gen      # SDD; reproducible, second run is a no-op
$ go test ./...     18 packages ok, 0 failures
$ golangci-lint run 0 issues.

TestDistroOvmfFamilies asserts more than the mapping:

  • every family carried over from the old table is unchanged;
  • archarm and alpine are absent, so the fallback is preserved rather than accidentally
    narrowed;
  • every value is a family the OVMF path table knows;
  • every key is a real #DistroID — the assertion that makes a second dead alma-style row
    impossible, rather than just removing this one.

Rulebook compliance

  • R0 — /charly-internals:vm-spec (OVMF/VM internals) and /charly-image:layer loaded before
    editing.
  • R1 — the alma/almalinux divergence was investigated rather than copied forward; it is a
    dead row, not a distro charly supports under another name.
  • R2 — nothing deferred; the consumer deletions are separate repos, sequenced below.
  • R3 — this is the R3 fix: two byte-identical copies collapse into one generated table. It also
    applies to the generator itself: the first revision duplicated distroTrait, the validator caught
    it, and the two collectors are now one. Generated output is byte-identical after that refactor,
    which is what makes it a refactor.
  • R4 — no workaround: the fallback is preserved by omitting a value rather than inventing one.
  • R5 — the two YAML copies are deleted in the consumer legs; this PR cannot delete them, as they
    live in other repos and must keep working until they read the new table.
  • R6 — git status checked; branch off fresh main; no force-push, no bypass.
  • R7/R10 — N/A for a vocabulary leg with no runtime path of its own; the consumers own that gate.
  • R8 — the emitted artifact is the generated Go, asserted by regeneration being a no-op.
  • B12 — the table did not exist before, so every assertion in the new test fails without this
    change (it does not compile).
  • B13 — SDD honoured: CUE first, task cue:gen, no hand-edited generated Go.
  • B16 — no pin moved.

Change classification

  • Class: schema/vocabulary change (CUE) + generator + generated Go.
  • Verification gate: reproducible cue:gen + module suite + lint.
  • Attribution tier: analysed on a live system — the table is generated and asserted, but no
    OVMF lookup reads it until the consumer legs land.

Not covered — the consumer legs

  1. charly — delete ovmf_distro_aliases: from charly.yml and the
    parseEmbeddedOvmfDistroAliases panic path.
  2. plugin-vm — delete the copy from build_defaults.yml and read spec.DistroOvmfFamilies.

Until both land, the old copies remain authoritative, which is why this PR claims no behaviour
change. Deleting them is where the cachyos and alma corrections actually take effect.

Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)

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
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 9c8f4bfc11f8a41c72050d7dc5f9379ff65c32bf

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 cachyos/alma corrections are disclosed transparently and take effect only in the named consumer legs.

Blocks

  1. B7 / R3 — duplication. internal/schemagen/main.go adds distroTraitOptional, which is a near-verbatim copy of the existing distroTrait — identical lookup, iteration, id-unquoting, and string-extraction, differing only in the missing-field branch (continue vs error). This is a copy-pasted block that should have been shared. Unify them into a single function with a required bool parameter (e.g. if !v.Exists() { if required { return nil, fmt.Errorf(...) }; continue }), and call it for all four traits. The two ~20-line near-duplicates in the same file are exactly the R3 pattern the rulebook names as a BLOCK.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

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.
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 20564b4fa7db3fff02072a16f8b5ead855a94023 (branch: feat/distro-ovmf-family)

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 cachyos/alma corrections are disclosed transparently and take effect only in the named consumer legs.

Blocks

  1. A1 / rule 4 — body↔diff contradiction. The body's "Optional, because the absence is meaningful" section states: "Generating an optional trait needed a tolerant collector, distroTraitOptional, since distroTrait errors on a missing field." The CURRENT diff (commit 20564b4 "refactor(schemagen): one distroTrait collector, required or optional") no longer contains any distroTraitOptional — the collector was unified into a single distroTrait(schema cue.Value, field string, required bool) with a required parameter (if !v.Exists() && !required { continue }). The body describes a mechanism that does not exist in the current code. Update the body to describe the unified distroTrait with the required bool parameter (and note the prior duplication was resolved), so the description matches the shipped diff.

Comment intake

  • github-actions[bot] (5455999083) — stale-superseded. Its BLOCK was the distroTraitOptional/distroTrait duplication (R3). The current diff resolves that by unifying into a single distroTrait with a required bool param — the duplication is gone. However, the body's lingering reference to distroTraitOptional is now the body↔diff contradiction in Block 1.

Notes (non-blocking)

  • The new TestDistroOvmfFamilies is internally consistent with the generated DistroOvmfFamilies map (all 11 keys are real #DistroIDs, values are valid families, archarm/alpine absent, alma dead key removed) and would fail without the change.
  • Placement is CORRECT: the trait belongs in the spec CUE schema, generated into spec/; no alias files, no new core imports.
  • Attribution tier analysed on a live system is honest and not inflated.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 20564b4fa7db3fff02072a16f8b5ead855a94023 (branch: feat/distro-ovmf-family)

Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives. The cachyos/alma corrections are disclosed transparently and take effect only in the named consumer legs.

Checklist: All applicable rules PASS or NA.

Comment intake:

  • github-actions[bot] (5455999083) — stale-superseded. Its R3 duplication BLOCK on distroTraitOptional is resolved: the current diff unifies into a single distroTrait(schema, field, required bool).
  • github-actions[bot] (5456053992) — stale-superseded. Its body↔diff contradiction BLOCK is resolved: the current body now describes the unified distroTrait with the required bool parameter and notes the prior duplication was fixed, matching the shipped diff.

Placement: CORRECT — the trait belongs in the spec CUE schema, generated into spec/; no alias files, no new core imports. SDD honored (CUE-first, task cue:gen, no hand-edited generated Go). Attribution tier analysed on a live system is honest and not inflated. The new TestDistroOvmfFamilies is internally consistent with the generated map and would fail without the change.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 28, 2026 18:12
@github-actions
github-actions Bot merged commit 6754bf4 into main Aug 28, 2026
1 of 2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 28, 2026
@aitrawog
aitrawog deleted the feat/distro-ovmf-family branch September 25, 2026 19:09
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