Skip to content

feat(spec): carry a candy's declared var: onto BoxMetadata - #403

Merged
github-actions[bot] merged 3 commits into
mainfrom
feat/boxmetadata-vars
Nov 20, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
feat/boxmetadata-vars

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A candy's declared var: now travels onto BoxMetadata, 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 own config: comment states the rule they follow — "substitutes ${VAR} refs in content: at generate time (candy var: ∪ auto-exports)". A check: step never got that union. Its substitution base is kit.ResolveCheckVarsRuntime's buildTimeVars, which reads exactly nine fields off BoxMetadata — USER, HOME, UID, GID, IMAGE, DNS, INSTANCE — and var was 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_FLAG

A variable the runner KNOWS and can never SUPPLY. sdk/kit/planrun.go:230 documents 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) merges meta.Vars into buildTimeVars; leg 3 (plugin-check) needs nothing, because ResolveCheckVarsRuntime is 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#69 cannot 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

$ GOWORK=off go build ./...
build=0
$ GOWORK=off go test ./...
all=0
$ gofmt -l schema/ spec/
(no output)

Regeneration is reproducible — charly task cue-gen reports it:

$ charly -C . task cue-gen
  [pass] check — regen is reproducible — TestGenReproducible passes on the committed tree
      exit=0

The generated field lands where it must be. Vars map[string]string at spec/cue_types_gen.go:1544 sits inside the BoxMetadata struct, which spans 1441–1553:

