Skip to content

fix(distro): ResolveInherits dropped four fields on every derived distro - #79

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/resolve-inherits-drops-fields
Aug 30, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/resolve-inherits-drops-fields

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

ResolveInherits is a hand-written struct literal — twice, once per branch — and it
forgot four fields: 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 this broke — all of it already merged and green

Consequence Shipped in
The btrfs subvolume feature does nothing for any distro with a parent — which is every derivative, the case it was built for #72 (#DiskLayout/#Subvolume), plugin-vm#6, plugin-vm#7, charly#476
source.kind: iso cannot 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 — dropped from the resolved value, so a consumer reading it post-resolution sees false the omarchy tag-chain design
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" every Raw consumer

Found by running a real charly vm build against an authored omarchy-vm, not by reading.
Every gate in the chain was green throughout.

Inheritance semantics, stated deliberately

  • DiskLayout and Installer inherit, like every other optional sub-block already
    handled a few lines above (BaseUser, Pacstrap, Debootstrap, AlpineBootstrap,
    Bootloader, Dnf). A derivative that adds 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 come from the CHILD, never the parent. inherit_packages
    says "expand MY tag chain through my parent", which is a statement about this node, not
    something to inherit. Raw is this node's authored body.

Why this is the second fix of the same shape today

plugin-distro's resolveDistro drops 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: omarchy declares inherits: arch, so the fields survived
resolveDistro and were then dropped here, one layer down. Two hand-written copies, two
repos, 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 ResolvedDistro and fails
on any that arrives zero, so a future spec addition cannot be silently forgotten here.

There is one per BRANCH, deliberately. ResolveInherits has two merged literals,
selected by whether the child declares its own bootstrap. A fix applied to only one of
them passes the other test while breaking every child that omits bootstrap — so the second
test asserts it is exercising that branch before checking anything.

$ go test -count=1 ./spec/ -run 'ResolveInherits_'
ok  	github.com/opencharly/spec/spec	0.003s

Negative control 1 — restore the drop in both literals (i.e. main as it stands):

--- FAIL: TestResolveInherits_CarriesEveryField (0.00s)
    distro_resolve_inherits_parity_test.go:72: ResolveInherits dropped 4 field(s) the
      child declared: [DiskLayout InheritPackages Installer Raw]
--- FAIL: TestResolveInherits_CarriesEveryField_InheritedBootstrapBranch (0.00s)
    distro_resolve_inherits_parity_test.go:129: ResolveInherits (inherited-bootstrap
      branch) dropped 4 field(s): [DiskLayout InheritPackages Installer Raw]

Both branches, four fields each — the shipped defect reproduced exactly.

Negative control 2 — fix ONLY the first literal (the natural half-fix):

--- FAIL: TestResolveInherits_CarriesEveryField_InheritedBootstrapBranch (0.00s)
    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.

The two remaining tests cover the semantics rather than the plumbing: a child with no
disk_layout/installer inherits the parent's intact, and a child that declares its
own 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; ok for all 18 with tests, the
rest no test files):

$ go test -count=1 ./...
ok  	github.com/opencharly/spec/climodel	0.017s
ok  	github.com/opencharly/spec/container	7.000s
ok  	github.com/opencharly/spec/exec	7.982s
ok  	github.com/opencharly/spec/exitcode	0.002s
ok  	github.com/opencharly/spec/fleet	0.005s
ok  	github.com/opencharly/spec/hostenv	0.008s
ok  	github.com/opencharly/spec/internal/wiregen	0.020s
ok  	github.com/opencharly/spec/lock	0.207s
ok  	github.com/opencharly/spec/matchers	0.005s
ok  	github.com/opencharly/spec/merge	0.005s
ok  	github.com/opencharly/spec/ops	0.008s
ok  	github.com/opencharly/spec/phase	0.006s
ok  	github.com/opencharly/spec/poll	0.227s
ok  	github.com/opencharly/spec/proc	1.299s
ok  	github.com/opencharly/spec/refs	8.356s
ok  	github.com/opencharly/spec/schema	1.006s
ok  	github.com/opencharly/spec/spec	0.316s
ok  	github.com/opencharly/spec/transport	0.187s

go build ./..., go vet ./... and gofmt -l . all clean. No task cue:gen was
needed
— this is a Go projection fix; no .cue file changed and no generated type moved.

The guard also proved itself against my own fixture while it was being written: it
rejected FormatDef, AlpineBootstrap.Branch and Dnf.InstallCmd, none of which exist.
A guard that had compiled against a wrong fixture would have proven nothing.

