Repository navigation
fix(distro): ResolveInherits dropped four fields on every derived distro - #79
Conversation
ResolveInherits is a hand-written struct literal — twice, once per
branch — and it forgot DiskLayout, Installer, InheritPackages and Raw.
Any distro declaring `inherits:` arrived at its consumer with all four
nil, and the consumer took its default path. No error, anywhere.
What that broke, all of it already merged and green:
- the BTRFS SUBVOLUME FEATURE did nothing for any distro with a
parent — which is every derivative, the case it was built for.
#DiskLayout/#Subvolume (#72), plugin-vm's EmitDiskBuildScript arm
(#6, #7) and charly's omarchy layout (#476) are all inert without
this.
- source.kind: iso could not resolve an installer for a derived
distro. `charly vm build` reports "declares no installer" against a
distro that plainly declares one — how this was found.
- inherit_packages, the switch the whole distro TAG CHAIN rests on,
was dropped from the resolved value, so a consumer reading it after
resolution saw false.
- Raw, the authored body consumers fall back to for anything this
projection does not model, became empty for any distro with a
parent — turning "not modelled" into "not present".
DiskLayout and Installer INHERIT, like every other optional sub-block:
a derivative adding only an installer (an Arch spin reusing archinstall)
must not have to restate its parent's whole boot chain. A child's own
value still wins.
InheritPackages and Raw are taken from the CHILD, never the parent:
inherit_packages says "expand MY tag chain through my parent", which is
a statement about this node, and Raw is this node's authored body.
Four tests. The parity pair walks every exported field of
ResolvedDistro and fails on any that arrives zero, so a future spec
addition cannot be forgotten here silently. There is one per BRANCH
deliberately: ResolveInherits has two merged literals, selected by
whether the child declares its own bootstrap, and a fix applied to only
one of them passes the other test while breaking every child that omits
bootstrap. A negative control confirms exactly that.
Negative controls, both run:
restore the drop in both literals:
ResolveInherits dropped 4 field(s) the child declared:
[DiskLayout InheritPackages Installer Raw] (both branches)
fix only the first literal:
Note this is the SECOND merged literal — a fix applied only to the
first one passes the other parity test and still breaks every child
that omits bootstrap.
Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
Review — PASSHead SHA: Security screen: PASS — no secrets, no exfiltration, no scope mismatch (diff does exactly what the body claims), no weakened guardrails, no supply-chain changes, no embedded directives. Checklist: All applicable rules PASS or NA.
The four-field fix is applied to BOTH merged literals (child-with-bootstrap and child-without), with correct inheritance semantics (DiskLayout/Installer inherit with child-override; InheritPackages/Raw from child only), and the parity tests cover both branches plus the semantic cases. No comments on the thread to adjudicate. Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no secrets, no exfiltration, no scope mismatch (diff does exactly what the body claims: four dropped fields fixed in both merged literals + regression tests), no weakened guardrails, no supply-chain changes, no embedded directives. Checklist: All applicable rules PASS or NA.
The four-field fix is applied to BOTH merged literals (child-with-bootstrap and child-without), with correct inheritance semantics (DiskLayout/Installer inherit with child-override; InheritPackages/Raw from child only), and the parity tests cover both branches plus the semantic cases. The single prior comment (a PASS) was independently re-derived and confirmed — no blocking issues. Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
ResolveInheritsis a hand-written struct literal — twice, once per branch — and itforgot four fields:
DiskLayout,Installer,InheritPackagesandRaw.Any distro declaring
inherits:arrived at its consumer with all fournil, and theconsumer took its default path. No error, anywhere.
What this broke — all of it already merged and green
#DiskLayout/#Subvolume), plugin-vm#6, plugin-vm#7, charly#476source.kind: isocannot resolve an installer for a derived distro —charly vm buildreports "declares no installer" against a distro that plainly declares oneinherit_packages— the switch the whole distro tag chain rests on — dropped from the resolved value, so a consumer reading it post-resolution seesfalseRaw, the authored body consumers fall back to for anything this projection does not model, became empty for any distro with a parent — turning "not modelled" into "not present"RawconsumerFound by running a real
charly vm buildagainst an authoredomarchy-vm, not by reading.Every gate in the chain was green throughout.
Inheritance semantics, stated deliberately
DiskLayoutandInstallerinherit, like every other optional sub-block alreadyhandled a few lines above (
BaseUser,Pacstrap,Debootstrap,AlpineBootstrap,Bootloader,Dnf). A derivative that adds only an installer — an Arch spin reusingarchinstall — must not have to restate its parent's whole boot chain. A child's own value
still wins.
InheritPackagesandRawcome from the CHILD, never the parent.inherit_packagessays "expand MY tag chain through my parent", which is a statement about this node, not
something to inherit.
Rawis this node's authored body.Why this is the second fix of the same shape today
plugin-distro'sresolveDistrodrops the same two new fields, for the same reason —a hand-written copy of a struct that grew (opencharly/plugin-distro#6). Fixing only that one
would not have helped:
omarchydeclaresinherits: arch, so the fields survivedresolveDistroand were then dropped here, one layer down. Two hand-written copies, tworepos, one class of defect.
That is why both fixes ship with a field-walking parity guard rather than just the
missing lines.
How tested
Four new tests. The parity pair walks every exported field of
ResolvedDistroand failson any that arrives zero, so a future spec addition cannot be silently forgotten here.
There is one per BRANCH, deliberately.
ResolveInheritshas two merged literals,selected by whether the child declares its own
bootstrap. A fix applied to only one ofthem passes the other test while breaking every child that omits bootstrap — so the second
test asserts it is exercising that branch before checking anything.
Negative control 1 — restore the drop in both literals (i.e.
mainas it stands):Both branches, four fields each — the shipped defect reproduced exactly.
Negative control 2 — fix ONLY the first literal (the natural half-fix):
The two remaining tests cover the semantics rather than the plumbing: a child with no
disk_layout/installerinherits the parent's intact, and a child that declares itsown overrides — the direction that would be worse to get wrong, because it silently
ignores what the author wrote.
Full suite,
-count=1, complete output (32 packages;okfor all 18 with tests, therest
no test files):go build ./...,go vet ./...andgofmt -l .all clean. Notask cue:genwasneeded — this is a Go projection fix; no
.cuefile changed and no generated type moved.The guard also proved itself against my own fixture while it was being written: it
rejected
FormatDef,AlpineBootstrap.BranchandDnf.InstallCmd, none of which exist.A guard that had compiled against a wrong fixture would have proven nothing.
Rulebook compliance
vm buildfailure was chased through two layers ratherthan patched at the first one that would have made the symptom go away. Fixing only
plugin-distrowould have left this drop in place and the subvolume feature still inert.resolution path was added.
Rawto route around theresolver, no defaulting at the point of use.
recurring on the next field.
-count=1suite pasted above from the committed tree, plustwo negative controls.
trees restored from a backup; every result above is from the committed state.
Change classification
go test -count=1 ./...(full suite), plus two negative controls — one reproducing the shipped defect, one catching the half-fixfully tested and validated— the changed path executes live in the tests, the defect was originally observed live viacharly vm build, and both guards were shown to fail on the unfixed codeUnblocks plugin-vm#8 (
source.kind: iso) together with plugin-distro#6, and re-activatesthe subvolume feature that #72 / plugin-vm#6 / plugin-vm#7 / charly#476 shipped inert.
Assisted-by: Claude Code claude-opus-4-6-20260401 (fully tested and validated)