Skip to content

fix(schema): #DistroInput had drifted behind spec's #Distro - #4

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/distro-input-disk-layout-and-installer
Aug 30, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/distro-input-disk-layout-and-installer

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

This plugin serves kind: distro and validates an authored distro: body against its
own self-contained #DistroInput before dispatching. That duplication is sanctioned —
the plugin schema must compile standalone while spec's #Distro must generate Go — but it
means the two can drift, and when they do the failure is actively misleading: charly's
core accepts a field and this plugin rejects it with

#DistroInput.disk_layout: field not allowed

which reads like the field does not exist anywhere.

Two fields were missing:

Field Added to spec in Consequence of the gap
installer spec#71 already drifted — an authored installer: block has been rejected here since that landed
disk_layout spec#72 surfaced this: a charly build carrying an omarchy distro entity failed to validate

Every file in the diff

File What changed
candy/plugin-distro/schema/distro.cue #DsDiskLayout, #DsSubvolume, #DsInstaller, #DsInstallerFile added; disk_layout? and installer? wired into #DistroInput
candy/plugin-distro/schema_parity_test.go new — the drift guard and a dangling-reference guard

How this stops recurring

The parity test compares #DistroInput's top-level field set against the set spec's
#Distro authorises, so the next omission fails here, next to the fix rather than in a
consumer's build log.

Inner defs are deliberately not compared: they differ in name (#DsBootloader vs
#Bootloader) and carry no @go annotations, so comparing them would be noise. What
matters is that every field a distro entity can author is authorable here.

The want list is a literal rather than something read from the spec module. Importing
spec to check the standalone schema would defeat the property being checked — this def
exists precisely so the plugin compiles without it.

How tested

$ go test -count=1 ./...
ok  	github.com/opencharly/plugin-distro/candy/plugin-distro	0.005s
?   	github.com/opencharly/plugin-distro/candy/plugin-distro/cmd/serve	[no test files]
?   	github.com/opencharly/plugin-distro/candy/plugin-distro/params	[no test files]

The guard was verified to discriminate, not merely to pass. Deleting the disk_layout
line reproduces the exact failure this PR fixes, with a readable diff:

$ python3 -c "…remove the disk_layout line…"
$ go test -count=1 -run TestDistroInputCovers ./...
--- FAIL: TestDistroInputCoversEverySpecDistroField (0.00s)
    schema_parity_test.go:44: #DistroInput fields drifted from spec's #Distro.
         got: [alpine_bootstrap base_user bootloader bootstrap debootstrap dnf format inherit_packages inherits installer pacstrap version workaround]
        want: [alpine_bootstrap base_user bootloader bootstrap debootstrap disk_layout dnf format inherit_packages inherits installer pacstrap version workaround]

The line was then restored and the suite re-run green. A test that cannot fail is not a
gate, and this one was made to fail on purpose before being trusted.

The originating symptom is also reproducible: charly box validate in the charly repo,
with an omarchy distro entity carrying disk_layout:, reported

node "omarchy": plugin kind:distro: plugin_input fails #DistroInput:
#DistroInput.disk_layout: field not allowed

which is what sent me here.

Rulebook compliance

  • R0 — skills first. /charly-internals:git-workflow; the sanctioned
    spec-def/plugin-input duplication was read before a third copy was considered.
  • R1 — RCA every anomaly. The field not allowed error was root-caused to schema
    drift rather than treated as "the field is unsupported". Chasing it turned up a
    second, older instance (installer) that nothing had reported, and both are fixed
    here — not deferred as out of scope.
  • R2 — finish the whole cutover. Both missing fields, all four supporting defs, and
    the guard that prevents a third, land together.
  • R3 — no duplication. This is the sanctioned duplication, not new duplication: the
    plugin input def must compile standalone. The guard is what makes carrying two copies
    safe, which is the honest answer to "why is this allowed to be duplicated at all".
  • R4 — no workarounds. The field is added to the schema that rejects it. Loosening
    #DistroInput to an open struct would have silenced this and every future typo with it.
  • R5 — delete legacy completely. N/A — purely additive; nothing is removed or renamed.
  • R6 — preserve user work and Git safety. Feature branch off current main, PR-only,
    no force-push, no direct push to main, no hook bypass.
  • R7 — prove behavior, not compilation. The guard is proven by making it fail, and the
    fix is proven by the originating charly box validate error going away.
  • R8 — preserve emitted artifacts. N/A — no generated artifact in this repo.
  • R9 — binary equals source. go test -count=1 from this worktree.
  • R10 — fresh disposable proof. N/A — no bed in this repo. Its gate is the unit suite on the final tree.
  • ADE — spec-is-the-test. Every claim the new defs make is asserted by the two guards.
  • RDD — prove high-risk assumptions before editing. The assumption that this def was
    in step with spec was false, and testing it is what found the older installer gap.
  • SDD — schema-driven design. Schema-only change, mirroring the core defs.
  • Concurrency mandate. N/A — no roster.

Change classification

  • Change class: CUE schema (plugin input def) + tests. No Go behaviour change.
  • Verification gate: go test -count=1 ./..., plus a deliberate negative run showing
    the guard fails on drift.
  • Attribution tier: fully tested and validated — the rejection this fixes was
    reproduced, the fix removes it, and the guard was proven to catch a regression.

Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)