$ awk 'NR>=1441 && NR<=1560 && /^type /{print NR": "$0}' spec/cue_types_gen.go
1441: type BoxMetadata struct {
1554: type CandyHook struct {

Serialization IS runtime behaviour, so it has its own tests — and they fail without the field.

$ GOWORK=off go test ./spec/ -run TestBoxMetadata -v
--- PASS: TestBoxMetadataCarriesCandyVars (0.00s)
--- PASS: TestBoxMetadataVarsRoundTrip (0.00s)
ok  	github.com/opencharly/spec/spec	0.006s

# proven red: remove the field and the tests do not compile
$ GOWORK=off go vet ./spec/
spec/boxmetadata_vars_test.go: bm.Vars undefined (type BoxMetadata has no field or method Vars)
# three occurrences: the decode case, its value assertion, and the encode case

TestGenReproducible cannot 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_FLAG in its candy var: block; leg 2 is where that SKIP becomes a resolution.

Rulebook compliance

  • R0 — /charly-internals:go, /charly-internals:design, /charly-internals:plugin loaded before the first edit; this touches spec/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 for check:. Blast radius: every candy-declared variable in every bed. Root fix: this field plus leg 2.

  • R2 — the field mirrors #CandyFields.var rather 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.var is untouched.

  • R6 — a fresh branch off origin/main in a session worktree; git status read before staging; no force-push.

  • R7 — two round-trip tests fail without the field. TestBoxMetadataCarriesCandyVars decodes an authored var: block and asserts the map is populated with the exact values; TestBoxMetadataVarsRoundTrip encodes and asserts the tag is var. 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:

    $ grep -n 'BoxMetadata' DESIGN.cue DESIGN.md; echo "exit=$?"
    exit=1

    No match — and the conclusion I drew from that was wrong. BoxMetadata is the projection of §16's candy field table, so a new field on it needs a §16 row. spec's own AGENTS.md says so and names this exact case:

    "A field that exists in schema/*.cue and not in DESIGN.md is either a projection that has not been documented or a field that should be deleted — and which one it is must be decided in DESIGN.md, not in the PR that needs the field. Add the DESIGN.md row … before (or in the same cutover as) the CUE that projects it, never after."

    #1209 made that decision and it is on main now (git show origin/main:DESIGN.md | grep -c '^| \var`'→1). It added §16's varrow plus itsDESIGN.cue projection (#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 existing BoxMetadata producer or consumer is unaffected — no YAML needs a new key, and the generated Go field is omitempty on both tags.

Breaking change + rollback: not breaking. Nothing reads Vars until leg 2 lands; reverting this PR alone restores the previous behaviour exactly, because the field is never populated or consulted here.

Filed issues

Every file in the diff

$ git diff --numstat origin/main...HEAD
7	0	schema/boxmetadata.cue
84	0	spec/boxmetadata_vars_test.go
8	0	spec/cue_types_gen.go

Files changed

file what changed
schema/boxmetadata.cue +#BoxMetadata.var?: — the authored shape, with a comment naming the SKIP-vs-DEAD consequence it closes
spec/cue_types_gen.go generated: BoxMetadata.Vars map[string]string (yaml:"var,omitempty")
spec/boxmetadata_vars_test.go NEW — two round-trip tests that fail at compile time if the field is removed

Agent: lead · DeepSeek Harness session 0d9af4c2ae6e
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

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

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 24a54c0c105c82f49bd0be8db535a373f651496f (branch: feat/boxmetadata-vars)

Change class: additive spec schema/contract change (schema/boxmetadata.cue + generated spec/cue_types_gen.go); no runtime target, no bed.

Blocks

  1. R10 / R7 — the change ships no test that would fail without it. The diff adds a serialization field (var? in CUE → Vars map[string]string with yaml:"var,omitempty" in spec/cue_types_gen.go:1544). The body's own evidence shows the only gate is TestGenReproducible, which passes identically whether the field is present or absent — it checks CUE↔Go consistency, not that var: round-trips onto BoxMetadata. There is no test in the diff that fails if Vars is removed. Serialization is runtime behaviour: yaml.Unmarshal([]byte("var:\n FOO: bar"), &bm) populating bm.Vars["FOO"] is a test that fails without the field and is trivially addable in this repo. Add such a round-trip test (or point to the existing test in the module suite that already exercises BoxMetadata.var, which the body does not cite).

  2. A3 — attribution tier is not justified as stated. The body claims fully tested and validated while explicitly admitting "A pure field addition has no runtime behaviour to fail without" and "The behaviour proof belongs to leg 2." That admission is incorrect for a wire-shape field (see feat(spec): initial import — spec + proto wire/IR contract extracted from sdk (#55 Phase A1) #1), and it is exactly the forbidden cross-repo deferral: the field's serialization behaviour is unproven in the tree that owns the shape, and no spec-repo issue is filed for that coverage. Either ship the round-trip proof in this tree (which then justifies the tier), or the tier is at most analysed on a live system.

  3. R11 / rule 4 — the "no DESIGN amendment" conclusion rests on an unpasted grep. The body concludes "No DESIGN amendment is required" on the strength of `grep -n BoxMetadata DESIGN.cue DESIGN.md` returns nothing, but pastes no output for it (every other claim — build, test, gofmt, cue-gen, the awk placement proof — is pasted and internally consistent, which makes the one omission conspicuous). Paste the real grep output on DESIGN.cue/DESIGN.md, and quote the D-LAW-4 / D-SCH-1 definitions the body cites, so the "conforms, no amendment" disposition is evidenced rather than asserted. (The awk placement claim does check out: Vars at 1544 falls inside BoxMetadata 1441–1553, consistent with the diff hunk.)

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

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

Copy link
Copy Markdown

Review — BLOCK

Head SHA: ef4975cf37f54159599d5f4e68b50e9aff38e188 (branch: feat/boxmetadata-vars)

Change class: additive spec schema/contract change (schema/boxmetadata.cue + generated spec/cue_types_gen.go + new round-trip test); no runtime bed, no service boundary.

Blocks

  1. CONC(d) / R11 — the "no DESIGN amendment" disposition still rests on an unpasted grep. The body concludes "No DESIGN amendment is required" on the strength of `grep -n BoxMetadata DESIGN.cue DESIGN.md` returns nothing, but pastes no console output for it (every other claim — build, test, gofmt, cue-gen, the awk placement proof — is pasted). "I grepped … and found nothing" without the real command output is the forbidden described-but-unrun sweep. Paste the actual grep output on DESIGN.cue/DESIGN.md (or quote the D-LAW-4 / D-SCH-1 definitions) so the conformance disposition is evidenced. This is the one finding of the prior review that survives; it is not fixed by the second commit.

  2. COORD — the body shows this PR blocks another open item, but no coordination comment exists. The ## Filed issues section states opencharly/plugin-pipeline#69 — blocked on this cutover, and the summary names a pending leg 2 (sdk). Per the rulebook, when the body shows the PR blocks another open item, a WAITING/HOLDING comment naming both sides must exist on the thread. The only comment present is the bot review; there is no WAITING/HOLDING (or other closed-set label) coordination comment. Add one naming both sides.

Comment dispositions

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: ef4975cf37f54159599d5f4e68b50e9aff38e188 (branch: feat/boxmetadata-vars)

Change class: additive spec schema/contract change (schema/boxmetadata.cue + generated spec/cue_types_gen.go + new round-trip test); no runtime bed, no service boundary.

Blocks

  1. COORD — required coordination comment is absent. The body's ## Filed issues states opencharly/plugin-pipeline#69 — blocked on this cutover, and the summary states this PR depends on opencharly/opencharly#1209 ("must land first"). Per COORD, when the body shows the PR blocks another open item, or is blocked by one, a WAITING/HOLDING comment naming both sides must exist on the thread. The thread contains only two github-actions[bot] review verdicts — no closed-set coordination comment exists. Add a WAITING/HOLDING comment naming both sides (spec#403 ↔ plugin-pipeline#69 and spec#403 ↔ opencharly#1209), so the "must land first" dependency is recorded on both threads.

Comment dispositions

  • Comment 7042314438 [issue] by @github-actions[bot] — re-derived against current state.
  • Comment 7042515538 [issue] by @github-actions[bot] — re-derived against current state.
    • Block 1 (R11 — unpasted grep): stale/superseded — the grep is now pasted (exit=1) and the conclusion has been corrected to require #1209.
    • Block 2 (COORD — no coordination comment): verified-blocking — reproduces against the current thread (only two bot reviews, no WAITING/HOLDING); carried forward as Block 1.

Note (non-blocking): the body's R11 disposition is coherent — it names D-LAW-4/D-SCH-1 (conforms), states the §16 var row is amended via opencharly/opencharly#1209, and per spec's own AGENTS.md sequences that row to land first. The placement (spec CUE → generated Go) is CORRECT for a wire shape. The residual issue is purely the missing coordination record.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@aitrawog

Copy link
Copy Markdown
Contributor Author

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 var row plus its DESIGN.cue projection. spec's own AGENTS.md is explicit that the decision belongs there and not in the PR that needs the field:

"A field that exists in schema/*.cue and not in DESIGN.md is either a projection that has not been documented or a field that should be deleted — and which one it is must be decided in DESIGN.md, not in the PR that needs the field."

#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 WAITING.

Clears when: #1209 merges, then this PR's R11 claim becomes conformance rather than dependence.

Agent: lead · DeepSeek Harness session 0d9af4c2ae6e
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: ef4975cf37f54159599d5f4e68b50e9aff38e188 (branch: feat/boxmetadata-vars)

Security screen: PASS — additive CUE field + generated Go + tests; no secrets, no scope mismatch, no guardrail weakening, no supply-chain edit. Placement (spec CUE → generated Go) is CORRECT for a wire shape.

Checklist: All applicable rules PASS or NA. The diff adds an optional BoxMetadata.var? wire field, its @go(Vars,type=map[string]string) projection, and a round-trip test whose bm.Vars references fail to compile if the field is removed; the serialization path is exercised (yaml.Unmarshal/Marshal), justifying fully tested and validated. The DESIGN disposition names D-LAW-4/D-SCH-1, sequences the §16 var row via #1209, and pastes the governing grep; the body accounts for all three files and ends with the correct Agent:/Assisted-by: footers.

Comment dispositions:

  • 7042314438 (bot BLOCK, prior SHA) — stale/superseded: R10/R7 test gap fixed by spec/boxmetadata_vars_test.go; A3 tier supported by the added tests; R11 grep now pasted (exit=1) with a corrected conclusion.
  • 7042515538 (bot BLOCK) — R11 unpasted-grep: stale/superseded (pasted, conclusion corrected to require #1209); COORD missing-comment: resolved by 7044273502.
  • 7044112757 (bot BLOCK) — COORD: resolved; 7044273502 is a WAITING/HOLDING comment naming spec#403 ↔ opencharly#1209 and spec#403 ↔ plugin-pipeline#69, posted by maintainer @aitrawog.
  • 7044273502 (@aitrawog) — coordination comment satisfies COORD. Its "#1209 open" remark predates the current body's merge claim; the body pastes git show origin/main:DESIGN.md | grep -c '^| \var`'→1`, so the merge-status text is stale while the coordination function stands (verified-non-blocking).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 20, 2026 16:19
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 6e958f8c20f0bdd97707ad3521f04132f022f72e (branch: feat/boxmetadata-vars)

Security screen: PASS — additive optional CUE field (BoxMetadata.var?), its @go(Vars,type=map[string]string) projection, and a round-trip test; no secrets, no scope mismatch, no guardrail weakening, no supply-chain edit. Placement (spec CUE wire shape → generated Go) is CORRECT; no code belongs in charly//sdk here.

Checklist: All applicable rules PASS or NA. The diff accounts for all three files (+7/+84/+8, matching --numstat); the var? field mirrors #CandyFields.var's pattern key and is projected through @go(...) with the source CUE changed in the same commit (SDD-a satisfied); the two tests exercise the changed serialization path (yaml.Unmarshal/Marshal on Vars) and fail at compile time if the field is removed — a real gate that TestGenReproducible could not be, so fully tested and validated is justified for this repo's changed code path. R11 names D-LAW-4/D-SCH-1, states conforms, and sequences the governing §16 var row through merged opencharly/opencharly#1209 (merge commit 6e958f8 is consistent with pulling it onto main); this PR does not itself touch DESIGN.md/DESIGN.cue/design/, so the design-check/sign-off sub-gate is N/A. The body's awk placement proof (Vars at 1544 inside BoxMetadata 1441–1553) and red-proof (bm.Vars undefined) are internally consistent with the diff. Body ends with the correct Agent:→Assisted-by: footer order.

Comment dispositions:

  • 7042314438 (bot BLOCK @24a54c0) — stale-superseded: R10/R7 test gap closed by spec/boxmetadata_vars_test.go; A3 tier supported by those tests; R11 grep now pasted (exit=1) with a corrected conclusion.
  • 7042515538 (bot BLOCK @ef4975cf) — stale-superseded: unpasted-grep finding resolved (console block pasted); COORD missing-comment resolved by 7044273502.
  • 7044112757 (bot BLOCK @ef4975cf) — stale-superseded: sole surviving finding (COORD) resolved by 7044273502.
  • 7044273502 (@aitrawog, maintainer) — verified-non-blocking: valid WAITING/HOLDING coordination comment naming spec#403 ↔ opencharly#1209 and ↔ plugin-pipeline#69, satisfying COORD; its "#1209 open" status predates the current body's merge claim and the merge commit, so that detail is stale while the coordination function stands.
  • 7044533456 (bot PASS @ef4975cf) — verified-non-blocking: independently re-derived; holds on the current tree (the merge commit changed no PR file).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot merged commit ec21583 into main Nov 20, 2026
4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 20, 2026
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.

2 participants