Repository navigation
feat(spec): the kind:pipeline lobster-syntax value, the #Workflow IR, and the workflow engine op envelopes - #189
Conversation
… and the workflow engine op envelopes
The workflow surface becomes CUE-first and single-source, in three additive pieces:
schema/pipeline.cue the AUTHORED `kind: pipeline` body, in lobster syntax and
extended with charly's OWN step grammar, so a workflow can
use any charly plugin of any provider class through the
normal core->plugin dispatch (no word is special-cased).
schema/workflow.cue the normalized, engine-agnostic IR every consumer lowers
from, plus the engine op envelopes. Lobster is one consumer;
a GitHub Actions consumer fits the same IR unchanged.
schema/candy.cue #ProviderClassNames gains "workflow" (additive; the derived
capability regex recomputes, so nothing is hand-edited).
Closure is the point of the authoring def: `cue exp gengotypes` renders every field
as a plain Go string, so a decode-only test cannot tell a closed body from an open
one. spec/pipeline_test.go therefore unifies CONCRETE values into #PipelineValue
against the same schemaconcat concatenation the runtime gate uses, and fails if a
retired key (stages:, command:, skip_when:, concurrency:) is re-accepted or an
unknown key is tolerated.
The exec-arm XOR (exactly one of run/pipeline/workflow/parallel/for_each/input/
plan/charly) is deliberately a GO rule in plugin-pipeline's OpValidate, not a CUE
disjunction: a nested entity-level disjunction breaks the closedness of the
surrounding def and collapses the generated Go type -- the same shape, and the same
reason, as the box.cue base/from precedent. The corpus asserts that boundary
explicitly (both zero arms and two arms are ACCEPTED by CUE) so the CUE/Go split is
pinned rather than assumed.
#PipelineClassRoutes makes "which route reaches this provider class" a DATA fact:
schemagen DERIVES spec.PipelineClassRoutes from the CUE table (a new strMapDef
extractor beside listValues), and TestPipelineClassCoverage fails when a class has
no route -- so adding a provider class forces the workflow route to be decided
rather than silently getting none.
The engine op selectors are PREFIXED (workflow-run/-resume/-schedule/-emit): a bare
"emit" collides with OpEmit (deploy/step) and "run" with OpRun, and ops.go's stated
invariant is that no two selectors share a value even across classes.
resultWire gains an optional captured_value (raw JSON) with ResultJSONCaptured and
ParseResultJSONFull, so a check verb can hand a consumer a structured value to
address by dotted path. It is omitted when unset, which keeps the wire
byte-identical for every existing producer; the test asserts those bytes.
No schema version: #754 retired the CalVer stamp and the load-time gate, and this
change deliberately does not reintroduce either.
Relates to opencharly/charly#758.
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
|
OWNING Scope: Owner: slug State: the change is committed and pushed; the two gates above ran green on the final tree and are pasted in the body. No R10 bed has run for this head — the beds that gate it compose This is a producer on the blocking chain. The consumers that wait on this tag — Next action: wait for the Agent: |
…spatch claim
Addresses the pr-validator's BLOCK on spec#189 (blocks 2 and 3; block 1 is the R10 bed,
which is not resolvable in this commit).
B2 (`schema/workflow.cue`) — REMOVED `#WorkflowValue`. Every `#<X>Value` def in schema/
is the host-side value gate for an AUTHORABLE ENTITY KIND, and schemagen DERIVES
spec.KindValueDefs from their names. Nothing serves `kind: workflow`: the kinds are
plugin-served (#Node is an open struct and the arm-derived KindWords is empty), and
plugin-lobster serves the `workflow` PROVIDER CLASS, not a kind. The def I added by
analogy with `#PipelineValue` therefore registered a kind no plugin serves, letting the
host gate a `kind: workflow` node against a def for a kind that does not exist. The IR is
the ENGINE WIRE, not a kind: it is produced by lowering and consumed by an engine, never
authored in a charly.yml. `kind: pipeline` is genuinely a kind (plugin-pipeline serves
it), which is why `#PipelineValue` stays and `#WorkflowValue` does not.
The validator could only flag this as "tool-limited ... I cannot confirm `workflow` is a
valid kind word" — a comment cannot settle it, so it is now pinned structurally:
`TestKindAndClassVocabulariesAreDisjoint` (spec/spec/pipeline_test.go) requires
KindValueDefs and ProviderClasses to stay disjoint, because a word in both is exactly
this bug. A kind is a word a plugin SERVES; a class is a face it is DISPATCHED through.
Verified the gate can fail: re-adding the `"workflow": "#WorkflowValue"` row makes it
report `"workflow" is BOTH a kind (KindValueDefs) and a provider class (ProviderClasses)`,
and restoring the file makes it pass again.
B2 (comments) — the header of `schema/workflow.cue` and the `#Pipeline.engine` comment in
`schema/pipeline.cue` both claimed the engine is "dispatched as `command:<engine>` ...
there is no new provider class". Both were false against this PR's own diff, which adds
the `workflow` class to `#ProviderClassNames` and documents the engine as
`InvokeProvider("workflow", <engine>, <op>)` in ops/ops.go. Both now state the shipped
dispatch, and name `command:lobster` as a SEPARATE, additional face of the same engine
plugin (its CLI) rather than the dispatch that runs a workflow. The
`#PipelineClassRoutes` `"workflow"` row is reconciled to say the same: the class IS the
engine plugin, reachable from inside a workflow by a `workflow:` sub-workflow step.
B3 — the body's test counts were stale ("19 concrete values, 15 accepted and 13
rejected", which is also arithmetically impossible). Recounted against the committed
file: 26 cases, 13 accepted and 13 rejected. The body carries the corrected numbers.
No change to the generated Go beyond removing the one KindValueDefs row; `spec.Workflow`
and every other generated type are unchanged. cue-gen remains reproducible.
Relates to opencharly/charly#758.
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — BLOCKHead SHA: Change class: schema / contract module — CUE + Go (code/config, not docs-only). Blocks
Comments considered
Tool-limited notes (not independently verifiable from the diff, flagging for the author)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
OWNING
Block 2 (R1/B5) — fixed, and root-caused past the comment level. The verdict flagged two comments that contradicted this PR's own diff. Both were true, and they were the symptom: the header of The cause was structural and the verdict could only see it as "tool-limited": Block 3 (A1) — fixed. The body's counts were stale and arithmetically impossible ("19 concrete values, 15 accepted and 13 rejected"). Recounted against the committed file: 26 cases, 13 accepted and 13 rejected. The body carries the corrected numbers. Block 1 (R10) — a bed ran, and passed. You asked for the required disposable-bed gate; running the plan's assembled B1 is impossible before W6, so the bed that can run was run: Two things this PR does not hide, both in the body:
Agent: |
…Arms Both blocking findings from the pr-validator verdict on af74f32, plus one consistency fix, in ONE commit. R3 — #PipelineSubStep re-declared the eight #PipelineFlow keys (`id`, `when`, `env`, `cwd`, `stdin`, `timeout_ms`, `on_error`, `retry`) verbatim instead of embedding the shared def, whose own comment states it is "Embedded by each step def". It now embeds #PipelineFlow, so the flow block is declared exactly once and embedded by all three step defs (#PipelineStepBase, #WorkflowStep, #PipelineSubStep). Verified: `retry?:` and `on_error?:` — the flow-block-unique keys — now each occur exactly once in schema/pipeline.cue. The remaining `timeout_ms?` occurrences are different concepts (`#PipelineApproval`'s approval timeout and `#PipelineParallel`'s parallel timeout), not copies of the flow block. gengotypes flattens the embed exactly as it already does for #PipelineStepBase, so the substep's Go fields are unchanged; only their ORDER in the generated struct moves. R1 — the #PipelineArms comment asserted "only the exec-arm XOR (Go) and the flow keys distinguish the two [authored step vs IR step]". That is false against this PR's own schema: both #PipelineStepBase and #WorkflowStep embed #PipelineFlow AND #PipelineArms, so everything declared there is COMMON to them, and the XOR is a Go rule in both. The comment now names the two fields that actually differ: `approval` (the authored terse union `bool | string | #PipelineApproval` vs the IR's normalized #WorkflowApproval object) and `result`, which is IR-only. Consistency — the #WorkflowStepResult comment described a charly step's body as "--json-output". The canonical name is "--output": it prints the final step's raw stdout, which is not necessarily JSON (lobster auto-parses it into `$id.json` when it is), and the session's W1/W3 contract uses `--output` in four places. The schema comment and the ledger now agree. Regenerated with `charly task cue-gen`; TestGenReproducible passes on the committed tree, so the committed generated Go is exactly what the generator emits.
Review — BLOCKHead SHA: Change class: schema / contract module — CUE + Go (code/config, not docs-only). Security screen: PASS — additive schema/selectors, no secrets, no egress, no guardrail loosening, no dependency/pin/CI edits, no injected directives in the body or comments. Blocks
Comments considered
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The workflow surface becomes CUE-first and single-source, in three additive pieces:
schema/pipeline.cue— the AUTHOREDkind: pipelinebody, in lobster syntax and extended with charly's OWN step grammar, so a workflow can use any charly plugin of any provider class through the normal core→plugin dispatch. No word is special-cased: a plugin released tomorrow is usable with no change here.schema/workflow.cue— the normalized, engine-agnostic IR every consumer lowers from, plus the engine op envelopes. Lobster is one consumer; a GitHub Actions consumer fits the same IR unchanged.schema/candy.cue—#ProviderClassNamesgains"workflow"(additive; the derived capability regex recomputes, so nothing is hand-edited).Closure is the point of the authoring def.
cue exp gengotypesrenders every field as a plain Gostring, so a decode-only test cannot tell a closed body from an open one.spec/pipeline_test.gotherefore unifies CONCRETE values into#PipelineValueagainst the sameschemaconcatconcatenation the runtime gate uses, and fails if a retired key (stages:,command:,skip_when:,concurrency:) is re-accepted or an unknown key is tolerated.The exec-arm XOR is deliberately a Go rule, not CUE. Exactly one of
run/pipeline/workflow/parallel/for_each/input/plan/charlyis enforced in plugin-pipeline'sOpValidate: a nested entity-level disjunction breaks the closedness of the surrounding def and collapses the generated Go type — the same shape, and the same reason, as thebox.cuebase/fromprecedent. The corpus asserts that boundary explicitly (both zero arms and two arms are ACCEPTED by CUE) so the CUE/Go split is pinned rather than assumed.The flow block is declared once and embedded — never re-stated.
#PipelineFlow(id/when/env/cwd/stdin/timeout_ms/on_error/retry) is embedded by all three step defs —#PipelineStepBase,#WorkflowStepand#PipelineSubStep— and by nothing else. The substep previously re-declared its eight keys verbatim, while that def's own comment already claimed it was "Embedded by each step def"; gengotypes FLATTENS the embed exactly as it already does for#PipelineStepBase, so the substep's Go fields are unchanged (only their order in the generated struct moves). An earlier revision of this branch also had the#PipelineArmscomment claim that the flow keys distinguish the authored step from the IR step: both embed the flow block, so they do not. The two fields that actually differ areapproval(the authored terse union vs the IR's normalized object) andresult, which is IR-only. §3(b2) is the de-duplication proof; §3(a) re-runs the corpus over the flattened shape.A KIND is a word a plugin SERVES; a CLASS is a face it is DISPATCHED through — and the two vocabularies must stay disjoint.
schema/pipeline.cuedefines#PipelineValue, which makesschemagenregisterKindValueDefs["pipeline"]: the host can now closedness-gate akind: pipelinebody with zero per-kind code, exactly the#TaskValueprecedent — andpipelinereally IS a kind (plugin-pipeline serves it). The IR gets no#WorkflowValue, deliberately, and the file says so in a NOTE: every#<X>Valuedef is the value gate for an authorable ENTITY KIND, so a#WorkflowValuewould registerworkflowas a kind that nothing serves — the kinds are plugin-served (#Nodeis an open struct and the arm-derivedKindWordsis empty), while plugin-lobster serves theworkflowPROVIDER CLASS. That is not a hypothetical: an earlier revision of this very branch shipped exactly that def. It is now pinned structurally, not by a comment — see the FAIL-then-PASS gate in §3(c).The engine dispatch is
InvokeProvider("workflow", <engine>, <op>). An earlier revision of this branch's comments claimed the engine was reached ascommand:<engine>with "no new provider class" — false against this PR's own diff, which adds theworkflowclass and the four prefixed op selectors.command:lobsteris a SEPARATE, additional face of the same engine plugin (its CLI), never the dispatch that runs a workflow. Corrected inschema/workflow.cue, in#Pipeline.engine, and in the#PipelineClassRoutes"workflow"row.#PipelineClassRoutesmakes "which route reaches this provider class" a DATA fact.schemagenDERIVESspec.PipelineClassRoutesfrom the CUE table (a newstrMapDefextractor besidelistValues), andTestPipelineClassCoveragefails when a class has no route — so adding a provider class forces the workflow route to be decided rather than silently getting none.The engine op selectors are PREFIXED (
workflow-run/-resume/-schedule/-emit): a bareemitcollides withOpEmit(deploy/step) andrunwithOpRun, andops.go's stated invariant is that no two selectors share a value even across classes.resultWiregains an optionalcaptured_value(raw JSON) withResultJSONCaptured/ParseResultJSONFull, so a check verb can hand a consumer a structured value to address by dotted path. It is omitted when unset, which keeps the wire byte-identical for every existing producer; a test asserts those bytes.No schema version.
charly#754retired the CalVer stamp and the load-time gate; this change deliberately does not reintroduce either.Files:
schema/pipeline.cuekind: pipelinebody +#PipelineValue+#PipelineClassRoutesschema/workflow.cue#WorkflowValue)schema/candy.cue#ProviderClassNamesgainsworkflowinternal/schemagen/main.gostrMapDefextractor + thePipelineClassRouteswiringops/ops.goresultWire.CapturedValuespec/pipeline_test.goops/ops_test.gospec/cue_types_gen.go,spec/vocab_gen.govocab_gen.gocarries the newKindValueDefs["pipeline"]row; noworkflowrow)How tested
Run in
/home/atrawog/Sync/Atrapub/lo/claude/opencharly/.worktrees/workflow-ir/specon the committed headbf8772a.1. The module's full Go gate
-count=1disables the test cache, so every package above re-ran on this head;.../spec/spec— the changed package — took1.449s, not(cached), so the corpus in §3 executed here.gofmt -l .is clean.1b. Lint — the CI's own pinned binary, run locally
This is the exact version
ci.ymlpins ([email protected]), installed the same way the workflow installs it, so the local result and the CI result cannot disagree.2. The generation gate — reproducible on the committed tree
git status --porcelainis empty after the run: the committed generated files are exactly what the generator produces, sospec/cue_types_gen.goin this PR — including thePipelineSubStepfield reorder that this revision's#PipelineFlowembed causes — was not hand-edited.3. The changed path, pinned three ways — all three run live
(a) the closedness corpus.
TestPipelineValueClosednesscompiles the realschemaconcatconcatenation and unifies 26 concrete values into#PipelineValue— 13 accepted and 13 rejected — including the four retired aliases and the two documented non-rejects that pin the CUE/Go boundary.The 26 subtests are 13 accepted and 13 rejected. The four retired keys are covered as:
stages:,command:andskip_when:each by a case named after them, andconcurrency:inside theunknown workspace keycase, whose value is{description: "d", concurrency: {lanes: 2}, steps: [...]}. The two accepted cases worded "…is a Go rule, so CUE must NOT reject…" are the deliberate non-rejects that pin the CUE/Go boundary described in the Summary.a_nested_for_each_in_a_substep_rejectedis the case that exercises#PipelineSubStep— the def this revision changed — and it still rejects.(b) the class↔route table, both directions.
(b2) the de-duplication this revision performs is measurable, not asserted. The flow-block-unique keys each occur exactly once in
schema/pipeline.cue, and the three step defs embed the shared def:Lines 58–59 are the only occurrences and they sit inside
#PipelineFlow(lines 51–60). The remainingtimeout_ms?hits are different concepts, not copies of the flow block:#PipelineApproval.timeout_ms(line 44, the approval gate's own timeout) and#PipelineParallel.timeout_ms(line 124, the parallel arm's). Those two are the reason this claim is worded overretry?/on_error?— the keys unique to the flow block — rather than over every key.(c) the new gate is PROVEN ABLE TO FAIL. A gate that cannot fail proves nothing, so the exact removed row was put back into
spec/vocab_gen.goand the gate re-run, then the committed file restored — the verbatim before/after:4. The change in the ASSEMBLED toolchain — it compiles and links into a real charly
specis a Go module consumed by charly; the strongest available non-bed evidence is that the changed tree builds into the product, not just into its own module. charly builds workspace-mode (bootstrap-charly.shusesGOWORK="$ROOT/go.work"), so the dev-tree override is a workspacereplace— carried in a workspace file outside the repositories, so neither repo's tree is modified to produce this evidence:(The
-ldflagsstamp is not decoration:charly check runrefuses an unstamped binary outright — "refusing to run "check run" with an UNSTAMPED binary (version "unknown")" — because the version is baked into image tags, plugin-cache keys and bed stamp assertions. §5 is the run of the stamped binary below.)The dev tree is
pin v0.2026272.1512 + this change only, and that is not a convenience — it is forced, and the reason is reported rather than hidden. Two variants of the override fail, and both are pasted:Neither failure is caused by this change.
specmain carries18ce5f9 feat(spec)!: ExtraCandyRef carries its SCOPE … (#188), which changedspec.ExtraCandyReffrom a string to a struct, and the pinned consumers ([email protected],[email protected],[email protected],[email protected]) have not caught up. Case (i) is that lag, reached by pointing the override at spec main. Case (ii) is the SAME lag reached a second way, and it is the sharper statement: this branch was cut from main, socharly task cue-genregeneratedspec/cue_types_gen.gofrom a schema that already carries #188's struct, and the pinned consumers cannot compile it. charly pinsspec v0.2026272.1512— 5 commits behind, pre-#188 — so charly itself is unaffected; only a dev-tree override trips it. This is ordinary producer-first lag and belongs to spec#188's owner. This PR does not touch it and does not work around it. Every file in this change is clean against the pin except that one generated file, which is therefore left at the pin in the dev tree; charly core never referencesspec.Pipeline/spec.Workflow, and taking my regenerated version would have re-introduced theExtraCandyRefstruct. The change itself (schema/pipeline.cue,schema/workflow.cue,spec/vocab_gen.go,ops/ops.go,schema/candy.cue) is byte-identical to the PR head, and §2 proves the committed generated file is what the generator emits for THIS branch — the two statements are consistent, not in conflict: the dev tree needs the pin's older shape only because its consumers are old.The binary that carries this change then loads the real project:
The
dev/worktree buildWARNING is the same allowlisted notice the bed reports; three plugins are served and three tasks listed, so the project really loads./tmp/wf-ir-build2,/tmp/wf-ir-spec-dev2,/tmp/wf-ir-build-ctgand/tmp/wf-ir-spec-ctgwere removed afterwards, andgit status --porcelainin the charly worktree is empty — the temporary workspace file means nothing needed restoring.5. R10 — the disposable bed
The bed ran against a charly binary built from the same dev tree as §4 —
pin v0.2026272.1512 + this change(the stamped binary quoted in §4) — so the toolchain under test carries this PR's schema and theKindValueDefs["pipeline"]row.check-taskisdisposable: true,host: local,lifecycle: dev.The bed's own
check-livestep log, verbatim — the two checks that drive the project through the host gate:The run's
summary.yml, verbatim —ok: true, every stepok: true,errors: 0,warnings: 0,advisories: 0, the only findings being the 4 allowlisted dev-build notices:This is the round-2 bed, run on head
bf8772a(calver2026.275.2342) — re-run rather than carried over from the previous head, and it reproduces that head's result exactly: 2 passed, 0 failed,ok: true.6. Honest limits of §5 — what this bed does and does not prove
check-taskishost: localwithdisposable: trueand no candy: it loads charly's own project through the host gate and walks a real task plan. That is the assembled-toolchain regression witness. It cannot prove the pipeline gate rejecting a malformed pipeline, because charly'scharly.ymldeclares nokind: pipelineentity — and, measured, akind: pipelineentity is rejected by the loader withnode "probe-old": no kind discriminatorunder both the pre-change and the post-change binary, sinceplugin-pipelineis not compiled into charly (charly/charly.ymlcompiled_plugins:has noplugin-pipeline; it is the out-of-process plugin) and a dev/worktree build loads no plugins withoutCHARLY_PLUGIN_DIR. So a host-gate probe of the pipeline kind is impossible in charly's own project today. The bed that DOES exercise it is B1 in plugin-pipeline, which is why the plan assigns spec the assembled bed — and why that bed is a W6 artifact that runs against this tag onceplugin-lobsterand the cutover exist. What §5 proves is regression-freedom of the assembled toolchain under this change, which is exactly what an additivespecPR can prove today.Rulebook compliance
/charly-internals:git-workflow,/charly-internals:plugin,/charly-internals:go,/charly-internals:cutover-policy,/charly-internals:agents,/charly-check:check.charly#749; (ii) the validator's block 2 — root-caused PAST the two false comments to the structural modelling error they hid, a def that registered a kind no plugin serves, and fixed by removing the def and pinning the split with a gate proven able to fail (§3c); (iii) the dev-tree build failure — root-caused to spec#188's breakingExtraCandyRefchange outrunning its pinned consumers, and then reached a SECOND way (this branch's own regeneratedcue_types_gen.go), reported and left alone rather than patched around; (iv)charly check runrefusing an unstamped binary — root-caused to building with a barego buildinstead ofbootstrap-charly.sh's-ldflags "-X main.BuildCalVer=$(scripts/calver.sh)"stamp, and fixed by stamping, not by the documentedCHARLY_SKIP_FRESHNESS_CHECK=1bypass.#PipelineFlowand#PipelineArmsare each declared once and embedded by every step def — the flow block by all three (#PipelineStepBase,#WorkflowStep,#PipelineSubStep); the route table is CUE data with a derived Go table;#TaskParamSpec,#StrVal,#Stepand#Durationare reused, not restated. §3(b2) measures it rather than claiming it.box.cuebase/from), not an escape hatch; the wire extension reusesresultWire; the spec#188 drift is reported, not patched; the freshness gate is satisfied by stamping the binary, not byCHARLY_SKIP_FRESHNESS_CHECK.stages:,command:,skip_when:,concurrency:) are rejected at the schema, proven by the corpus. They will only ever be accepted by the one-shot migrator.main; the branch isfeat/workflow-ir.-count=1was used so no line is a stale cache hit.cue/protocdownloads are the repo's own pinned, checksum-verified toolchain steps.Change classification
KindValueDefs["pipeline"]row is inert until a consumer rebuilds charly's host gate with this spec, i.e. until charly is repinned. From that point the host gateskind: pipelineagainst#PipelineValue, so an old-syntax pipeline (stages:) fails to load until the plugin-pipeline cutover andplugin-migratehave landed. The landing order already places the cutover before the charly repin; that ordering is now load-bearing, not cosmetic.-count=1) pluscharly task cue-genreproducibility on the committed tree; the changed path executed live by the corpus and by the two derived-vocabulary gates; the change linked into a real charly binary which then loads the full project and ran the disposable R10 bed.fully tested and validated— the module gate, the generation gate and the three derived/schema gates all pass on the committed tree, the changed path (the CUE value gate) executed live against the real concatenation, and the assembled toolchain carrying this change ran the disposable R10 bed to a clean PASS with 0 errors and 0 warnings.Relates to
opencharly/charly#758.Agent:
workflow-ir· sessionsession_01MSxu48GQwoQuBkfwQrkntkAssisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)