This plugin validates an authored `distro:` body against its OWN
self-contained #DistroInput before dispatching. That duplication is
sanctioned — the plugin schema must compile standalone while spec's
#Distro must generate Go — but it means the two can drift, and when they
do the failure is actively misleading: charly's core accepts a field and
this plugin rejects it with

  #DistroInput.disk_layout: field not allowed

which reads like the field does not exist anywhere.

Two fields were missing:

  - installer, added to spec in spec#71. Already drifted: an authored
    installer: block has been rejected here since that landed.
  - disk_layout, added in spec#72, and the one that surfaced this — a
    charly build with an omarchy distro entity failed to validate.

Add #DsDiskLayout, #DsSubvolume, #DsInstaller and #DsInstallerFile
mirroring their spec counterparts, and wire both fields into
#DistroInput.

Add a parity test so the NEXT omission fails here, next to the fix,
rather than in a consumer's build log. It compares #DistroInput's
top-level field set against the set spec's #Distro authorises, and
verified to discriminate: deleting the disk_layout line makes it fail
with a readable got/want diff. A second test catches a #Ds* reference
that has no definition, which would otherwise only fail at use.

Inner defs are deliberately NOT compared: they differ in name
(#DsBootloader vs #Bootloader) and carry no @go annotations, so
comparing them would be noise. What matters is that every field a distro
entity can author is authorable here.

Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 0beeb2460f6b48cf93bd1bd4450207ae649a584d (branch: fix/schema-distro-input-drift)

Security screen: PASS — CUE schema + test change only; no secrets, exfiltration, network calls, scope mismatch, or guardrail weakening. No embedded directives aimed at the reviewer.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body accounts for every file in the diff, supplies pasted go test -count=1 ./... output plus a deliberate negative run proving the guard discriminates, and ends with the *Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)* footer. Change class (schema + tests) matches the unit-suite gate; no bed exists in this repo (R10 N/A correctly stated). Tier justified — the new tests executed against the fresh tree.
  • R0–R10 — RCA provided for the field not allowed drift (R1); both missing fields fixed in-tree, nothing deferred (R2); sanctioned standalone duplication with a guard, not new duplication (R3); schema fix, no workaround (R4); purely additive, nothing removed (R5); R6/R8 N/A, R9 go test from worktree; R10 N/A (no bed).
  • ADE/SDD — Schema-only change mirroring core defs; no generated files, no banned patterns; new defs are proper CUE defs. ADE N/A (existing candy, no new candy definition).
  • B16 placement — placement: CORRECT. Schema defs and parity test live in the candy layer (capability), not core/sdk. No alias files, no sdk-kit imports, no *Legacy* identifiers.
  • B18 — Test code is gofmt-clean; no dead code, unused params, or shadowing visible in the diff. The parity test logic is sound (field-set comparison + dangling-reference guard) and was proven to fail on drift.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 08:04
@github-actions
github-actions Bot merged commit 068e6ce 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 feat/distro-input-disk-layout-and-installer branch September 25, 2026 19:23
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