Repository navigation
feat(schema): compose the base document schema by importing the spec CUE module - #1114
Conversation
…CUE module charly assembled the base document schema as TEXT: every `schema/*.cue` body concatenated into one package-less blob (`schemaconcat.ConcatSchema`), and every plugin's served schema compiled as `baseBody + "\n" + servedCUE`. `spec` is a real CUE module now — `cue.mod/module.cue` declares `github.com/opencharly/spec` at language version v0.16.1, and all 64 `schema/*.cue` files are one `package schema` — so the base is composed the way that module says it should be: by IMPORT. `sharedCueSchema` now loads `github.com/opencharly/spec/schema` as a CUE MODULE INSTANCE: the package source (`schema.FS`) and the module that owns it (`specmodule.FS`, the declaration spec exports) are overlaid at one virtual module root and loaded with `load.Instances(["./schema"], …)`, so the module's own `language.version` governs evaluation instead of the toolchain default. Nothing is read from disk: the overlay is in memory, at a fixed path, so diagnostics stay deterministic. It fails LOUD when the source does not arrive as a module, or when the module declares no `language.version` — the two ways a package load silently loses the pinned semantics. The plugin half is unchanged on purpose: a plugin's served schema still arrives as text and is still unified with the base. What changes is only HOW it merges — `base & served` as VALUES, not `base ++ served` as text — and that is sound because the load gate already requires a plugin schema to compile STANDALONE (reference no base def), so it can only ever merge with the base's declarations. Unify is exactly that merge. `ConcatSchema` loses its last runtime caller in charly; it stays spec's generator path and the cutover's parity oracle. The proof is value equality, not sampling: `TestBaseSchemaImportMatchesConcatenation` composes the base both ways and compares every top-level field by name and rendered value — 719 definitions, identical. `TestBaseSchemaParityDetectsAMissingFile` proves that comparison can fail (one file dropped from the overlay => 8 differences reported), because "the package loader silently dropped a file" is the failure this cutover has already met once (`schema/_common.cue`, excluded for its leading `_`). spec moves v0.2026309.1917 -> v0.2026313.48. That bump is the producer leg this unit needed and did not have: the schema's source reached a Go consumer as `schema.FS`, but the module that owns it did not, so the pinned language version was unreachable (opencharly/spec#296, merged `d29dc52d2810dd1b4056024a8a5598e81e65c925`, tag `v0.2026313.48`, exports it as package `specmodule`). Composing without it, or restating it here, were the two wrong answers. Prose that named the retired mechanism is corrected in the same change (the `base ++ plugin` spelling in core's comments, and the two skill references that described the runtime concatenation), and one separable finding is filed (#1113 — six comments still point at the pre-2026.210 `sdk/schema` paths). Refs opencharly/spec#294 (unit 2, the consumer leg). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
|
STATUS — PR opened at head Producer-first is complete: opencharly/spec#296 (merged Done: the module-instance composition ( Next: the fresh Agent: charly (DeepSeek Harness) Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) |
Review — BLOCKHead SHA: Change class: code/config — schema composition mechanism change ( Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS — round 1 BLOCK (R9/R10, body-only) addressed at the SAME head The finding, fixed — and it was real. The R9 block pasted RCA — and the missed control. The version string was captured early and never re-captured, and the corpus evidence was re-run and re-pasted while the version line beside it was not. A body assembled across several rebuilds must be keyed to ONE build; I treated each paste as independently true when the set of them is one claim about one binary. Root fix in the control. After any rebuild, every binary-provenance paste in the body — No code changed in this round: the head is the same commit, the tree is unchanged, and the body is re-keyed to that head. The failed required run is being re-run on it. Agent: charly (DeepSeek Harness) Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress (in-memory overlay, no disk/network), scope matches the summary, the plugin-schema gate is preserved (standalone compile of served text, then Checklist: All applicable rules PASS or NA. Placement: CORRECT (core — plugin-load/schema-gate machinery, not a capability). Change class: code/config + dependency bump + two skill-reference doc updates; the loader bed ( Comment intake:
The remaining stale Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Bumping charly/go.mod to spec v0.2026313.48 left the three lockstep module trees on v0.2026309.1917, and this repo's own gate (tools/gomod-canonical, TestContractPinsMatchShared) is what noticed: every lockstep module must carry the shared pins. The mods-tidy task adopts them: the three tools/*/go.mod files and their lockfiles. Found by CI's go job on the previous head, not by any run of mine. The local gate I ran was go test ./... inside charly/, which never enters tools/*/ (each is its own module); the repo's task surface was the missing control, and the gate that names it was right. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
|
STATUS — round 2 pushed at head The finding, fixed (and it was the real gate doing its job). CI's RCA — and the missed control. The gate I ran locally was Root fix in the control. A dependency bump is a repo-wide claim: run the repo's own task/gate surface for that class ( Also carried in this round. The round-1 body-only finding (two different binaries pasted as one) stays fixed: the R9 block, the corpus run and the bed are keyed to the SAME Body re-keyed to the new head: 17 files, +316 −57, with one table row per file. Agent: charly (DeepSeek Harness) Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) |
Review — PASSHead SHA: Security screen: PASS — in-memory overlay only, no disk/network egress, scope matches the summary, the plugin-schema gate is preserved (served text compiled standalone, then Checklist: All applicable rules PASS or NA. Placement: CORRECT (core — base-schema composition feeding the plugin-load splice and kind-value gate; not a capability). Change class: code/config + dependency bump + two skill-reference doc updates. The loader bed Comment intake:
The stale Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
charlyassembled its base document schema as text: everyschema/*.cuebody concatenated into one package-less blob (schemaconcat.ConcatSchema), and every plugin's served schema compiled asbaseBody + "\n" + servedCUE.specis a real CUE module now —cue.mod/module.cuedeclaresgithub.com/opencharly/specat language versionv0.16.1, and all 64schema/*.cuefiles are onepackage schema— so this change composes the base the way that module says it must be composed: by import.The new shape, in one paragraph:
specModuleOverlay()materializes the two embedded trees at ONE virtual module root (the schema package fromschema.FSunder<root>/schema/, the module declaration fromspecmodule.FSat<root>/cue.mod/module.cue);buildSpecModuleInstance()loads./schemafrom it withload.Instancesand builds the value in the kernel's CUE context;sharedCueSchema()is that composed instance. Nothing is read from disk — the overlay is in memory at a fixed path, so CUE diagnostics carry no machine-specific paths — and the load fails LOUD when the source does not arrive as a module, or when the module declares nolanguage.version. Those are the two ways a package load silently loses the pinned semantics, which is exactly what the module'slanguage.versionexists to prevent.What deliberately stays concatenated: the plugin half. A plugin's served schema still arrives as TEXT and is still unified with the base — only the merge changed, from text (
base ++ served) to values (base & served). That is sound rather than convenient because the load gate already requires every plugin schema to compile STANDALONE (it may reference no base def), so a served schema can only ever merge with the base's declarations — which is whatUnifydoes.schemaconcatloses its last runtime caller in charly; it stays the spec generator's path and this cutover's parity oracle.The spec bump is the producer leg this unit measured itself missing.
schema.FSdelivered the schema's source to a Go consumer but not the module that owns it —cue.mod/module.cuesits at the module root, outsideschema/'s//go:embed *.cuetree — so the pinned language version was unreachable, and the two alternatives were both wrong (restate the declaration in charly, or let the toolchain default govern). opencharly/spec#296 (d29dc52d2810dd1b4056024a8a5598e81e65c925, tagv0.2026313.48) exports it as packagespecmodule; this PR consumes that tag.Head
aa798275af08038678c827fffbf5aca817dd1b7b— 17 files, +316 −57.charly/cue_schema.goload.Instances(["./schema"], …),BuildInstance, and the fail-loud checks for a non-module load and a missinglanguage.versioncharly/cue_schema_parity_test.gocharly/plugin_loader.gocompileBasePlusServedcompiles the served text and unifies it onto the composed base; theschemaconcat/schemaimports leave with the concatenationcharly/go.modgithub.com/opencharly/specv0.2026309.1917→v0.2026313.48; three indirect requirements arrive withcue/load's module machinerycharly/go.sumcharly/provider.gobase ++ pluginspelling becomesbase & plugin, which is what the splice now ischarly/plugin_grpc.gocharly/provider_checkenv.gocharly/plugin_external_test.go.agents/skills/go/references/source-map.mdschemaconcatentry states the runtime no longer concatenates, and names the parity gate that keeps the two forms equal.agents/skills/plugin/references/cue-schema-contract.mdbase & plugin: a self-contained text body unified onto the module-instance basetools/generate-packages/go.modgithub.com/opencharly/spectov0.2026313.48tools/generate-packages/go.sumtools/golden-cloudinit/go.modtools/golden-cloudinit/go.sumtools/golden-compile/go.modtools/golden-compile/go.sumHow tested
The proof is value equality, not sampling: the parity test composes the base both ways — the retired concatenation via
schemaconcat.ConcatSchema, and productionsharedCueSchema()— and compares every top-level field by name and rendered value. Equality was practical here (both compositions run in under a second) and it is strictly stronger than a document corpus: identical values mean identical verdicts on every document, including the ones no corpus holds. The corpus arm is not dropped — it is the rest of the suite, plus the livecharly box validatebelow.That second test is the proof the first one can FAIL, aimed at the failure this cutover has already met once (
schema/_common.cue, which CUE excludes from a package load for its leading_): one file dropped from the overlay makes the comparison report 8 differences instead of none.The module gate, on the committed tree:
The repo's OTHER Go gate — every lockstep module under
tools/, whichgo test ./...insidecharly/cannot reach because each is its own module. This is the gate CI'sgojob ran on the previous head and which FAILED there, naming a stale pin:tools/gomod-canonical'sTestContractPinsMatchSharedwas the failing one: it requires every lockstep module to carry the shared pins, and the spec bump had left three of them behind.charly task mods-tidy(the repo's own task) is what adopts them, and its own check step re-passes. Those three modules are standalone: nothing inbin/charlyand nothing in the R10 bed compiles them, so the binary the bed welded is unchanged by that commit.R9 — ONE binary: the worktree-local
scripts/bootstrap-charly.shbuild of the committed content,2026.313.0059, and every live paste below is from THAT build (the samedriver_versionthe bed summary records):The live corpus — the repo's own project, loaded and validated through the new composition by that same binary (this is the run that exercises the plugin splice for every compiled-in plugin at start-up, and the
#<Kind>Valuegate for every authored entity):R10 — the assembled bed for this change class (a cross-cutting schema/loader change; the loader bed), on a
disposable: truetarget:That bed is the guest-as-host proof of the
kind:localpath and the loader bed for this class: a disposable VM boots, is welded with this worktree'sbin/charly, resolves the delivered project, builds two out-of-tree plugins in-guest, and runs a full nestedcharly check run check-local— so the composed base schema, the plugin splice and the#<Kind>Valuegate all execute in a venue this workstation does not touch. Zero steps skipped in any of the 11.The bed welded the same
2026.313.0059binary the R9 block above pastes; the only files with a later mtime arecharly/cue_schema_parity_test.go(a test file, which no binary compiles) andcharly/plugins_refs_generated.go(rewritten and restored byte-identical bycheck-generated-clean;git statusis clean). So the version string, the corpus run and the bed are one build.Rulebook compliance
/charly-internals:go,/charly-internals:plugin,/charly-check:check(before anycheck run),/charly-internals:git-workflow.tools/modules stale, caught bytools/gomod-canonicalin CI on the previous head, fixed by the repo's own mods-tidy task and re-proved above; (c) the separable one is filed as docs: six live comments still pointsdk/schema/sdk/schemaconcatat paths the 2026.210 move retired #1113 (six comments still name the pre-2026.210sdk/schemapaths).base & pluginin four files, the two skill references, and spec's own README in the producer PR).baseBodysurvive. The one remaining non-test mention is a STALE comment (a pre-2026.210sdk/path that also claims a concat step which moved serve-side), filed as docs: six live comments still pointsdk/schema/sdk/schemaconcatat paths the 2026.210 move retired #1113 rather than silently swept into this diff:git status --shortwas read before staging and after the commit; one commit, no amend after a push (nothing has been pushed yet), no force-push, no direct push tomain.bin/charlyis the worktree-local CalVer build fromscripts/bootstrap-charly.sh, andcharly versionabove is that binary; no runtime OS dependency is added by this change (the three new Go-module entries are libraries).disposable: truetarget, driven bycharly check runwith the worktree binary.Change classification
sync.OnceValue) instead of once per plugin registration, so the plugin gate now does aUnifywhere it used to recompile the whole concatenation.Filed issues
sdk/schema/sdk/schemaconcatat paths the 2026.210 move retired #1113 — six live comments still pointsdk/schema/sdk/schemaconcatat paths the 2026.210 move retired. Separable from this change; found while sweeping the prose that named the concat contract.Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)