eda: declare generated Result schemas to CEL for field-level result typing #451
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#451
Reference in new issue
Block a user
Unshipped half of docs/prds/playbook-expression-syntax.md. Found while
deciding whether that PRD could move from Approved to Finalised.
The PRD's load-time validation section decides that action kinds' generated
Result structs are declared to CEL at load, so
actions.<id>.result.<field>type-checks before a playbook is accepted. That field-level rejection is the
load-bearing reason CEL was chosen over a bespoke grammar: the PRD's "Why
bespoke was not sufficient" section argues a hand-rolled grammar would have to
re-implement a type system to get it.
expr.NewEnv declares both roots as map(string, dyn), so nothing is
type-checked below the root. expr.go's own comment records this as follow-up
work once multi-action playbooks exist.
eventdeliberately stays dyn (J4, schema-by-example); this is the resulthalf only.
Design
Blocked by .25 (ids) and .24 (ledger).
expr.NewEnv declares both roots as map(string, dyn). This bead declares each
registered action kind's generated Result schema to CEL at load so
actions..result. type-checks before a playbook is accepted. The
log kind's generated symbols (internal/domain/eda/module/log/logextract) are
the worked example of a generated contract to declare.
eventdeliberately stays dyn (the PRD's J4, schema-by-example). This is theresult half only; do not tighten event.
SCOPED GATE COMMAND
go test ./internal/domain/eda/... -count=1 && go vet ./internal/domain/eda/...
Acceptance criteria
A registered action kind's generated Result schema is declared to the CEL environment at load, and a playbook referencing a field that schema does not define fails the load rather than erroring at dispatch.
Notes
nx30 LANDED (run/nx30-design @
f498f593, gated): it declares each kind's Result schema to CEL and a result-field typo now FAILS THE LOAD (TestLoadActionPlaybookRejectsMisspelledResultField), which is this bead's stated acceptance surface. Blocked-by nx30 removed as satisfied. RESIDUAL TO STATE: nx30 declared the HAND-WRITTEN log contract; this bead's text says GENERATED Result schemas. If the generated-schema path is a real residual, describe it here; if it is not, close this bead as delivered. Do not leave the overlap implicit.Close reason
Shipped. Generated Result schemas reach CEL: expr declares prior action ids typed by their kind Result (expr.DeclaredResult; ModuleRegistry.KindSchema supplies the reflect types), and run.go decodes each result via DecodeResult into actions..result. Verified: TestCompileDeclaredResultRead, TestEvalDeclaredResultRead, TestCompileUndeclaredActionIDRejected.
Imported from beads
archie-core-t2db.27· GitHub #1127 · type task · priority P2 · created 2026-09-21 · closed 2026-09-29