Skip to content

feat(schemagen): the generator is a module-root command, so a consumer runs it by ref - #425

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/schemagen-importable
Nov 23, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/schemagen-importable

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

candy/plugin-builder/params/cue_types_gen.go is generated from its own schema/builder.cue, but that repo carries no way to run the generation — no task:, no script, no workflow (opencharly/plugin-builder#10). charly task cue-gen reports unknown task "cue-gen" (declared tasks: ) there. So the generated file could not be kept in step with its schema, and the only way out was to copy the pipeline into the consumer.

This moves internal/schemagen to schemagen/ at the module root:

  • internal/ blocks every other module, so no consumer could ever run or import the generator.
  • A module-root package main is runnable by ref: go run github.com/opencharly/spec/schemagen@<tag> -mode=params -schema=<dir> -pkg=<pkg> -out=<file>. A consumer repo's generator task then runs THIS generator — one generator, no copied script.
  • charly task cue-gen, the reproducibility test (spec/gen_repro_test.go), schema/README.md, AGENTS.md and the two package comments that named the path move with it; the regenerated spec/vocab_gen.go carries the new header. AGENTS.md's file list now states the new PROPERTY (a module-root command a consumer runs by ref), not just the removed internal/ constraint.

The consumer leg's key claim, measured here — the moved generator reproduces opencharly/plugin-builder's committed params file BYTE FOR BYTE:

$ GOWORK=off go run ./schemagen -mode=params -schema=../plugin-builder/candy/plugin-builder/schema -pkg=params -out=/tmp/pb_params_gen.go
$ diff -u ../plugin-builder/candy/plugin-builder/params/cue_types_gen.go /tmp/pb_params_gen.go ; echo "diff_exit=$?"
diff_exit=0

So that repo's generated file is already in step; what was missing is only the ability to regenerate it — which the next leg (a cue-gen task in plugin-builder, run by ref against this module) supplies.

How tested

Module gate, on the committed tree (spec is a contract module: its module CI is the class gate — no disposable: entity exists to run):

$ GOWORK=off go build ./... && GOWORK=off go vet ./... ; echo "exit=$?"
exit=0
$ gofmt -l . ; echo "gofmt_exit=$?"
gofmt_exit=0

$ GOWORK=off go run ./schemagen -mode=params -schema=schema -pkg=spec -out=spec/cue_types_gen.go
$ GOWORK=off go run ./schemagen -mode=vocab -schema=schema -out=spec/vocab_gen.go
$ gofmt -w spec/cue_types_gen.go spec/vocab_gen.go
$ git diff --stat origin/main      # the committed branch, rename rendered as git renders it
 AGENTS.md                                 |  7 +++++--
 charly.yml                                |  6 +++---
 schema/README.md                          |  6 +++---
 schemaconcat/schemaconcat.go              |  2 +-
 {internal/schemagen => schemagen}/main.go | 10 +++++++---
 schemaretag/schemaretag.go                |  2 +-
 spec/gen_repro_test.go                    |  6 +++---
 spec/vocab_gen.go                         |  2 +-
 8 files changed, 24 insertions(+), 17 deletions(-)

$ GOWORK=off go test ./spec/ -run TestGenReproducible -count=1
ok  	github.com/opencharly/spec/spec	0.358s

$ GOWORK=off go test ./... -count=1     # the repo's full module suite
ok  	github.com/opencharly/spec	0.015s
ok  	github.com/opencharly/spec/cache	0.228s
ok  	github.com/opencharly/spec/calver	0.012s
?   	github.com/opencharly/spec/capability	[no test files]
?   	github.com/opencharly/spec/checkhost	[no test files]
ok  	github.com/opencharly/spec/checkstep	0.005s
ok  	github.com/opencharly/spec/climodel	0.180s
?   	github.com/opencharly/spec/clireflect	[no test files]
ok  	github.com/opencharly/spec/container	1.568s
ok  	github.com/opencharly/spec/cuetoolchain	1.514s
ok  	github.com/opencharly/spec/deploy	0.008s
ok  	github.com/opencharly/spec/exec	8.388s
ok  	github.com/opencharly/spec/exitcode	0.004s
ok  	github.com/opencharly/spec/hostenv	0.011s
?   	github.com/opencharly/spec/http	[no test files]
?   	github.com/opencharly/spec/internal/cuesetup	[no test files]
ok  	github.com/opencharly/spec/internal/wiregen	0.046s
?   	github.com/opencharly/spec/loader	[no test files]
ok  	github.com/opencharly/spec/lock	1.043s
ok  	github.com/opencharly/spec/matchers	0.010s
ok  	github.com/opencharly/spec/merge	0.006s
ok  	github.com/opencharly/spec/needsolver	0.002s
ok  	github.com/opencharly/spec/ops	0.006s
ok  	github.com/opencharly/spec/phase	0.002s
ok  	github.com/opencharly/spec/poll	0.206s
ok  	github.com/opencharly/spec/proc	1.170s
ok  	github.com/opencharly/spec/proto	0.395s
ok  	github.com/opencharly/spec/refs	17.730s
ok  	github.com/opencharly/spec/report	0.013s
ok  	github.com/opencharly/spec/retired	0.100s
?   	github.com/opencharly/spec/retired/cmd/retired-sweep	[no test files]
ok  	github.com/opencharly/spec/schema	10.078s
ok  	github.com/opencharly/spec/schemacompose	0.341s
ok  	github.com/opencharly/spec/schemaconcat	0.002s
?   	github.com/opencharly/spec/schemagen	[no test files]
ok  	github.com/opencharly/spec/schemaparams	0.279s
ok  	github.com/opencharly/spec/schemaretag	0.002s
?   	github.com/opencharly/spec/shellquote	[no test files]
ok  	github.com/opencharly/spec/spec	1.075s
?   	github.com/opencharly/spec/sshx	[no test files]
ok  	github.com/opencharly/spec/storeroot	0.013s
?   	github.com/opencharly/spec/testkit	[no test files]
ok  	github.com/opencharly/spec/transport	0.196s
TESTS_EXIT=0

The regeneration is a no-op apart from the header line: cue_types_gen.go is untouched, and vocab_gen.go differs only in (internal/schemagen) → (schemagen), which is the reproducibility property TestGenReproducible asserts.

Rulebook compliance

  • R0: /charly-internals:go, /charly-internals:design, /charly-internals:plugin, /charly-internals:git-workflow.

  • R1: no failure surfaced. The finding — no generator for params/cue_types_gen.go: the generated types cannot be kept in step with schema/builder.cue plugin-builder#10 — predates this cutover (filed 2026-11-22 with its measurement); this PR does not file anything new, and the consumer leg closes it once this tags.

  • A3 identity: the model string is the one the runtime declares for this session — deepseek-v4.1-flash:cloud — reported by the harness as deepseek-v4.1-flash. The same identity line was reviewed and ACCEPTED by the same validator on this session's two sibling PRs (fix(validate): a remote candy the rule cannot read is an error, never a silent pass plugin-box#96 and chore(deps)!: adopt the builder-contract sdk and the five plugins built on it charly#1237, both carrying Assisted-by: Claude Code deepseek-v4.1-flash …), so the name is not a guess and not a config read: it is this session's own declared runtime.

  • R2: ONE generator — the move deletes the reason a second copy would exist; no script is added to any consumer.

  • R3: no workaround; internal/ is removed rather than bypassed.

  • R4: code first; every documented command (charly task cue-gen) is updated in the same commit.

  • R5: the old path is gone and every live reference is swept, claim-keyed on the literal path:

    $ grep -rn 'internal/schemagen' --include='*.go' --include='*.yml' --include='*.md' --include='*.sh' . | grep -v 'CHANGELOG/'
    (no output)
    hits_outside_changelog=1        # grep exit 1 = no match; CHANGELOG/ history is not rewritten
    
  • R6: git status clean before the push; branch off fresh origin/main; no force-push.

  • R7: TestGenReproducible runs the generator twice and compares — it fails on a stale generated file; the byte-for-byte diff against plugin-builder's file is the live cross-repo proof.

  • R8: no live service.

  • R9: no binary artifact in this repo.

  • R10: the class gate is the module CI (go build/go vet/go test/gofmt), pasted above; git grep -nE '^[[:space:]]*disposable:' finds no disposable: true entity here to run.

  • R11: conforms to D-SCH-1 (SDD: CUE is the single source, Go is generated and never hand-transcribed) and D-LAW-4; no DESIGN text change.

Filed issues

None new — this PR files nothing. opencharly/plugin-builder#10 (filed 2026-11-22 with its measurement) is the consumer leg this release unblocks: its cue-gen task, run by ref against this module once this tags, closes it. The blocking relation is posted as HOLDING here and WAITING on that issue.

Change classification

  • Change class: contract module code (a dev-time generator's location + references).
  • Attribution tier: fully tested and validated — the module gate passes on this tree, the generator was executed live, and its cross-repo output is byte-identical to the consumer's committed file.
  • Breaking change + rollback: the package path moves (internal/schemagen → schemagen). No module outside this repo imports it today (it was internal/), so the only caller is this repo's own task and test, both updated. 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)

…r runs it by ref

opencharly/plugin-builder#10: candy/plugin-builder/params/cue_types_gen.go is generated
from its schema/builder.cue, but that repo has no way to run the generation — no task
entity, no script, no workflow — so the file could not be kept in step with its schema
(spec#421 removed fields from the core #Builder and the plugin's params still named
them). The only way out was to copy the pipeline into each consumer.

Move internal/schemagen to schemagen/ at the module root. Go's internal/ blocks every
other module; a module-root `package main` is runnable BY REF
(`go run github.com/opencharly/spec/schemagen@<tag> -mode=params -schema=<dir>
-pkg=<pkg> -out=<file>`), so a consumer repo's generator task runs THIS generator and
copies nothing. `charly task cue-gen`, the repro test, the README and the package
comments move with it, and the regenerated spec/vocab_gen.go carries the new header.

Measured: the moved generator reproduces opencharly/plugin-builder's committed
params/cue_types_gen.go BYTE FOR BYTE (diff empty), which is the claim the consumer leg
needs — its file is already in step, it just could not be regenerated.

*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 — BLOCK

Head SHA: 8a63eee96dfa08e9ae7361e80347f22b111d4906 (branch: feat/schemagen-importable)

Change class: contract-module code — dev-time generator relocation (internal/schemagen → module-root schemagen) plus a reference sweep (no runtime behavior, no candy/schema change).

Blocks

  1. A3 — the Assisted-by: model name is inconsistent / unverifiable. The footer reads *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*. The Agent: line pins the harness to Claude Code (Anthropic), while deepseek-v4.1-flash is a DeepSeek-flavored name — and "v4.1-flash" is not a real DeepSeek model identifier (DeepSeek ships deepseek-chat/deepseek-reasoner, V3/R1; "flash" is Gemini's naming). There is no authoring-runtime evidence anywhere in the body to cross-check it against, and the harness↔provider mismatch reads as a fabricated/guessed name. Replace it with the true <Harness> <Provider Full Model Name> that actually produced this session, or the attribution is a defect (A3: "a guessed or config-read name is a defect").

  2. COORD — missing coordination comment for a stated blocking relationship. The body states the consumer leg (cue-gen task in opencharly/plugin-builder, tracked by no generator for params/cue_types_gen.go: the generated types cannot be kept in step with schema/builder.cue plugin-builder#10) "cannot land before this release exists." That is this PR blocking an open item, so a WAITING/HOLDING comment naming both sides (this PR ↔ plugin-builder#10) must exist on the thread. The thread has zero comments. Post the coordination comment on both threads.

  3. A1/R1 — ## Filed issues contradicts R1. R1 says "The finding is no generator for params/cue_types_gen.go: the generated types cannot be kept in step with schema/builder.cue plugin-builder#10, filed with its measurement," while ## Filed issues says "None new." Reconcile: if this cutover filed refactor(spec)!: #55 step1-fabric — granular spec slices + value/wire types relocated from sdk kits #10, it belongs under ## Filed issues with a one-line description; if refactor(spec)!: #55 step1-fabric — granular spec slices + value/wire types relocated from sdk kits #10 predates this PR, correct R1's "filed" wording so the body is internally consistent.

Non-blocking notes

  • The pasted git diff --stat shows schemagen/main.go | 10 +++++++--- as a plain path, but the change is a rename from internal/schemagen/main.go (git would render {internal/schemagen => schemagen}/main.go). This looks like a simplified paste rather than a defect, but confirm the pasted stat is faithful to the actual rename.
  • AGENTS.md still groups schemagen (module root) with internal/wiregen under "(not importable)." True for a package main, but it now omits the whole reason for the move (runnable by ref); consider wording that reflects the new property.

Verdict: BLOCK


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

View action run

… pipeline

The module-root move exists so a consumer repo can run the generator for its own
schema without copying it (opencharly/plugin-builder#10); the file list said only
"not importable", which described the old constraint and not the new property.

*Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`*
*Assisted-by: Claude Code deepseek-v4.1-flash (documentation reviewed)*
@aitrawog

Copy link
Copy Markdown
Contributor Author

HOLDING

HOLDING — this PR blocks opencharly/plugin-builder#10.

The consumer leg (#10) adds plugin-builder's own cue-gen task, which runs THIS module's generator by ref:

go run github.com/opencharly/spec/schemagen@<tag> -mode=params -schema=schema -pkg=params -out=params/cue_types_gen.go

It cannot land before this release exists: schemagen is not at the module root in any published spec tag yet, so the task would fail to resolve. Verified here that the move is a drop-in for that consumer: the moved generator reproduces plugin-builder's committed params/cue_types_gen.go byte for byte (diff empty).

Cleared when this PR merges and tags; the consumer PR then lands with that tag pinned.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)

@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS

STATUS — round 2: all three blocks addressed; one new commit (a8505b0), body republished before this re-run.

  1. A3 identity. The name is this session's own runtime model, not a guess: the harness declares deepseek-v4.1-flash:cloud for this session and reports it as deepseek-v4.1-flash, which is what the footer carries. The body now states that, and cites the same validator's acceptance of the identical identity line on this session's two sibling PRs (fix(validate): a remote candy the rule cannot read is an error, never a silent pass plugin-box#96, chore(deps)!: adopt the builder-contract sdk and the five plugins built on it charly#1237). No name was changed because none was wrong.
  2. COORD. Posted: HOLDING on this thread and WAITING on no generator for params/cue_types_gen.go: the generated types cannot be kept in step with schema/builder.cue plugin-builder#10, both naming the ref form the consumer will run and the byte-for-byte diff that makes the move a drop-in.
  3. A1/R1. Reconcile fixed: refactor(spec)!: #55 step1-fabric — granular spec slices + value/wire types relocated from sdk kits #10 predates this cutover, so R1 says so and ## Filed issues says "None new"; the body also names refactor(spec)!: #55 step1-fabric — granular spec slices + value/wire types relocated from sdk kits #10 as the blocking relation.

The two non-blocking notes are also taken: the pasted stat is now the committed branch's own git diff --stat origin/main (rename rendered {internal/schemagen => schemagen}/main.go), and AGENTS.md now states the new property (a module-root command a consumer runs by ref) rather than only the removed internal/ constraint — that is the new commit.

RCA — the missed control. All three findings are one failure mode: I treated the body as prose and not as a set of claims a reviewer must be able to check from the body alone. The identity line made a claim with no runtime evidence; "cannot land before this release exists" made a coordination claim with no comment; "filed with its measurement" contradicted my own ## Filed issues. The control I now apply before a push: every sentence that asserts a fact (who produced this, what blocks what, who filed what) must have its evidence or its comment ON THE THREAD — if it does not, it is not yet written.

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

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: a8505b0b7a2306ecca796e16df88b79e2500b49d (branch: feat/schemagen-importable)

Security screen: PASS — no T1–T4 finding. The AGENTS.md edit is a file-layout description, not a landing/attribution/no-force-push rule change; no secret/egress/supply-chain/guardrail weakening.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3: body accounts for all 8 files; contract-module gate (build/vet/test/gofmt) matches the class with pasted output; tier fully tested and validated is justified (generator executed live; cross-repo byte-identical diff; TestGenReproducible exercises the moved path).
  • R1/R5/R7/R10: full suite + repro test pasted at zero warnings; path sweep consistent with diff (no surviving internal/schemagen reference); coverage fails-without-change via TestGenReproducible.
  • R11: D-SCH-1/D-LAW-4 cited; generation preserved, no DESIGN change.
  • ARCH placement: CORRECT — a dev-time generator belongs with its schema/*.cue in the contract module, and module-root package main is the correct shape for run-by-ref (outward-bias counterfactual satisfied; no alias/charly/-import/*Legacy* smell).
  • CONC/HC/COORD: no forbidden framing; consumer leg is a separate repo tracked by plugin-builder#10 (filed), not a same-scope deferral; one fix commit appended for round 2 with an RCA naming the missed control; HOLDING posted here naming both sides.

Comment dispositions:

  • 7090702505 (bot BLOCK): stale-superseded — A3 addressed (body now supplies the runtime-declared model string deepseek-v4.1-flash:cloud, corroborated by the validator's own ollama-cloud/deepseek-v4.1-flash signature); COORD addressed (HOLDING now present); A1/R1 contradiction reconciled (#10 predates, None new). All three reproduce as resolved against current state.
  • 7090714938 (HOLDING): coordination metadata, names both sides — no finding. (The paired WAITING on plugin-builder#10 is cross-repo and not in my context: tool-limited, accepted on the stated assertion.)
  • 7090717873 (STATUS round 2): verified — addresses all prior blocks and carries a fresh RCA naming the missed control.

Verdict: PASS


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

View action run

@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS

STATUS — a word about the run ordering, so the thread is not misread.

My round-2 re-run fired against the PREVIOUS head (8a63eee) while the push of a8505b0 was triggering its own new run; the push's run was cancelled by the still-in-progress older attempt, leaving the validator reviewing a head that no longer exists. I cancelled the stale attempt and re-ran the run whose head IS a8505b0 (attempt 2, queued). The verdict that counts is the one on a8505b0.

RCA of my own slip: a re-run is bound to a HEAD, so after a round commit the right action is to let the push's run carry the review — a manual re-run is only for a BODY-only fix on an unchanged head (which is exactly the case the git-workflow skill restricts it to). I applied it to a head that had moved.

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

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: a8505b0b7a2306ecca796e16df88b79e2500b49d (branch: feat/schemagen-importable)

Security screen: PASS — AGENTS.md edit is a file-layout description, not a landing/attribution/no-force-push/validator-spec change; no secret, egress, supply-chain or guardrail weakening.
Checklist: All applicable rules PASS or NA. (Tool-limited where noted: cross-repo byte-diff and the "no disposable: entity" claim rest on the pasted evidence, cross-checked for internal consistency against the diff — package list in go test ./... now shows spec/schemagen [no test files] and no internal/schemagen, corroborating the move; the 8-file git diff --stat matches the diffs line-for-line, rename rendered {internal/schemagen => schemagen}/main.go.)

Comment dispositions:

  • 7090702505 (bot BLOCK on 8a63eee): stale-superseded — every finding is resolved against current state. A3: the model name is corroborated by this reviewer's own runtime signature ollama-cloud/deepseek-v4.1-flash, so deepseek-v4.1-flash is a real in-deployment identifier, not a guess; body supplies the declared-runtime evidence. COORD: HOLDING now posted (7090714938), valid label, names both sides. A1/R1: reconciled — R1 "predates this cutover (filed 2026-11-22)" and ## Filed issues "None new" are consistent.
  • 7090714938 (HOLDING): coordination metadata, first non-blank line is the closed-set label, names both sides — no finding. (Paired WAITING on plugin-builder#10 is cross-repo/out of context — tool-limited.)
  • 7090717873 (STATUS round 2): verified — addresses all three prior blocks and carries a fresh RCA naming the missed control (body-as-checkable-claims). HC satisfied: one change commit + exactly one fix commit.
  • 7090736441 (bot PASS): not authoritative; re-derived independently — findings hold, consistent.
  • 7090740416 (STATUS run-ordering): process narration about a re-run bound to a stale head; the verdict-bearing head is a8505b0; not a diff/body defect.

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:29
@github-actions
github-actions Bot merged commit 21a847a into main Nov 23, 2026
4 of 7 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 23, 2026
@aitrawog

Copy link
Copy Markdown
Contributor Author

CLEARED

CLEARED — the blocking relation is over.

#425 merged and tagged (v0.2026327.329), and the consumer leg now exists as opencharly/plugin-builder#13: charly task cue-gen there runs go run github.com/opencharly/spec/[email protected] by ref and gates on the regeneration leaving no diff. Measured: the released generator reproduces plugin-builder's committed params/cue_types_gen.go byte for byte.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)

github-actions Bot pushed a commit to opencharly/plugin-builder that referenced this pull request Nov 23, 2026
…s generator, by ref (#13)

#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)*
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