Skip to content

feat(task): cue-gen regenerates the params from the schema with spec's generator, by ref - #13

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/cue-gen-task
Nov 23, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/cue-gen-task

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

This repo's params/cue_types_gen.go is generated from schema/builder.cue, but there was no way to run the generation here — no task:, no script, no workflow (charly task cue-gen reported unknown task "cue-gen" (declared tasks: )). So the generated file could not be kept in step, and the only way to produce it was to copy spec's pipeline into this repo (#10).

  • charly task cue-gen now exists here, and it runs spec's ONE generator BY REF: go run github.com/opencharly/spec/[email protected] — the merged release of feat(schemagen): the generator is a module-root command, so a consumer runs it by ref spec#425, which moved the generator to that module's root so another module can run it. Nothing is copied into this repo.
  • The second step is the drift gate: after regeneration, the committed file must show no diff. A stale committed cue_types_gen.go therefore FAILS the task, with the message telling the author to commit the regenerated file.
  • The tag is a merged release, never a branch — a version-less ref would fall to the mutable default and defeat reproducibility.

How tested

The release reproduces this repo's committed file BYTE FOR BYTE, run by ref from this checkout — so the generated file was never out of step, only unreproducible:

$ GOWORK=off go run github.com/opencharly/spec/[email protected] \
    -mode=params -schema=candy/plugin-builder/schema -pkg=params -out=/tmp/pb-gen2.go
go: downloading github.com/opencharly/spec v0.2026327.329
run_exit=0
$ diff -q candy/plugin-builder/params/cue_types_gen.go /tmp/pb-gen2.go && echo BYTE_IDENTICAL
BYTE_IDENTICAL

The task, run live on this head — both steps pass on the committed tree, and the tree is unchanged afterwards (the regeneration is a no-op):

$ charly task cue-gen
task cue-gen: 2 step(s), 0 failed, 0 skipped
  [pass] run — regenerate the Go param structs in-process from this plugin's own schema
      exit=0
  [pass] check — the committed file is in step — regeneration leaves no diff (the drift gate)
      exit=0
$ git status --porcelain        # only the charly.yml edit of this commit
 M charly.yml

The drift gate fails on a STALE committed file — mutation, on a throwaway copy of this repo (a commit appending one line to the generated file, then the task):

$ charly -C /tmp/pb-mut task cue-gen
task cue-gen: 2 step(s), 1 failed, 0 skipped
  [pass] run — regenerate the Go param structs in-process from this plugin's own schema
      exit=0
  [fail] check — the committed file is in step — regeneration leaves no diff (the drift gate)
      exit=1, want 0 (stderr: )
charly: error: command "task": task "cue-gen" failed (1 step(s) failed)
STALE_EXIT=1

$ # after committing the regenerated file, the same task passes
task cue-gen: 2 step(s), 0 failed, 0 skipped … CLEAN_EXIT=0

The module and project gates on this head:

$ GOWORK=off go build ./... && GOWORK=off go vet ./... ; echo "gate_exit=$?"
gate_exit=0
$ GOWORK=off go test ./... -count=1
ok  	github.com/opencharly/plugin-builder/candy/plugin-builder	0.008s
?   	github.com/opencharly/plugin-builder/candy/plugin-builder/cmd/serve	[no test files]
?   	github.com/opencharly/plugin-builder/candy/plugin-builder/params	[no test files]
tests_exit=0
$ gofmt -l .
(no output)
$ charly box validate
charly box validate: OK — checked 1 candy, 6 distros, 7 builders; 0 warnings, 0 errors

Rulebook compliance

  • R0: /charly-internals:go, /charly-internals:design, /charly-internals:plugin, /charly-internals:git-workflow.
  • R1: no failure surfaced. The finding is no generator for params/cue_types_gen.go: the generated types cannot be kept in step with schema/builder.cue #10 (filed 2026-11-22 with its measurement); this PR closes it.
  • R2: ONE generator — spec's, run by ref; no script, no second copy, and no generated code transcribed by hand.
  • R3: no workaround, no replace, no vendored copy of the pipeline.
  • R4: the task IS the documented way to regenerate; nothing else in the repo claims another.
  • R5: nothing deleted; charly.yml gains one task: entity.
  • R6: git status clean before the push; branch off fresh origin/main (the old feat/unified-builders work is already merged as fix(params): the hand-applied comment matches the schema's, word for word #12); no force-push.
  • R7: the drift gate fails on a stale committed file (mutation above) and passes on a clean tree; the by-ref run reproduces the committed bytes.
  • R8: no live service.
  • R9: the charly used is the worktree-local build; the generator is pinned to a merged spec tag.
  • R10: this repo's gate is its module tests + charly box validate + the task executed live (all pasted above); the repo declares no disposable: entity.
  • R11: conforms to D-SCH-1 (CUE is the single source; Go is generated, never hand-transcribed) — the regeneration path now exists where the generated file lives.

Filed issues

Change classification

  • Change class: repo tooling (a task: entity in charly.yml).
  • Attribution tier: fully tested and validated — the task ran live on this head, the mutation shows the drift gate failing, and the module + project gates pass.
  • Breaking change + rollback: none — an additive task. Rollback: revert this squash commit.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)

…s generator, by ref

#10: params/cue_types_gen.go is generated from
schema/builder.cue, but this repo had no way to run the generation — no task, no
script — so the file could not be kept in step and a consumer had to copy a pipeline.

The task runs spec's ONE generator BY REF:
`go run github.com/opencharly/spec/[email protected]` (the merged release of
opencharly/spec#425, which moved the generator to the module root so another module can
run it). Nothing is copied into this repo.

The second step is the drift gate: after regeneration, the committed file must show no
diff, so a stale generated file FAILS the task — measured both ways (a stale committed
file fails with the drift message; a clean tree passes). And the release reproduces
this repo's committed params file BYTE FOR BYTE, so the file was never out of step —
only unreproducible.

*Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`*
*Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 8e65b9a0c1aa308a2b9684bb96a49fe16bb1b284 (branch: fix/cue-gen-task)

Security screen: PASS — no secrets/exfiltration, no guardrail weakening; the new go run github.com/opencharly/spec/[email protected] is the declared, pinned, merged-tag dependency the PR exists to add (no replace, no vendored copy, no branch ref). Scope matches the body exactly (one task: entity). No embedded instructions.

Checklist: All applicable rules PASS or NA. Diff is one additive task: entity in charly.yml; ADE fields present (description: + plan with a check: step); the drift-gate check is the shipped coverage and the body's mutation output proves it fails on a stale committed file and passes on a clean tree; module gates, gofmt, and charly box validate (0 warnings) pasted and internally consistent; R1 fix-it (closes #10); R5 nothing removed; R11 cites D-SCH-1; attribution tier fully tested and validated justified by the live task run + mutation. Comment thread empty (nothing to disposition).

Placement: CORRECT — a consumer repo's regeneration tooling belongs in that repo's charly.yml (no core/sdk/candy code touched; mechanism reused by ref, not copied).

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 23, 2026 03:35
@github-actions
github-actions Bot merged commit 2d939db into main Nov 23, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 23, 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.

1 participant