Rulebook compliance

  • R1 — RCA every anomaly. The vm build failure was chased through two layers rather
    than patched at the first one that would have made the symptom go away. Fixing only
    plugin-distro would have left this drop in place and the subvolume feature still inert.
  • R3 — no duplication. The fix is inside the single existing projection; no parallel
    resolution path was added.
  • R4 — no workarounds. No consumer-side re-reading of Raw to route around the
    resolver, no defaulting at the point of use.
  • R5 — delete legacy completely. Nothing to delete; the guards are what stop the pattern
    recurring on the next field.
  • R7 — prove the gate. Full -count=1 suite pasted above from the committed tree, plus
    two negative controls.
  • R10 — fresh disposable proof. Both negative controls ran against deliberately reverted
    trees restored from a backup; every result above is from the committed state.

Change classification

Change class bug fix (four dropped fields, in two struct literals) + two regression guards over the inherit-resolution seam
Verification gate go test -count=1 ./... (full suite), plus two negative controls — one reproducing the shipped defect, one catching the half-fix
Attribution tier fully tested and validated — the changed path executes live in the tests, the defect was originally observed live via charly vm build, and both guards were shown to fail on the unfixed code

Unblocks plugin-vm#8 (source.kind: iso) together with plugin-distro#6, and re-activates
the 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)

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

Copy link
Copy Markdown

Review — PASS

Head SHA: db095e41d42d107ab8bbc7e63acb06020e037c82 (branch: fix/distro-resolve-inherits-dropped-fields)

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.

  • A1/A2/A3 — Body accounts for both changed files, names the exact gate (go test -count=1 ./... + two negative controls), pastes full output, and the fully tested and validated tier is justified: the changed ResolveInherits path executes live in the tests, and both negative controls prove the guards fail on the unfixed code. Attribution footer present in exact form.
  • B5/R1 — RCA given (hand-written struct literal not tracking the growing struct); no warnings in output.
  • B6/R2 — No parking phrases; the cross-repo parallel fix (plugin-distro#6) is named, not deferred.
  • B7/R3, B8/R4 — Fix inside the single existing projection; no workarounds, no duplication.
  • B12/R10 — Full -count=1 suite pasted, internally consistent; the change ships regression guards that provably fail without the fix (negative controls shown).
  • B13/SDD — No .cue/*_gen.go/*.proto changed; body correctly states cue:gen not needed. N/A.
  • B15 — Single atomic commit.
  • B16/Architecture — placement: CORRECT. Bug fix in the existing ResolveInherits projection; no new imports, no alias files, no layer movement.
  • B18 — Diff is gofmt-clean; no dead code/lint issues visible.
  • B17, B11, B10, B9, B14 — N/A for this change class (Go library bug fix; no target deployment, no docs, no concurrency, no removed identifiers).

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.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 7b67330bd6c62850ca3cbc2509561fd6eed00934 (branch: fix/distro-resolve-inherits-dropped-fields)

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.

  • A1/A2/A3 — Body accounts for both changed files, names the exact gate (go test -count=1 ./... + two negative controls), pastes full output, and fully tested and validated is justified: the changed ResolveInherits path executes live in the tests, and both negative controls prove the guards fail on the unfixed code. Attribution footer present in exact form.
  • B5/R1 — RCA given (hand-written struct literal not tracking the growing struct); no warnings in output.
  • B6/R2 — No parking phrases; the cross-repo parallel fix (plugin-distro#6) is named, not deferred.
  • B7/R3, B8/R4 — Fix inside the single existing projection; no workarounds, no duplication.
  • B12/R10 — Full -count=1 suite pasted and internally consistent (18 ok packages matching the stated "32 packages, 18 with tests"); negative control 1 reproduces exactly the 4 dropped fields [DiskLayout InheritPackages Installer Raw], negative control 2 catches the half-fix. The change ships regression guards that provably fail without the fix.
  • B13/SDD — No .cue/*_gen.go/*.proto changed; body correctly states cue:gen not needed. N/A.
  • B15 — Single atomic change commit (db095e4) plus a main-merge; no partial/split work.
  • B16/Architecture — placement: CORRECT. Bug fix in the existing ResolveInherits projection; no new imports, no alias files, no layer movement.
  • B18 — Diff is gofmt-clean; no dead code/lint issues visible.

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.

View action run

@github-actions
github-actions Bot merged commit 2f228f3 into main Aug 30, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
@aitrawog
aitrawog deleted the fix/resolve-inherits-drops-fields branch September 25, 2026 19:10
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