Repository navigation
feat(distro): #DiskLayout — per-distro ESP mount point and btrfs subvolumes - #72
Merged
Merged
Conversation
…olumes
A distro whose on-disk shape is part of its identity had no way to say so.
#Distro could describe its bootloader, its bootstrap and its packages, but
the disk a bootstrap VM is built on was fixed: a bare root filesystem with
the ESP at /boot/efi.
Omarchy needs both halves changed, and neither is cosmetic:
- Its ESP mounts at /boot, not /boot/efi. That is what limine-entry-tool
and ESP_PATH assume, and a loader written to the other path leaves an
unbootable disk while the build reports success.
- Its root is a @/@home/@log/@pkg subvolume set on every install, and its
fstab and limine cmdline reference subvol=@. A VM built on a bare btrfs
filesystem can never be snapshotted and is not the distro it claims.
Add #DiskLayout{esp_mount_point?, subvolume?} and #Subvolume{name,
mount_point, mount_options?}, reachable as disk_layout? on both #Distro and
#ResolvedDistro, and regenerate the Go types.
Both fields are optional and both default to charly's previous behaviour,
so every distro that omits the block builds exactly the disk it built
before. No #SchemaVersion bump: this is a purely additive optional field
with nothing to migrate, the same shape as the recent `iso` VmSource arm.
The "exactly one subvolume mounts at /" rule is left to OpValidate rather
than CUE -- "exactly one element of this list has field X = Y" is not
expressible in a closed struct -- and is already enforced by
EmitDiskBuildScript in plugin-vm.
Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff matches description exactly: schema defs, regenerated Go, tests), no secrets/network/egress, no weakened guardrails, no new deps, no self-modifying security content. Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
This was referenced Aug 30, 2026
Merged
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 30, 2026
…tro (#79) 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 Co-authored-by: atrawog <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A distro whose on-disk shape is part of its identity had no way to say so.
#Distrocould describe its bootloader, its bootstrap and its packages, but the disk a bootstrap VM
is built on was fixed: a bare root filesystem with the ESP at
/boot/efi.Omarchy needs both halves changed, and neither is cosmetic:
/boot, not/boot/efi— that is whatlimine-entry-toolandESP_PATHassume. A loader written to the other path leaves an unbootable disk whilethe build reports success.
@/@home/@log/@pkgsubvolume set on every install, and itsfstaband limine cmdline referencesubvol=@. A VM built on a bare btrfs filesystemcan never be snapshotted, and is not the distro it claims to be.
Both were read off a real ISO-installed Omarchy 4.0.1 guest, not from documentation.
Every file in the diff
schema/distro.cue#DiskLayout+#Subvolumedefs;disk_layout?on both#Distroand#ResolvedDistrospec/cue_types_gen.gotask cue:gen— never hand-editedschema/distro_disk_layout_test.goWhy no
#SchemaVersionbumpEvery bump recorded in
version.cueis an authored wire-key change or removal thatneeds a migration. This is a purely additive optional field: no existing manifest
changes shape, and there is nothing to migrate. The same reasoning applied to the
iso#VmSourcearm added in #71, which also did not bump it.What is deliberately NOT in CUE
The rule "exactly one subvolume mounts at
/" is left toOpValidate. "Exactly oneelement of this list has field X = Y" is not expressible in a closed struct, and pretending
otherwise with a
matchNwould disable closedness — which is what catches the typo casebelow. It is already enforced in
plugin-vm'sEmitDiskBuildScript, which refuses alayout with zero or two roots.
How tested
The corpus case is the exact Omarchy layout this def exists to express. The teeth
are the six ways to declare a layout that would build a disk nobody can boot:
esp_mount_point: "boot"subvolume: [{name: "", …}]mount_point: "home"mount_pointnameesp_path: "/boot"TestDiskLayout_ReachableFromDistroasserts the field exists on both#Distroand#ResolvedDistro— a def that validates beautifully but is unreachable from the type theresolver actually returns would be useless, and the
Fields(cue.Optional(true))iteratoris used because
LookupPathdoes not return optional fields (the first version of thattest failed for exactly that reason).
spec/cue_types_gen.gois the output oftask cue:gen, run after the schema edit, not ahand transcription.
Rulebook compliance
/charly-internals:git-workflow; the existing#Bootloader/#Pacstrapshapes were read before a sibling def was added.TestDiskLayout_ReachableFromDistrofailed on first run — CUE'sLookupPathdoes notreturn optional fields; fixed with the
Fields(cue.Optional(true))iterator ratherthan by making the field required. (b)
spec/procandspec/containerfailed in thefirst full run. Neither is caused by this change and neither is waved away:
spec/proc'sown message says the checkout was under
/tmp, so "this checkout cannot host thepremise of the $TMPDIR tests … they would pass without discriminating" — verified
identical on a stashed clean tree, then re-run from a checkout outside
/tmp.tests land together.
description of a disk layout anywhere.
consumer supplies the historical defaults, so the schema states shape and the emitter
states behaviour.
N/A — purely additive; no field, key or code path is removed or replaced.main, PR-only,no force-push, no direct push to
main, no hook bypass.schema via
schemaconcat.ConcatSchema(schema.FS, …)— the same bytes charly loads — andassert both acceptance and rejection. The behaviour this schema enables is proven end to
end in
opencharly/plugin-vm#6, where the emitted script was executed against real loopdevices.
task cue:genfrom this worktree; tests-count=1.N/A — a schema repo has no bed. Its gate is the corpus-and-teeth suite, run on the final tree.defaults, the reachability, the closedness, and each rejection.
measured on a real Omarchy guest, and the emitter that consumes it was proven live before
this schema was written.
task cue:gensecond, no hand-written wire type.
N/A — no roster.Change classification
own.
go test -count=1 ./schema/...(corpus + teeth, all pass) and thefull
specsuite from a checkout outside/tmp.shipped schema in both directions, and its consumer was proven live in plugin-vm#6.
Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)