Repository navigation
refactor(schema): derive the pi word sets from vocabulary tables - #11
Conversation
Convert the five inline `|` word unions in candy/plugin-agent-pi/schema/pi.cue to the §10.1 S3 vocabulary-table idiom: a `_`-prefixed table keyed by word, a derived `_…Word` list, and the field as `or()` of that list, each table tagged `@vocab(pi)`. Two sets are new tables — `_commandType` (the 32-word Pi RPC command catalog) and `_streamingBehavior` (2 words). The third is ONE table for the ONE upstream enum Pi renders in three fields: the command's `mode` and the state's `steeringMode` / `followUpMode` all accept `all | one-at-a-time`, so `_mode` has one home and all three fields are `or(_modeWord)` — the second occurrence is extracted, not copied. The accepted word sets are IDENTICAL before and after (32 commands, 2 streamingBehavior words, 2 mode words), read from the compiled CUE on both sides; the generated params type is byte-identical except for one doc comment, so no Go field, type or tag moves. The projection is regenerated with `charly candy params`, the generator that owns THIS repo's file: its documented retag contract adds the `yaml:` tag beside every `json:` one (plugin-candy's params_test.go), and raw `cue exp gengotypes` at v0.16.1 drops those tags, so the raw form is the one that does not reproduce the committed projection here. A new schema_served_test.go composes the plugin's own Describe reply and compiles the body the host receives — the load gate `charly box validate` does not provide (opencharly/spec#301) — and pins the table → derived list → enum derivation for all three tables and all five fields. Refs opencharly/opencharly#945 (the census), opencharly/opencharly#950 (the sequence), opencharly/plugin-jetkvm#15 and opencharly/plugin-cua#10. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
|
STATUS — the plugin-agent-pi §10.1 S3 sweep is open as this PR. Head Next: the validator's verdict. The census and the pin are the lead's, by emission, in the umbrella change that advances the pin. Agent: charly |
Review — BLOCKHead SHA: Change class: plugin CUE-schema refactor (candy) + regenerated Go projection + new Go test. No core/sdk. Security screen: PASS (no T1–T4 findings; Blocks
Comment disposition
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
The previous commit carried two formatting collateral changes that are not part of the §10.1 S3 sweep: `images?: [..._]` lost its `_` element type (cue fmt rewrote it to `[...]`), and every field label in #PiRPCCommand and #PiRPCState was re-aligned. Neither is a word set and neither was stated in the body. Restore the file's original formatting and the `[..._]` element type so the diff against origin/main is exactly the five unions replaced by three vocabulary tables. The generated projection is unchanged by this commit (it already compiled from the same schema semantics) and a second `charly candy params` run is still `current`. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
|
STATUS — round 2 is pushed at A1 (unaccounted A3 (attribution not evidenced). Fixed by pasting the harness's own session descriptor, which names The body is re-finalized for the new head, the gate was re-run on it (build, vet, gofmt, Next: the validator's verdict on the new head. Agent: charly |
Review — BLOCKHead SHA: Change class: plugin candy CUE-schema refactor (five Security screen: PASS (no T1–T4 findings; The two prior-head BLOCK findings are genuinely resolved in the current state: Blocks
Comment disposition
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS — the round-2 finding is fixed by a body-only change; the gate was re-run on the SAME head The finding: the pasted differential said Next: the re-run's verdict on the same head. Agent: charly |
Review — PASSHead SHA: Security screen: PASS (no T1–T4 findings; Comment disposition:
Non-blocking observation (not a stated-rule obligation, so not a block): R6 prose says the branch "carries one commit" while the PR commit list shows two ( Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…es (#65) Convert the five `mode` word unions in candy/plugin-task/schema/task.cue to the §10.1 S3 vocabulary-table idiom: a `_`-prefixed table keyed by word, a derived `_...Word` list, and the field as `or()` of that list, each table tagged `@vocab(task)`. That is the 4 `union` rows design/dpat-baseline.tsv records for this file, and the row count is a property of the OLD file's FORMATTING: four distinct lines, five FIELD SITES — `mode?: "sync" | "check"` appears twice (#SpliceRegionInput and #ModulePinsInput, written identically) and the census records it once with a count of 2. So THREE tables cover FIVE fields: _submodulesMode status bump verify currency #GitSubmodulesInput.mode _checkSync check sync #FileParityInput.mode #SpliceRegionInput.mode #ModulePinsInput.mode _pruneMode report prune #PruneInput.mode `_checkSync` is the one two-word set three verbs share, so it has ONE home and three consumers rather than three copies that could drift apart (R2). No union in this file carried a default, a scalar-type alternative, or a heterogeneous or struct alternative; nothing is left to judgement. The accepted sets are IDENTICAL before and after (4/2/2/2/2 words), read from the compiled CUE on both sides, and the differential is zero-verdict: 163 cases across 46 categories, no verdict moved in either direction. The generated projection does not move at all: `charly candy params plugin-task --check` says current on the pristine tree and after the sweep, so this diff carries no params/cue_types_gen.go change. Raw `cue exp gengotypes` would NOT reproduce it — it drops the `yaml:` retag the wrapper adds to all 28 tagged fields, 112 diff lines — so the wrapper is the instrument that owns the file. Two tests are added. schema_served_test.go composes the plugin's own Describe reply and compiles the body the host receives (the load gate `charly box validate` does not provide, opencharly/spec#301), pins the table -> derived list -> field-enum derivation for all three tables and the @vocab owner, and mutates a table to prove each field is DERIVED from it rather than merely equal to it. mode_dispatch_test.go keeps each of the five `mode` fields and the Go function that dispatches on it in step in BOTH directions, and pins the four Go-level defaults for an omitted mode against the words the schema accepts. Refs opencharly/opencharly#945 (the census), opencharly/opencharly#950 (the sequence), opencharly/plugin-jetkvm#15, opencharly/plugin-cua#10, opencharly/plugin-punktfunk#20, opencharly/plugin-gh#13, opencharly/plugin-agent-pi#11, opencharly/plugin-omarchy#11 and opencharly/plugin-agent#15. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated) Co-authored-by: aitrawog <[email protected]>
Summary
Convert the five inline
|word unions incandy/plugin-agent-pi/schema/pi.cueto the §10.1 S3 vocabulary-table idiom, so each closed set of words has ONE home
and the enum a document meets is
or()of that table's keys:That is the 13
unionrowsdesign/dpat-baseline.tsvrecords forplugin-agent-pi/candy/plugin-agent-pi/schema/pi.cue. They are FIVEdisjunctions, not 13: the 32-word Pi RPC command catalog is written one
alternative per line (9 rows), and
streamingBehavior, the commandmode, thestate
steeringModeand the statefollowUpModeare each written on one line(4 rows). The catalog's last word,
extension_ui_response, closes its line aftera
|, so it carries a row too — which is why the catalog is 9 rows for 32 words.One extraction beyond the field-by-field kind. Pi renders ONE two-word enum
in three fields: the command
modeand the statesteeringMode/followUpModeall accept
all | one-at-a-time. Two tables for that would be a copy, so_modeis ONE table and all three fields are
or(_modeWord)— extracted on the secondoccurrence, per R2. A later divergence of any one field is then one table split,
not three literals to find.
How this repo was picked, by shape. The umbrella's
unionrows, grouped byowner, on
origin/main:specis the producer and out of scope;plugin-egress's 16 rows are 16separate single-line unions, ~3 not word lists;
plugin-punktfunk(11 rows = 2disjunctions) landed first.
plugin-agent-piis next: five disjunctions, allpure word lists, no defaults, no heterogeneous or struct alternatives. Every
row this repo carried is retired by this PR; nothing is left to judgement.
The accepted sets are IDENTICAL before and after — 32 command types, 2
streamingBehavior words, 2 mode words — read from the compiled CUE on both sides
(250-case differential below). The generated Go does not move either: every
field, type and tag is byte-identical, and the only line the regeneration changes
is one doc comment.
The diff is exactly the five unions. Every other line of
pi.cueisbyte-identical to
origin/main, includingimages?: [..._]and the labelalignment — the first head of this PR carried two formatting collateral edits
(
cue fmtrewrote[..._]to[...]and re-aligned the fields), and the reviewround's fix commit restored them, so the file now carries only the sweep.
Files the diff carries:
schema/pi.cueparams/cue_types_gen.goschema_served_test.goDescribereply, compiles the served body, pins the table → derived list → enum derivation for all three tables and all five fieldsgo.modcuelang.org/gobecomes a direct requirement (the test imports it)Head
d662fb4eade821961ffdc7d80774a7c1b1e12bd1.How tested
Everything below ran on the committed tree, at that head.
1. The projection is the repo's own generator's output, and a re-run is
byte-identical. This repo's committed projection is produced by
charly candy params, and the measurement decides it: on the PRISTINE treecharly candy params --checksaidcurrent, while rawcue exp gengotypesat[email protected]changes 96 lines against the committed file — it drops theyaml:tag thecandy paramsretag contract puts beside everyjson:one(plugin-candy's
params_test.gopins that contract). The raw form therefore doesnot reproduce this repo's projection, and the wrapper is the generator that
owns it. After the sweep, three runs carry one sha256 and
--checkis current:and the generated Go does not move: the only changed line is the doc comment on
Type, because a derivedor()still generates the same named string type.2. The module gate, on the final tree:
with
GOTOOLCHAIN=go1.26.4, the versiongo.modpins (host note, no finding:this host's default
goisgo1.27.3-X:nodwarf5, and pinning the module's ownversion reproduces the gate).
3. The schema still LOADS through
NewMeta().Describe, and the body it servescompiles.
charly box validatedoes NOT compile a served schema(opencharly/spec#301), so the load gate is the plugin's own
Describereply,compiled with the same CUE library the runtime links:
and the repo's structural check:
(that
charlyis the umbrella tree's worktree-local build,2026.306.0314).4. The accepted surface did not move: 250 cases, 20 categories, ZERO verdicts
moved in either direction. Both schemas are compiled from source — BEFORE from
origin/main(a59c500), AFTER from this tree — and the same documents arejudged with the EXACT operation the host performs (
spec/climodel'sValidateCUEInput, whichsdk.SchemaValidator.ValidateJSONdelegates to:input.Unify(def).Validate(cue.Concrete(true))). The case set is derived from thecompiled enums, never restated by hand: six blocks over every command word, the
2 streamingBehavior words and 5 refusals, the 2 mode words against ALL THREE
fields plus 5 refusals each, 6 command-shape cases, 5 structural cases, 6 state
documents, 4 state-response documents, 6 sub-command documents, and the three
fixture documents this repo's own
plugin_test.gouses.The 102 moved error TEXTS are CUE's own summarising — a near-miss command reports
a longer disjunction summary before, a shorter one after; the verdict, the
failing field path and the refusal are the same.
The rig is not green by construction: making
typeoptional (word set unchanged)turns it red.
5. Every new test fails on a planted break — five plants, each applied to the
committed tree, observed red, then restored from a saved copy:
6. The text-parsed disjunction check came first. This repo has NO test that
reads a union's textual form —
git grep -n -e ReadFile -e schemaFS -e '.cue' HEAD -- '*_test.go'exits 1 — so there was nothing to fix here. The existingTestPiRPCBoundaryRejectsUnknownCommandsAndIncompleteStatevalidates through theembedded schema, not by parsing it, and still passes; the new served-schema test
adds the enum-coverage half the repo lacked.
7. The census gate. The umbrella's
design/dpat-baseline.tsvand itsemission are the lead's, by emission, in the change that advances the pin; this
PR touches neither the census nor the umbrella.
Review round
The first head (
871ab7e59b979219d49ab534ca217ff66099de74) returned a BLOCK with two findings;both are fixed in
d662fb4eade821961ffdc7d80774a7c1b1e12bd1, and this body is keyed to that head.A1 — unaccounted CUE edit (
images?: [..._]→[...]). Fixed by REVERTING it: the file isrestored to
origin/main's formatting and that element type, and only the five unions change.RCA (missed control): I ran
cue fmtfor tidiness and read its output as "formatting only",without diffing the FILE against
origin/mainline by line before committing. The control I nowapply is the one the body relies on:
git diff origin/main -- <schema>is read in full and everychanged line is classified as a union, the table block, or nothing —
imagesis no longer in it.A3 — attribution model/provider not evidenced in the body. Fixed by pasting the harness's own
session descriptor, which names
agentProvider: ollama-cloudandagentModel: deepseek-v4.1-flash, besidedsh --version. RCA (missed control): I pasted the harnessversion and the session id but not the descriptor record that carries the provider and model, so
the trailer was an assertion rather than a quotation. The control now is to paste the two
descriptor records the runtime writes at session start.
Round 2 — body contradicted its own pasted evidence (error-text count). The differential
output said
102, the prose below it said103. Fixed to102in both places. RCA (missedcontrol): I patched the pasted output but not the prose that quotes it, so a body-wide claim
changed in one place and not the other. The control now is to grep the body for every instance
of a changed number before finalizing;
grep -n '10[23]'finds one of each, and they agree.No other finding was raised; the comments on this PR were coordination metadata, not defects.
Rulebook compliance
R0 — skills first. Read this repo's
AGENTS.md(viagit show origin/main:AGENTS.md) and the umbrella's rulebook before the firstedit; loaded
/charly-internals:git-workflow,/charly-internals:plugin,/charly-internals:go,/charly-automation:agentand/charly-check:check—the five the dispatcher selects for a plugin CUE schema, the Pi runtime, and a
PR landing.
R1 — every anomaly root-caused, then fixed. One finding, in scope and fixed
here: the instrument itself. Raw
cue exp gengotypesat the pinned cue doesNOT reproduce this repo's committed projection (96 changed lines, every one the
documented
yaml:retag), so using it would have landed a mass tag changeunrelated to the sweep. Root cause: the projection is produced by
charly candy params, whose retag contract is pinned by plugin-candy'sparams_test.go; the fix is to use the generator that owns the file, verifiedby
--checkon the pristine tree and by three identical runs after. No gatewarned: every command below exited 0.
R2 — no duplication. Each word set has ONE home, the
_xtable; thederived
_xWordlist is a comprehension, not a copy; the enum isor()of it.The shared
all | one-at-a-timeset appears in ONE table and is used by threefields — the second occurrence was extracted, not copied. The test readers
(
servedSchema,schemaWordList) live once.R3 — no workarounds. No sleeps, retries or suppressions. The projection is
produced by the repo's generator instead of being hand-edited, and
GOTOOLCHAIN=go1.26.4runs the versiongo.modpins instead of hiding atoolchain skew.
R4 — product before prose. N/A — no documented command, user-facing
instruction or emitted page changes. The one prose edit describes the shape it
now has, in the same commit.
R5 — legacy deleted completely, with the grep. The retired form is gone:
R6 — user work preserved, git safe.
git statuswas read before stagingand is clean after the commit; the four intended paths were staged by literal
pathspec; the branch was re-created on fresh
origin/main(a59c500— it movedwhile this unit was being prepared) and carries one commit;
git commit -F; noforce-push, no history rewrite, no hook bypass, no direct push to
main. Theumbrella was never edited: no pin, no
design/dpat-baseline.tsv, no census row.The identity used is repo-local (
aitrawog <[email protected]>).R7 — proved behaviour, and the proof can fail. Five plants turn the new
tests red (§5); the differential rig turns red on a semantic plant (§4); the
changed artefact is validated at its boundary — the served body as the host
receives it, and the projection against the generator that owns it.
R8 — live or skip, never fake. N/A — this change crosses no service
boundary: it moves CUE words and a generated projection, and nothing in it
contacts an agent process, a transport or a registry. The word sets are proven
identical, so no live run could distinguish the before and after trees.
R9 — binary equals source. No
charlysource changed and no new runtime OSdependency. The module's dependency block moves one line:
cuelang.org/go v0.16.1becomes a DIRECT requirement because the new test imports the CUE API— the same promotion the two precedents made.
R10 — fresh proof on the gate that owns the change. This repo declares no
per-repo candy gate; the gates that own it are the module build/test above, the
projection currency check, and the served-schema load gate. All ran on the
committed tree with zero warnings. The org-wide required
charly/pr-validatoris the merge gate and runs on this PR. No live consumer is claimed: the
piruntime's acceptance is its own bed in a consumer repo, and the word sets here
are proven identical.
Cutover and landing. One phase, one commit. The census rows live in the
umbrella and are lowered there by the lead only after this lands and the pin
advances, never from this PR.
AI attribution (A3). The trailer carries this runtime's exact names. The
harness's own session descriptor names the model
deepseek-v4.1-flashand thesession, and
dsh --versionprints the harness version — no config file is theevidence:
The second record is the harness's own session descriptor, not a config file: it names
agentProvider: ollama-cloudandagentModel: deepseek-v4.1-flash, which is exactly theprovider-qualified model in the trailer.
The tier
fully tested and validatedis the tier the gates above earned onthis tree.
Change classification
Internal schema refactor — no consumer-visible change. The accepted surface does
not move (250 cases, zero verdicts moved); the generated Go does not move
(identical types, fields and tags, one comment); no definition is renamed or
removed; no accepted word is added or dropped. The shared mode set now has one
home, so a future divergence of
mode/steeringMode/followUpModeis onetable split. What DOES change is the served CUE TEXT (the schema a host splices),
so a published page that renders that text verbatim will show the derived form
after its own regeneration — the lag both precedents left in place.
Breaking change + rollback: none — no word is added, dropped or renamed, no
definition is renamed, and the generated Go is byte-identical apart from one doc
comment, so no consumer action and no migration is owed; backing the change out is
one inverse commit. The census rows this retires are lowered in the umbrella by the
lead, by emission, in the change that advances the pin.
Filed issues
None — no R1 finding was separable from this change; the one finding (the
instrument) is fixed in this diff.
Agent: charly
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)