Repository navigation
fix(box): make openrc selectable via #Box.init - #57
Conversation
The build vocabulary defines three init systems - supervisord, systemd and openrc, the last a first-class entity with its own service_template, management commands and unit_path_template - but #Box.init's enum listed only two. A box could not select openrc at all: `init: openrc` failed schema validation against an init charly fully implements. That mattered from the moment #Box.init started being read. Until sdk#175 the field reached nothing, so the gap was invisible; now that ResolveInitSystem receives it, an unselectable vocabulary word is a live inconsistency between what the vocabulary defines and what a box may ask for. The doc comment states the invariant the enum has to hold - every value must be an init the vocabulary actually defines - so the next init added to charly.yml has a stated reason to appear here too, rather than being omitted the way openrc was. Regenerated with `task cue:gen` (SDD: the CUE def is the single source; the Go comment is generated from it). Regeneration is reproducible - a second run is a no-op. Also fixes a pre-existing gofmt violation in fleet/deploy_fleet_ops_candykey_test.go. It is untouched by this change but blocks any commit to the module, so R2 puts it here rather than in a follow-up. Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system) Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq
Review — BLOCKHead SHA: Change class: schema change (CUE) + regenerated Go + gofmt fix in an unrelated test file. Security screen: PASS — no scope mismatch (all three files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no supply-chain changes. Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Adds the coverage the enum widening shipped without. Three cases against the
SHIPPED schema, compiled the way consumers compile it
(schemaconcat.ConcatSchema over the embedded FS):
- every vocabulary init validates. Fails on the pre-change enum: unifying
#Box with init: "openrc" is a conflict, not a warning.
- an unknown init is still rejected. Widening by loosening the type to
`string` would make the first case pass while silently accepting typos, so
the discrimination is asserted rather than assumed.
- box.cue still states the invariant. It is the only place that says why the
enum's membership is constrained, and spec cannot read charly's vocabulary
to check it mechanically.
Caught by the pr-validator: B12 requires a test that fails without the change,
and the original diff's only test hunk was an unrelated gofmt fix.
Review — PASSHead SHA: Change class: schema change (CUE) + regenerated Go + gofmt fix + new schema test. Security screen: PASS — no scope mismatch (all 4 files accounted for in body), no secrets/exfiltration, no weakened guardrails, no supply-chain changes. Comment intake: The single prior Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
The
specleg of batch B1 — service-render correctness, and its last piece.The build vocabulary defines three init systems —
supervisord,systemd, andopenrc, thelast a first-class entity with its own
service_template,management_commandset andunit_path_template— but#Box.init's enum listed only two:So a box could not select
openrcat all:init: openrcfailed schema validation against an initcharly fully implements.
That was invisible until now for a specific reason. Before
opencharly/sdk#175,#Box.initreachednothing — all three
ResolveInitSystemcall sites passed a hardcoded""— so the enum'scontents could not matter. Now that the field is actually read, an unselectable vocabulary word is a
live inconsistency between what the vocabulary defines and what a box may ask for.
The doc comment states the invariant the enum has to hold — every value must be an init the build
vocabulary actually defines — so the next init added to
charly.ymlhas a stated reason to appearhere too, rather than being omitted the way
openrcwas.How tested
Coverage that fails without the change
schema/box_init_test.gocompiles the shipped schema the way consumers do(
schemaconcat.ConcatSchemaover the embedded FS) and unifies a#Boxagainst each init:Reverting only the enum, with the tests in place:
The second case is what keeps the first honest: widening by loosening the type to
stringwouldmake it pass while silently accepting typos, so
sysvinit,runit,Systemdand""are assertedto stay rejected.
Regeneration is reproducible — a second run produces the identical tree, and the only generated
change is the doc comment flowing onto
Box.Init:An environmental failure worth naming
Run from a checkout under
/tmp,TestSweepStaleTemps_HonoursTMPDIRandTestOpenedFilesByAnyProcess_HonoursTMPDIRfail — and say exactly why:They fail deliberately rather than passing vacuously. Confirmed environmental by a control run on
the pristine tree (identical failures), and both pass from a checkout outside
/tmp— which iswhere the 17/0 result above comes from. Not a defect, and nothing to fix.
Rulebook compliance
/charly-image:layer(init polymorphism) loaded before editing.$TMPDIRfailures got a control run on a pristine tree before any conclusion;they reproduce identically without this change and pass outside
/tmp.fleet/deploy_fleet_ops_candykey_test.goblocks anycommit to this module, so it is fixed here rather than deferred.
git statuschecked; branch off freshmain; no force-push, no bypass.coverage fails without it (control run pasted). No bed applies: selecting
init: openrcend to endneeds an OpenRC-capable image, which no bed in the corpus provides — hence the capped tier.
and re-running rather than by inspection.
task cue:gen, never hand-edited. No banned@go(-)tag.Change classification
task cue:genreproducible + module suite + lint.analysed on a live system— the schema compiles and regenerates cleanly andthe suite is green, but selecting
init: openrcend to end needs an OpenRC-capable image, whichno bed in the corpus provides.
Not covered
schema/box_init_test.go(added in the second commit) asserts the enum accepts every init the vocabulary defines by name,
and that it still rejects unknown ones — but it cannot read
charly.ymlto derive that list,because
specdoes not and should not import charly. A third case therefore pins the doc commentitself, since that comment is the only thing telling the next init's author to come here. The
mechanical cross-check belongs in charly's
TestEmbeddedVocab_*family, which already reads thatfile.
init: openrcis not exercised. OpenRC is explicitly out of scope for the cstream program, sothis leg makes it selectable and consistent, without claiming it is proven on a live image.
Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)