Repository navigation
feat(spec): carry a candy's declared var: onto BoxMetadata - #403
Conversation
A candy's #CandyFields.var (spec/schema/candy.cue) declares template variables, and #Op's config: comment states the rule they follow: substitution is 'candy var: union auto-exports'. A check step's substitution never got that union, because the base it is built from -- kit.ResolveCheckVarsRuntime's buildTimeVars -- reads nine fields off BoxMetadata (USER HOME UID GID IMAGE DNS INSTANCE) and var was not among the nine. The effect was a variable a runner KNOWS by name and can never SUPPLY: the host's unresolved classifier sees the declaration, so the step SKIPs with 'unresolved variables' instead of failing DEAD. Carrying var: onto the metadata gives the sdk leg somewhere to read it from. Generated by charly task cue-gen; TestGenReproducible passes on the committed tree. Agent: lead Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: additive spec schema/contract change ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
TestGenReproducible cannot serve this: it checks CUE-Go consistency and passes identically whether the field exists or not, because a field absent from BOTH sides is still consistent. Serialization is runtime behaviour, so it needs a runtime assertion. Two cases: decode an authored var: block and assert the map is populated with the exact values (a nil map means the field is missing from the shape), and encode a BoxMetadata and assert the tag is var, so a written-back manifest uses the spelling a candy declares. Proven red: removing the field fails the test at COMPILE time - bm.Vars undefined - which is a stronger gate than an assertion, because the shape cannot silently regress. Agent: lead Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: additive spec schema/contract change ( Blocks
Comment dispositions
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: additive spec schema/contract change ( Blocks
Comment dispositions
Note (non-blocking): the body's R11 disposition is coherent — it names Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
WAITING — on opencharly/opencharly#1209 (the DESIGN row), and HOLDING opencharly/plugin-pipeline#69. WAITING: opencharly/opencharly#1209 must land before this PR can claim R11. It adds §16's
#1209 is open and awaiting a maintainer sign-off, which an amendment requires and which an agent never posts on its own initiative. HOLDING: opencharly/plugin-pipeline#69 cannot be graded until this cutover's leg 2 lands (a bed has no way to be pointed at the worktree under test). That is tracked on #69 with Clears when: #1209 merges, then this PR's R11 claim becomes conformance rather than dependence. Agent: |
Review — PASSHead SHA: Security screen: PASS — additive CUE field + generated Go + tests; no secrets, no scope mismatch, no guardrail weakening, no supply-chain edit. Placement ( Checklist: All applicable rules PASS or NA. The diff adds an optional Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — additive optional CUE field ( Checklist: All applicable rules PASS or NA. The diff accounts for all three files ( Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
A candy's declared
var:now travels ontoBoxMetadata, so the check runner can supply a value for a variable it already knows by name.The defect this closes.
#CandyFields.var(spec/schema/candy.cue:115) declares a candy's template variables, and#Op's ownconfig:comment states the rule they follow — "substitutes ${VAR} refs in content: at generate time (candy var: ∪ auto-exports)". Acheck:step never got that union. Its substitution base iskit.ResolveCheckVarsRuntime'sbuildTimeVars, which reads exactly nine fields offBoxMetadata—USER,HOME,UID,GID,IMAGE,DNS,INSTANCE— andvarwas not among them.The symptom is worse than a missing value, and it is why this took a while to find. The host's unresolved classifier does see the declaration, so the step does not fail
DEAD(as an unknown name would); it returns:SKIP check PROBE does a candy var reach a check step [probe-var] unresolved variables: PROBE_FLAGA variable the runner KNOWS and can never SUPPLY.
sdk/kit/planrun.go:230documents the split — an unknown name is a DEAD authoring error, a known-but-unsupplied one is a SKIP for "inputs that genuinely don't apply to this run" — and a candy-declared var is neither.This is leg 1 of three, producer-first. Leg 2 (
sdk) mergesmeta.VarsintobuildTimeVars; leg 3 (plugin-check) needs nothing, becauseResolveCheckVarsRuntimeis the single builder. Until leg 2, this PR adds the field and changes no behaviour.Why it matters beyond the one case:
opencharly/plugin-pipeline#69cannot be graded at all without it — a bed has no way to be pointed at the worktree under test, because every${…}it might use is either auto-exported or unresolvable.How tested
Regeneration is reproducible —
charly task cue-genreports it:The generated field lands where it must be.
Vars map[string]stringatspec/cue_types_gen.go:1544sits inside theBoxMetadatastruct, which spans1441–1553:Serialization IS runtime behaviour, so it has its own tests — and they fail without the field.
TestGenReproduciblecannot serve this gate and I was wrong to offer it: it checks CUE↔Go consistency and passes identically whether the field exists or not, because a field absent from both sides is still consistent.The end-to-end behaviour proof belongs to leg 2. The SKIP above is the pre-change measurement, taken against a bed that declares
PROBE_FLAGin its candyvar:block; leg 2 is where that SKIP becomes a resolution.Rulebook compliance
R0 —
/charly-internals:go,/charly-internals:design,/charly-internals:pluginloaded before the first edit; this touchesspec/schema/*.cue, which the dispatcher names.R1 — the anomaly is the SKIP above. Mechanism: the nine-field
buildTimeVars. Missed control:config:'s documented union was never mirrored forcheck:. Blast radius: every candy-declared variable in every bed. Root fix: this field plus leg 2.R2 — the field mirrors
#CandyFields.varrather than inventing a second shape, reusing its exact pattern key[=~"^[A-Z_][A-Z0-9_]*$"].R3 — no shim, no fallback: the field is carried, and leg 2 reads it.
R4 — the product is the contract; nothing routes around the defect in prose.
R5 — nothing retired. The field is new, and
#CandyFields.varis untouched.R6 — a fresh branch off
origin/mainin a session worktree;git statusread before staging; no force-push.R7 — two round-trip tests fail without the field.
TestBoxMetadataCarriesCandyVarsdecodes an authoredvar:block and asserts the map is populated with the exact values;TestBoxMetadataVarsRoundTripencodes and asserts the tag isvar. Proven red: removing the field fails at COMPILE time —bm.Vars undefined— which is a stronger gate than an assertion, because the shape cannot silently regress.R8 — no service boundary touched.
R9 — no binary shipped by this repo.
R10 — this repo's change-class gate is the module suite plus
charly task cue-gen's reproducibility check, both pasted above.R11 — conforms, and the DESIGN row this needed has LANDED: docs(design): a candy declares var:, and a step substitutes from it opencharly#1209 merged.
Pasted, because the previous round asserted this without output:
No match — and the conclusion I drew from that was wrong.
BoxMetadatais the projection of §16's candy field table, so a new field on it needs a §16 row. spec's ownAGENTS.mdsays so and names this exact case:#1209 made that decision and it is on
mainnow (git show origin/main:DESIGN.md | grep -c '^| \var`'→1). It added §16'svarrow plus itsDESIGN.cueprojection (#Content.var?:and"var"in the closed_candyFieldlist), andbash scripts/design-check.sh` reports all controls pass on it.This PR conforms to D-LAW-4 and D-SCH-1 meanwhile — the shape is declared in CUE and the Go generated, never hand-transcribed — and now it claims DESIGN conformance too, because the row that governs the field is on
main.Change classification
Kind: an additive contract change to
spec. The new field is optional and defaults to empty, so an existingBoxMetadataproducer or consumer is unaffected — no YAML needs a new key, and the generated Go field isomitemptyon both tags.Breaking change + rollback: not breaking. Nothing reads
Varsuntil leg 2 lands; reverting this PR alone restores the previous behaviour exactly, because the field is never populated or consulted here.Filed issues
env:on akind: localdeploy validates cleanly and does nothing; a separate wiring defect the same investigation surfaced.stage:, ordered byafter:(P26 unit 2) plugin-pipeline#69 — blocked on this cutover; a bed cannot grade a worktree until it lands.Every file in the diff
Files changed
schema/boxmetadata.cue+#BoxMetadata.var?:— the authored shape, with a comment naming the SKIP-vs-DEAD consequence it closesspec/cue_types_gen.goBoxMetadata.Vars map[string]string(yaml:"var,omitempty")spec/boxmetadata_vars_test.goAgent:
lead· DeepSeek Harness session0d9af4c2ae6eAssisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)