Skip to content

fix(workflowkit): name the replacement for a config-knob ref, restore ${env.NAME} in a when: - #443

Merged
aitrawog merged 1 commit into
mainfrom
fix/437-retired-grammar-survivors
Oct 21, 2026
Merged

aitrawog merged 1 commit into
mainfrom
fix/437-retired-grammar-survivors

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

workflowkit is the ONE gate every engine runs on an authored kind: pipeline body before
lowering it. opencharly/sdk#437 records two expressions the retired grammar accepted and
the cutover left with no spelling, both measured on eval-omarchy (the org's only real
kind: pipeline consumer). They are not one defect with one answer: the two answers below
are DIFFERENT on purpose, each decided by measurement, not by symmetry.

defect where what the measurement showed answer
$report.* — entity knob data read from inside a step workflowkit/validate.go:225 (the plan: walker) and :304 (the one earlier-step rule behind plan:/when:/stdin:/for_each:/lanes:) the capability is GONE, not merely unspelled REFUSED, with the replacement named in the message
${env.NAME} inside a when: workflowkit/expr.go (the rewrite + the grammar patcher + Eval) a grammar survivor with an obvious modern equivalent RESTORED

Defect 1 is refused, and the message names the replacement

The old message was reference $report.* names a step that is not declared earlier, which
sends the author looking for a step to declare. There is no such step, and there is nothing
left to restore. The populator that once made an entity knob readable from a step was one
line in the plugin's retired executor; the cutover deleted that file and kept the readers.
The counts below are the whole measurement (counts only — the paths are in another repo this
PR does not touch):

$ git -C plugin-pipeline grep -n 'rc.report = mm' 3d2aee8^ -- '*.go' | wc -l
1
$ git -C plugin-pipeline grep -n 'rc.report = mm' HEAD -- '*.go' | wc -l
0
$ git -C plugin-pipeline grep -n 'rc.report' HEAD -- '*.go' | wc -l
4
$ git -C plugin-pipeline grep -n 'raw\["report"\]' HEAD -- '*.go' | wc -l
0

So at HEAD every surviving rc.report reference — one helper call and three direct reads —
reads a map nothing assigns: it is nil, and a reference that got past the gate would render
the LITERAL TEXT (the generate verb's arm leaves its template as the authored string when
the lookup misses) rather than a value.
The reshape does duplicate the knob block into each lifted verb body, and no verb body reads
that key (0, above). Widening the grammar to accept $<knob>.<field> would therefore be a
half-restore with no value source — a run-time emptiness in place of a load error, which is
the worse trade.

The gate now refuses it with a message that names the replacement. Both retired namespaces —
a config: knob, and the retired entity-env spelling whose value would have to be spliced
into the expression as text — are answered by the gate itself:

$ cd /tmp/wk437 && go run .
--- knob + retired env ---
step "render".plan: reference $report.* reads the entity-level config knob "report", not a step — config: is authored data with no expression form, and the reader that once made a knob visible to a step was retired with the populator, so nothing would resolve this at run time. Author the knob's field VALUE where it is used instead
step "publish".when: reference $env.* is the retired entity-env spelling — write ${env.NAME}, the form the lobster grammar accepts, to read the process environment
--- restored env guard ---
accepted: 0 errors
rc=0

The classifier is keyed on the DOCUMENT (the config: keys of spec.Pipeline.Config, whose
own CUE comment names the former knobs llm/media/report/skills/channels/gates/repo/redo/agent),
never on a hard-coded list, and all five earlier-step call sites share one helper
(checkRefNames), so the misleading step message cannot survive at stdin:/for_each:/
lanes:/plan: either.

What eval-omarchy must do instead — a documented hand-fix, not a promise. Its two knob
references are eval-omarchy/charly.yml:1673 (template: "$report.bed_template") and :1899
(report: "$report.template"). Both are string fields whose value the author already holds
in the entity, so the fix is to author that value at the point of use. The consumer's third
item, the eval-pr pin at the retired plugin-pipeline:v2026.272.0332, is that repo's own
change and is untouched here.

Defect 2 is restored

