workflow: Module position first slice (registry + side-effect-free 'log' kind) #436

Closed
opened 2026-10-27 13:36:19 +00:00 by sam · 0 comments
Owner

Fifth slice of docs/prds/eda-playbook-engine.md, implementing docs/prds/module-position.md's recommended first slice: prove schema -> go:generate -> Yaegi load -> ModuleRegistry -> playbook dispatch end to end with a side-effect-free action kind, before any kind with a real external effect (notify, image-gen, forge writes) is attempted -- those remain blocked on the parent doc's unresolved execution-time gaps (idempotency, mid-run failure), which this slice deliberately does not need.

Generalizes the fixed-signature, resolved-by-name Yaegi pattern already shipped for custom gates (internal/gate/gateeval) and workflow stage plugins (skillbuild) -- do not invent a new interpreter-construction or panic-recovery mechanism; reuse yaegiutil.New/Resolve/Safe directly.

Design

Per module-position.md:

  1. internal/domain/eda/module/log: hand-written schema source (Args/Result structs, SchemaVersion const), //go:generate yaegi extract -name logextract producing logextract.Symbols -- same shape as gateextract/wfextract.
  2. internal/domain/eda/module: ModuleRegistry with Register(kind, dir) and Invoke(ctx, kind, rawArgs map[string]any) (map[string]any, error). No generic Module interface with an any payload -- Invoke decodes rawArgs into the kind's generated Args struct before calling the resolved function; a shape mismatch is a reported failure per the existing 'schema defines the accepted message' rule, not a silent zero-value fill. Discovery/resolve mirrors gateeval.Evaluate's structure (read file -> yaegiutil.New with that kind's symbols -> yaegiutil.Resolve[func(Args) Result] -> yaegiutil.Safe-wrapped call).
  3. Config: ModuleDir field mirroring PluginDir's shape and doc comment exactly (operator-trusted directory of Yaegi module implementations, empty means none loaded).
  4. Wire ModuleRegistry construction into daemon startup (bootstrap.go) alongside the existing PlaybookDirs/routing-file loading -- log-and-abort on load failure, matching the established pattern.
  5. Do NOT implement notify, image-gen, or any action kind with a real external side effect in this slice. Do NOT wire this into playbook YAML action dispatch yet if that requires resolving the data-flow/condition syntax (parent doc open question 1) -- confirm during implementation whether a minimal 'run this one module action, no chaining' dispatch is small enough to include, or whether registry+one-kind-loadable is itself the right slice boundary and dispatch is a follow-up ticket.

Acceptance criteria

internal/domain/eda/module/log exists with a generated symbol table via go:generate yaegi extract (same tooling as wfextract/gateextract, verified by running go generate ./... and checking the output compiles). ModuleRegistry.Register discovers and loads a *.go file implementing the log kind's generated contract; Invoke calls it and returns a typed result decoded from the interpreted function's return value. A malformed or wrong-shaped args map is a reported error, not a panic or silent default. Config gains ModuleDir (empty by default, no behavior change). Trust boundary matches PluginDir/SecretEngineDir (operator-installed, in-process, daemon-privileged) -- not repository/task code. task check passes.

Close reason

Verified landed: internal/domain/eda/module (Registry/Invoke) + module/log kind + ModuleDir config and bootstrap wiring.


Imported from beads archie-core-t2db.13 · GitHub #741 · type task · priority P2 · created 2026-09-02 · closed 2026-09-11

Fifth slice of docs/prds/eda-playbook-engine.md, implementing docs/prds/module-position.md's recommended first slice: prove schema -> go:generate -> Yaegi load -> ModuleRegistry -> playbook dispatch end to end with a side-effect-free action kind, before any kind with a real external effect (notify, image-gen, forge writes) is attempted -- those remain blocked on the parent doc's unresolved execution-time gaps (idempotency, mid-run failure), which this slice deliberately does not need. Generalizes the fixed-signature, resolved-by-name Yaegi pattern already shipped for custom gates (internal/gate/gateeval) and workflow stage plugins (skillbuild) -- do not invent a new interpreter-construction or panic-recovery mechanism; reuse yaegiutil.New/Resolve/Safe directly. ### Design Per module-position.md: 1. internal/domain/eda/module/log: hand-written schema source (Args/Result structs, SchemaVersion const), //go:generate yaegi extract -name logextract producing logextract.Symbols -- same shape as gateextract/wfextract. 2. internal/domain/eda/module: ModuleRegistry with Register(kind, dir) and Invoke(ctx, kind, rawArgs map[string]any) (map[string]any, error). No generic Module interface with an any payload -- Invoke decodes rawArgs into the kind's generated Args struct before calling the resolved function; a shape mismatch is a reported failure per the existing 'schema defines the accepted message' rule, not a silent zero-value fill. Discovery/resolve mirrors gateeval.Evaluate's structure (read file -> yaegiutil.New with that kind's symbols -> yaegiutil.Resolve[func(Args) Result] -> yaegiutil.Safe-wrapped call). 3. Config: ModuleDir field mirroring PluginDir's shape and doc comment exactly (operator-trusted directory of Yaegi module implementations, empty means none loaded). 4. Wire ModuleRegistry construction into daemon startup (bootstrap.go) alongside the existing PlaybookDirs/routing-file loading -- log-and-abort on load failure, matching the established pattern. 5. Do NOT implement notify, image-gen, or any action kind with a real external side effect in this slice. Do NOT wire this into playbook YAML action dispatch yet if that requires resolving the data-flow/condition syntax (parent doc open question 1) -- confirm during implementation whether a minimal 'run this one module action, no chaining' dispatch is small enough to include, or whether registry+one-kind-loadable is itself the right slice boundary and dispatch is a follow-up ticket. ### Acceptance criteria internal/domain/eda/module/log exists with a generated symbol table via go:generate yaegi extract (same tooling as wfextract/gateextract, verified by running go generate ./... and checking the output compiles). ModuleRegistry.Register discovers and loads a *.go file implementing the log kind's generated contract; Invoke calls it and returns a typed result decoded from the interpreted function's return value. A malformed or wrong-shaped args map is a reported error, not a panic or silent default. Config gains ModuleDir (empty by default, no behavior change). Trust boundary matches PluginDir/SecretEngineDir (operator-installed, in-process, daemon-privileged) -- not repository/task code. task check passes. ### Close reason Verified landed: internal/domain/eda/module (Registry/Invoke) + module/log kind + ModuleDir config and bootstrap wiring. --- _Imported from beads `archie-core-t2db.13` · GitHub #741 · type task · priority P2 · created 2026-09-02 · closed 2026-09-11_
sam added the mediumtask labels 2026-10-27 13:36:19 +00:00
sam self-assigned this 2026-10-27 13:36:19 +00:00
sam closed this issue 2026-10-27 13:36:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#436