${env.NAME} is not an invented spelling: the org's own migration emits exactly this form
for the retired $env.NAME (plugin-migrate's documented ref rewrite — "the ref must be
brace form to expand"), so the producer's output could not load against the target grammar.
expr cannot parse the brace form at all, so the measured failure is a PARSE error rather
than a grammar rejection:

$ cd /tmp/wt-sdk437-pre && go test -count=1 -v -run "TestValidateAcceptsTheEnvGuard|TestValidatePipelineAcceptsTheRestoredEnvGuard" ./workflowkit/
=== RUN   TestValidateAcceptsTheEnvGuard
    expr_test.go:104: Validate("!(${env.EVAL_PUBLISH} != true)") = unexpected token Bracket("{") (1:4)
         | !(${env.EVAL_PUBLISH} != true)
         | ...^, want nil
    expr_test.go:104: Validate("${env.EVAL_CLASS} == skip") = unexpected token Bracket("{") (1:2)
         | ${env.EVAL_CLASS} == skip
         | .^, want nil
    expr_test.go:104: Validate("${env.EVAL_LANES} > 8") = unexpected token Bracket("{") (1:2)
         | ${env.EVAL_LANES} > 8
         | .^, want nil
    expr_test.go:104: Validate("${env.A} == true && ${env.B} != false") = unexpected token Bracket("{") (1:2)
         | ${env.A} == true && ${env.B} != false
         | .^, want nil
--- FAIL: TestValidateAcceptsTheEnvGuard (0.00s)
=== RUN   TestValidatePipelineAcceptsTheRestoredEnvGuard
    validate_test.go:577: ValidatePipeline rejected the migrated env guard: step "publish": when: unexpected token Bracket("{") (1:4)
         | !(${env.EVAL_PUBLISH} != true)
         | ...^
--- FAIL: TestValidatePipelineAcceptsTheRestoredEnvGuard (0.00s)
FAIL
FAIL	github.com/opencharly/sdk/workflowkit	0.015s
FAIL
rc=1

The restore has three parts, and each is pinned:

  • rewriteEnvRefs turns ${env.NAME} into an env("NAME") call before the patcher runs,
    because the brace form never reaches the parser otherwise;
  • the patcher admits env as a second CALL name beside ref, and refuses any other arity
    (env() names nothing, and a load-time refusal beats a run-time one);
  • Eval resolves it from the PROCESS environment — the same source the retired form read,
    whose surviving envMap() in the retired executor's package is built from os.Environ().

The value comes back as the lobster LITERAL the retired text substitution would have put in
its place (true/false/null, a number, else the string), because that is what makes the
consumer's guard mean what its author wrote: when: '!(${env.EVAL_PUBLISH} != true)' must
RUN when the variable is true. A raw-string lookup would compare "true" != true — always
true — and the stage would be skipped forever.

The widen is ONE named call, not a namespace: env.NAME (a bare member access) is still
refused, as is every other call, so the grammar's refusal set is unchanged except for the one
form the migration emits. An unset variable reads as empty, os.Getenv's own contract.

The diff

$ git diff --numstat origin/main HEAD
81	8	workflowkit/expr.go
71	0	workflowkit/expr_test.go
85	19	workflowkit/validate.go
102	0	workflowkit/validate_test.go

339 insertions(+), 27 deletions(-) across 4 files. Head be72a159650d981d4bad3ef44e814d9075d71858. No spec change,
no pin, no generated input, so no schema regeneration applies.

How tested

The gate this repo's AGENTS.md names for a library change: go build, go vet, gofmt,
go test, golangci-lint v2.13.2 (the CI pin) and the cross-compile matrix. sdk carries
no check-*-local bed — its CI class gate IS the gate.

1. The pre-change arm for the two REFUSALS — a message control, not merely a non-zero
result.
The pre-change tree is a detached worktree at origin/main (94cd798) carrying
ONLY the two new test files, so each failure below is the validator's own message. Both
named-error tests fail on the old source, and the control case — a knob NAME that IS an
earlier step — passes on both sides, so the classifier is keyed on step-ness and not on the
name:

$ cd /tmp/wt-sdk437-pre && go test -count=1 -v -run "TestValidatePipelineNamesTheConfigKnobReplacement|TestValidatePipelineNamesTheEnvReplacement|TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef" ./workflowkit/
=== RUN   TestValidatePipelineNamesTheConfigKnobReplacement
    validate_test.go:512: ValidatePipeline error = "step \"render\".plan: reference $report.* names a step that is not declared earlier", want it to contain "step \"render\".plan: reference $report.* reads the entity-level config knob \"report\""
    validate_test.go:512: ValidatePipeline error = "step \"render\".plan: reference $report.* names a step that is not declared earlier", want it to contain "config: is authored data with no expression form"
    validate_test.go:512: ValidatePipeline error = "step \"render\".plan: reference $report.* names a step that is not declared earlier", want it to contain "Author the knob's field VALUE where it is used instead"
    validate_test.go:518: ValidatePipeline answered a knob reference with the step message: "step \"render\".plan: reference $report.* names a step that is not declared earlier"
--- FAIL: TestValidatePipelineNamesTheConfigKnobReplacement (0.00s)
=== RUN   TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef
--- PASS: TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef (0.00s)
=== RUN   TestValidatePipelineNamesTheEnvReplacement
    validate_test.go:560: ValidatePipeline error = "step \"publish\".when: reference $env.* names a step that is not declared earlier", want it to contain "step \"publish\".when: reference $env.* is the retired entity-env spelling"
    validate_test.go:560: ValidatePipeline error = "step \"publish\".when: reference $env.* names a step that is not declared earlier", want it to contain "write ${env.NAME}"
    validate_test.go:564: ValidatePipeline answered the retired env spelling with the step message: "step \"publish\".when: reference $env.* names a step that is not declared earlier"
--- FAIL: TestValidatePipelineNamesTheEnvReplacement (0.00s)
FAIL
FAIL	github.com/opencharly/sdk/workflowkit	0.016s
FAIL
rc=1

2. The same tests on the committed tree, with their === RUN headers:

$ go test -count=1 -v -run "(TestEnvRefReadsTheProcessEnvironment|TestEnvIsNotANamespace|TestValidateAcceptsTheEnvGuard|TestValidatePipelineAcceptsTheRestoredEnvGuard|TestValidatePipelineNamesTheConfigKnobReplacement|TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef|TestValidatePipelineNamesTheEnvReplacement)" ./workflowkit/
=== RUN   TestValidateAcceptsTheEnvGuard
--- PASS: TestValidateAcceptsTheEnvGuard (0.00s)
=== RUN   TestEnvRefReadsTheProcessEnvironment
=== RUN   TestEnvRefReadsTheProcessEnvironment/migrated_guard,_variable_true
=== RUN   TestEnvRefReadsTheProcessEnvironment/migrated_guard,_variable_false
=== RUN   TestEnvRefReadsTheProcessEnvironment/string_parity_with_a_bare_identifier
=== RUN   TestEnvRefReadsTheProcessEnvironment/numeric_literal_parity
=== RUN   TestEnvRefReadsTheProcessEnvironment/empty_reads_empty_and_is_not_null
=== RUN   TestEnvRefReadsTheProcessEnvironment/two_env_reads_in_one_guard
--- PASS: TestEnvRefReadsTheProcessEnvironment (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/migrated_guard,_variable_true (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/migrated_guard,_variable_false (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/string_parity_with_a_bare_identifier (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/numeric_literal_parity (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/empty_reads_empty_and_is_not_null (0.00s)
    --- PASS: TestEnvRefReadsTheProcessEnvironment/two_env_reads_in_one_guard (0.00s)
=== RUN   TestEnvIsNotANamespace
--- PASS: TestEnvIsNotANamespace (0.00s)
=== RUN   TestValidatePipelineNamesTheConfigKnobReplacement
--- PASS: TestValidatePipelineNamesTheConfigKnobReplacement (0.00s)
=== RUN   TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef
--- PASS: TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef (0.00s)
=== RUN   TestValidatePipelineNamesTheEnvReplacement
--- PASS: TestValidatePipelineNamesTheEnvReplacement (0.00s)
=== RUN   TestValidatePipelineAcceptsTheRestoredEnvGuard
--- PASS: TestValidatePipelineAcceptsTheRestoredEnvGuard (0.00s)
PASS
ok  	github.com/opencharly/sdk/workflowkit	0.018s
rc=0

3. The whole suite on both arms, so the "did any prior expectation move" question is
answered rather than asserted. Pre-change, with the new tests excluded — this is what the old
gate's own suite looks like:

$ cd /tmp/wt-sdk437-pre && go test ./... -count=1 -skip "^(TestLive_|TestValidateAcceptsTheEnvGuard|TestEnvRefReadsTheProcessEnvironment|TestEnvIsNotANamespace|TestValidatePipelineNamesTheConfigKnobReplacement|TestValidatePipelineKnobNameAsAnEarlierStepIsAStepRef|TestValidatePipelineNamesTheEnvReplacement|TestValidatePipelineAcceptsTheRestoredEnvGuard)$"
ok  	github.com/opencharly/sdk	0.597s
ok  	github.com/opencharly/sdk/agentkit	0.820s
ok  	github.com/opencharly/sdk/artifactkit	0.067s
ok  	github.com/opencharly/sdk/buildcache	2.885s
ok  	github.com/opencharly/sdk/buildkit	0.022s
ok  	github.com/opencharly/sdk/buildkitdrive	0.025s
ok  	github.com/opencharly/sdk/candywalk	0.031s
ok  	github.com/opencharly/sdk/charlylib	0.039s
ok  	github.com/opencharly/sdk/checkkit	0.019s
ok  	github.com/opencharly/sdk/cmd/charly-lib-gen	0.013s
ok  	github.com/opencharly/sdk/deploykit	21.511s
ok  	github.com/opencharly/sdk/enginekit	0.021s
?   	github.com/opencharly/sdk/internal/spectest	[no test files]
ok  	github.com/opencharly/sdk/kit	12.515s
ok  	github.com/opencharly/sdk/llmkit	2.303s
ok  	github.com/opencharly/sdk/loaderkit	1.412s
ok  	github.com/opencharly/sdk/packagekit	0.120s
ok  	github.com/opencharly/sdk/storekit	0.544s
ok  	github.com/opencharly/sdk/vmshared	0.168s
ok  	github.com/opencharly/sdk/workflowkit	0.055s
rc=0

The committed tree:

$ go test ./... -count=1 -skip "^TestLive_"
ok  	github.com/opencharly/sdk	0.448s
ok  	github.com/opencharly/sdk/agentkit	0.796s
ok  	github.com/opencharly/sdk/artifactkit	0.038s
ok  	github.com/opencharly/sdk/buildcache	2.416s
ok  	github.com/opencharly/sdk/buildkit	0.025s
ok  	github.com/opencharly/sdk/buildkitdrive	0.019s
ok  	github.com/opencharly/sdk/candywalk	0.029s
ok  	github.com/opencharly/sdk/charlylib	0.029s
ok  	github.com/opencharly/sdk/checkkit	0.012s
ok  	github.com/opencharly/sdk/cmd/charly-lib-gen	0.004s
ok  	github.com/opencharly/sdk/deploykit	21.321s
ok  	github.com/opencharly/sdk/enginekit	0.015s
?   	github.com/opencharly/sdk/internal/spectest	[no test files]
ok  	github.com/opencharly/sdk/kit	12.006s
ok  	github.com/opencharly/sdk/llmkit	0.517s
ok  	github.com/opencharly/sdk/loaderkit	1.258s
ok  	github.com/opencharly/sdk/packagekit	0.100s
ok  	github.com/opencharly/sdk/storekit	0.303s
ok  	github.com/opencharly/sdk/vmshared	0.150s
ok  	github.com/opencharly/sdk/workflowkit	0.050s
rc=0

Every package passes on both sides: the diff changes a reason string and restores one
expression form, and no existing test, message or ordering for a genuine undeclared step
moved.

Disclosure — the skip. The committed-tree fence above carries -skip '^TestLive_';
llmkit's live arm is endpoint-latency dependent and is sdk#436. The skip hides nothing
here: CI's exact command, without the skip, is green on this host, whose live tests reach a
local endpoint:

$ go test ./... -count=1
ok  	github.com/opencharly/sdk	0.423s
ok  	github.com/opencharly/sdk/agentkit	0.798s
ok  	github.com/opencharly/sdk/artifactkit	0.033s
ok  	github.com/opencharly/sdk/buildcache	2.554s
ok  	github.com/opencharly/sdk/buildkit	0.061s
ok  	github.com/opencharly/sdk/buildkitdrive	0.017s
ok  	github.com/opencharly/sdk/candywalk	0.038s
ok  	github.com/opencharly/sdk/charlylib	0.035s
ok  	github.com/opencharly/sdk/checkkit	0.037s
ok  	github.com/opencharly/sdk/cmd/charly-lib-gen	0.024s
ok  	github.com/opencharly/sdk/deploykit	33.519s
ok  	github.com/opencharly/sdk/enginekit	0.026s
?   	github.com/opencharly/sdk/internal/spectest	[no test files]
ok  	github.com/opencharly/sdk/kit	12.030s
ok  	github.com/opencharly/sdk/llmkit	2.340s
ok  	github.com/opencharly/sdk/loaderkit	1.382s
ok  	github.com/opencharly/sdk/packagekit	0.105s
ok  	github.com/opencharly/sdk/storekit	0.593s
ok  	github.com/opencharly/sdk/vmshared	0.150s
ok  	github.com/opencharly/sdk/workflowkit	0.039s
rc=0

4. The module gates, on the committed tree.

$ go build ./... && echo "go build: rc=0"
go build: rc=0
$ go vet ./... && echo "go vet: rc=0"
go vet: rc=0
$ echo "gofmt -l . -> [$(gofmt -l .)]"
gofmt -l . -> []
$ golangci-lint run ./...
0 issues.
rc=0
$ golangci-lint fmt --diff ./...
rc=0

The formatter half is golangci-lint fmt --diff, which prints nothing on success (a
formatter-class drift that plain golangci-lint run does not report). Cross-compile, the two
targets this leg owes:

$ for arch in amd64 arm64; do GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build ./... && echo "linux/$arch build ok"; done
linux/amd64 build ok
linux/arm64 build ok

5. The survivor-class sweep — measured, in this package. The refusal rule is reachable
from exactly five sites, and they share one helper (so a fix at one is a fix at all five):

$ grep -rno "checkEarlierRefs(where+\"[a-z._]*\"\|checkRefNames(where+\"[a-z._]*\"" workflowkit/validate.go
225:checkRefNames(where+".plan"
234:checkEarlierRefs(where+".when"
236:checkEarlierRefs(where+".stdin"
238:checkEarlierRefs(where+".for_each"
244:checkEarlierRefs(where+".lanes"

The expression grammar has exactly one site, because when: is the only expression the
validator compiles:

$ grep -rn "Validate(v.when)" workflowkit/
workflowkit/validate.go:229:		if err := Validate(v.when); err != nil {
  • Does the same hole refuse other LEGITIMATE documents? No. The refusal fires only on a
    name that is not an earlier step, and it now separates the two retired namespaces that can
    appear there: a config: knob (no value source, so a refusal is the honest answer) and
    env (whose modern form is restored). The diff adds NO rejection — the knob message
    replaces an error that already fired, and the restored expression turns a refusal into an
    acceptance.
  • ${env. inside a when:/comparison reaches no other surface in this package, since
    the fence above is the whole of it. A grep across the umbrella's authored YAML finds no
    matches either, so the restore is the enabling half for the consumer rather than a call
    site already in tree:
$ grep -rn --include=*.yml --include=*.yaml -E "when:.*\$\{env\." . | grep -v "/.worktrees/"; echo "grep exit=$?"
grep exit=1
  • The knob references that exist in the org's authored documents are the consumer's two,
    and plugin-migrate's legacy test fixture carries the same two. That fixture is asserted
    to SURVIVE the reshape, which is consistent with this change and outside it: the shape
    assertion is about not CORRUPTING the reference, and this gate is about the reference
    having no resolver:
$ grep -rn --include=*.yml "\$report\." eval-omarchy
eval-omarchy/charly.yml:1673:        template: "$report.bed_template"
eval-omarchy/charly.yml:1899:          report: "$report.template"

What I did NOT run, and why. No charly driver: the umbrella's charly/bin/charly welds
sdk v0.2026293.417, so charly box validate there would exercise the OLD gate and prove
nothing about this change. I did not build a driver against this worktree either — that is the
go 1.26.8 versus go.work mismatch the plugin-migrate leg recorded, in a generated file.
The changed path therefore ran where it can be observed honestly: the exported
ValidatePipeline, Validate and Eval the tests call, which are the same functions the
plugin front-end calls.

Rulebook compliance

R0: loaded /charly-internals:git-workflow, /charly-internals:strict-policy,
/charly-internals:go, /charly-internals:go-quality and this repo's AGENTS.md before the
first tool action; its "Build / validate / test" section names the CI class gate this PR runs.

R1: every anomaly got an RCA before remediation, and one of them changed the answer. I
first wrote the knob message to say the duplicated block was usable and to offer args:; the
measurement (the populator deleted, four readers reading a nil map, the duplicated key read by
nothing) showed that claim false, so the message was corrected to "author the value where it
is used" before the commit. The plugin-migrate fixture's survive-assertion is named under
## Filed issues as an owner elsewhere, not widened into this diff.

R2: one implementation, not two. The plan walker had its own inline copy of the
earlier-step message; it now calls the same checkRefNames the other four sites use, so the
classification exists once. The expression grammar keeps ONE patcher and ONE compile path, and
env is registered the same way ref already was.

R3: no sleep, retry, suppression, fallback or magic constant. The knob set is read off the
authored document; the env value is os.Getenv with its own documented empty-string contract,
not a default.

R4: the product was fixed, not the prose. No doc, skill or comment was edited to route
around a rejection, and the refusal names a replacement the author can act on.

R5: no legacy path, alias or shim is left. The one duplicated message loop was deleted
into the shared helper (R2); the message for a genuine undeclared step is unchanged, which is
why it still appears in the tree — that sentence is correct for its case.

R6: git status --short was empty before the branch work and after the commit; one
fix/ branch, one commit, one push, no force-push, no bypass, no push to main, and no edit
in any other repo. The pre-change arm was a detached worktree under /tmp, never a mutation
of the tree under test.

R7: the coverage fails without the change — the pre-change arm is that proof, run in a
tree carrying only the new tests, and the two refusal tests assert the MESSAGE TEXT rather
than a non-zero result. The changed path executes live: the tests call the real
ValidatePipeline/Validate/Eval, they do not reimplement them.

R8: N/A — this change crosses no live service boundary and mocks nothing.

R9: N/A — this module ships no binary. sdk is a library consumed at a pinned Go module
version and this PR adds no runtime OS dependency.

R10: the change class is the Go module gate, and it passed on the committed tree:
go build, go vet, gofmt -l empty, golangci-lint v2.13.2 with 0 issues,
golangci-lint fmt --diff empty, the full suite, and the linux/amd64 plus linux/arm64
cross-compile, all pasted above. sdk has no check-*-local bed, so the CI class gate is the
gate and there is no disposable bed to run.

Change classification

A behavioural bug fix in the shared workflow validator and expression grammar:
workflowkit/validate.go, workflowkit/expr.go and their two test files. No generated input,
no schema, no pin — spec is untouched at v0.2026294.929, so cue:gen does not apply. The
class is config by this repo's own taxonomy: the gate is the Go CI matrix, and sdk
carries no runtime bed.

Filed issues

This PR closes opencharly/sdk#437, which is the finding it fixes. No new issue was opened:
the sweep found no second legitimate document refused, so there is no second defect to file.

Owners for the work this PR deliberately does not do:

  • opencharly/eval-omarchy#91 — the consumer leg. This fix clears its two grammar blockers;
    its hand-fix for the two knob references and its own eval-pr pin are that repo's work.
  • opencharly/plugin-migrate#23 — the reshape's emit half for the lanes arm, which needs this
    family of sdk fixes released and pinned first.
  • opencharly/plugin-pipeline#37 — records that the config: knob populator was deleted and
    the readers kept. This PR is the load-time half of that record; the run-time half (the dead
    readers, and the duplicated knob block no verb body reads) is that issue's, in that repo.

One boundary is measured and recorded rather than crossed here. The same ${env.NAME}
spelling in a NON-expression string (a knob value, a vars: leaf, a cache: key) is expanded
by the plugin's own template resolver, not by this package, and that resolver's name class
([A-Za-z0-9_-]+) cannot match a dotted key. That is a second surface in repos outside this
leg's write scope; the measurement is posted on opencharly/eval-omarchy#91 for its owner.

A3 — attribution evidence

Delivered system message, first line verbatim: you are an AI agent powered by DeepSeek
Harness. (The sentence is the runtime's own; quoted here without markup so no wrap splits it.)

Descriptor record from this session's own harness record
(~/.dsh/sessions/--home-atrawog-Sync-Atrapub-mo-dsh-opencharly--/3ae3bf4f-f94e-4847-a6a2-1ccc7a7713ba/session.v4.jsonl.zstd,
the first subagent/descriptor line):

{"type":"subagent/descriptor","seq":0,"time":1792590413964,"data":{"version":3,"mode":"continuable","provider":"spawn","label":"sdk 437 two retired grammar expressions","agentProvider":"ollama-cloud","agentModel":"deepseek-v4.1-flash"}}

DSH_* environment of the shell that ran every gate above:

$ env | grep -i '^DSH_' | sort
DSH_HOME=/home/atrawog/.dsh
DSH_PROFILE_DIR=/home/atrawog/.dsh/profiles/web
DSH_PROFILE=web
DSH_SESSION_ID=3ae3bf4f-f94e-4847-a6a2-1ccc7a7713ba
DSH_SHELL=1
DSH_WEB_URL=http://127.0.0.1:3080

The harness and model names are the runtime's own — opencharly/opencharly#538. The footer is
unchanged.

Agent: charly

Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)

…NAME} in a when:

Two retired-grammar expressions survived the lobster cutover inside the ONE gate every
engine runs, and each has a DIFFERENT disposition, decided by measurement rather than by
symmetry:

1. `$<knob>.<field>` inside a step. The earlier-step rule required every `$name.*` to name
   an EARLIER step, and answered an entity-level knob (`$report.*`) with a message saying it
   names a step that is not declared earlier, which sends the author looking for a step that
   does not exist. The capability is GONE, not merely unspelled: the cutover deleted the
   populator that made a knob visible to a step (`rc.report = mm(mapOf(p.Report))` in
   plugin-pipeline's retired executor.go) and kept the readers, so `rc.report` is nil and a
   reference that got past the gate would render LITERAL TEXT at run time. Widening the
   grammar to accept it would trade a load error for a run-time emptiness, which is worse.
   The gate now refuses it with a message that names the replacement: author the knob's
   field VALUE where it is used. The classifier is keyed on the document (the `config:` keys
   of `spec.Pipeline.Config`, never a hard-coded list) and runs at every reference site, not
   just `plan:`.

2. `${env.NAME}` inside a `when:`. A genuine survivor with an obvious modern equivalent:
   the org's own migration emits exactly this spelling for the retired `$env.NAME`
   (plugin-migrate's documented ref rewrite), so the producer's output could not load
   against the target grammar. RESTORED: the expression rewrite turns it into an `env` call,
   the patcher admits `env` alongside `ref`, and Eval reads the PROCESS environment, the same
   source the retired form read (plugin-pipeline's surviving `envMap()` is `os.Environ()`).
   The value is typed as the lobster LITERAL the retired text substitution would have
   produced, so the consumer guard runs when the variable IS true instead of being skipped
   forever.

The retired `$env.NAME` spelling, whose value would have to be spliced into the expression
as text, stays refused, but now names `${env.NAME}`.

No acceptance changed: the knob message replaces an error that already fired, so the diff
adds no rejection. It changes a reason and restores one expression form.

Refs: #437
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: be72a159650d981d4bad3ef44e814d9075d71858 (branch: fix/437-retired-grammar-survivors)

Security screen: PASS — no secrets/egress, no guardrail weakening, no scope mismatch (diff matches body), no self-modifying-security surface touched.
Checklist: All applicable rules PASS or NA. Verified: A1 (full body, footer form, Filed-issues), A2/A3 (Go-module class gate, tier justified by pre-change failure + green post-change), R0–R10, ARCH (placement CORRECT — workflowkit kit), CONC (disclosed -skip backed by full no-skip run), HC (single commit/cutover). Comment thread is empty (0 comments) — nothing to disposition.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 21, 2026 14:01
@aitrawog
aitrawog merged commit 9ce7ae1 into main Oct 21, 2026
6 checks passed
@aitrawog
aitrawog deleted the fix/437-retired-grammar-survivors branch October 21, 2026 14:31
charly-auto-merge Bot added a commit that referenced this pull request Oct 21, 2026
github-actions Bot pushed a commit to opencharly/plugin-pipeline that referenced this pull request Oct 21, 2026
…s, the real map, a named miss (#52)

* fix(pipeline): resolve `$env.NAME` in a data string — both spellings, the real map, a named miss

A pipeline DATA field naming an environment value had no resolver at HEAD, in three
independent ways: the front-end's grammar matched the BARE `$env.NAME` only (so
`plugin-migrate`'s `${env.NAME}` could never match), the one production `verbEnv`
constructor left the map nil, and `resolveRefs` returned even a matched ref
verbatim under the standalone IDENTITY resolver. The value reached a verb body as
literal text — measured on eval-omarchy's seven data leaves.

The LAYER is the front-end's, by measurement: `workflowkit.Lower` moves a lifted
verb's body into the generated `charly.yml` as a `task:` entity and leaves only
`run: <charly> ... task ...` in the `.lobster`, so the engine never sees the leaf —
teaching the engine a dotted name would be a second resolver wired to nothing (R2).

- refs.go: one `envRefRe` admitting `$env.NAME` AND `${env.NAME}` (the dot names
  the NAMESPACE; the name class stays the POSIX env charset), split from
  `runRefRe`. The ENVIRONMENT namespace is substituted BEFORE the resolver
  override, because no other layer in the chain resolves it: the plan's `${VAR}`
  expander is uppercase-only and never sees `env.`, and the engine's `${arg}`
  reads run args. Gating it behind the override is exactly how the ref survived as
  text.
- verb_env.go: `standaloneVerbEnv` supplies `procEnv` from `os.Environ()` — the
  source the retired `$env.NAME` read — in a field SEPARATE from `env`, the per-run
  BOUND map `adeLaneHead` reads; merging them is the defect RCA 2026.252.2210
  fixed, and the lock in verb_ade_head_test.go still holds it.
- a MISSING name is recorded during resolution and reported as ONE named failure of
  the whole dispatch, prefixing any downstream error. Empty is the rejected
  alternative on purpose: it is a run-time emptiness in place of a load error, the
  trade opencharly/sdk#443 refused for the knob form.
- render.go: `validate:` is handed to `bash -c`, so it is the one field where a
  substituted VALUE would become SCRIPT TEXT. An env ref there is REFUSED with the
  shell's own `${NAME}` named — bash expands a variable from the inherited
  environment and never re-parses its value as syntax — instead of splicing it.

`plugin-migrate` needs no change, measured rather than assumed: no spelling
resolved in a data string before this (`${NAME}`-uppercase is the plan expander's
grammar over t.vars/t.env/-p, never the process environment), so re-pointing the
emission would not have helped, and `${env.NAME}` is now both the spelling that
resolves and the one the expression grammar accepts.

The `corpus` leaf needs one thing more and it is filed, not half-wired here:
`rc.skills` is a dead config knob (plugin-pipeline#37), so that string never
reaches the grammar. This change makes the ref resolvable; #37 makes it reachable.

Tests: the pre-change arm fails all five behavioural claims on the untouched tree
(pasted in the PR body); four mutations (brace arm removed, procEnv removed,
missing name rendered as a literal, shell refusal removed) each kill the test that
asserts its property.

Closes #50.

Agent: charly
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>

* test(pipeline): pin the concurrent-dispatch contract of the env resolver

Round-1 review, block 2: `substituteEnvRefs` appends to `rc.missingEnv` and
`invokeLiftedVerb` reads it after `run`, so a `verbEnv` shared by two dispatches
would be both a data race and a cross-attribution bug (one stage's missing
variable surfacing in another stage's verdict).

The per-dispatch construction is what makes that impossible — `invokeLiftedVerb`
builds its OWN `verbEnv` per Invoke — and this adds the test that holds it: eight
dispatches in flight at once, HALF of them naming an absent variable so the miss
list is touched concurrently with the resolving arm, each verdict asserted to name
its OWN variable and no other.

Mutation-checked: turning `missingEnv` into one package-level accumulator makes
the test fail under `-race` with `WARNING: DATA RACE`, so the test can fail and
fails exactly on the property it claims.

Also measured for round 1's block 1, and recorded here so the numbers live with
the change: the change-class bed step `pipeline-runs-lifted-file-verbs` fails at
the SAME rate on the unchanged tree (1 of 30 parallel iterations on each side; 5
of 36 in two earlier 12-way waves, all on `origin/main`), with the run exiting 0,
its artifacts written, and the LAST line of the plugin's forwarded stdout missing.
That mechanism is filed as opencharly/charly#1013.

Agent: charly
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>

* chore(pr): re-freeze the head so the org required gate re-fires

The round-2 push (9210549) created NO workflow run — neither the org-required
validator nor this repo's own ci job appeared for it (gh run list shows only the
14:49Z runs at fd420e5), so the gate was never dispatched on that head. An empty
commit mints a NEW head and a new pull_request/synchronize event, which is the
documented re-trigger; the TREE is unchanged, so every tree key in the body holds.

Agent: charly
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)

---------

Co-authored-by: Andreas Trawoeger <[email protected]>
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.

2 participants