host P1: types DECLARE behavior, runner DERIVED (LIVE-VERIFIED)

Generalizes the hardcoded publish trigger into declared, capability-routed behavior.

- Types carry :behavior — flat string-keyed bindings {"verb" "type" "dag"} on the type-post
  (persist-safe, like :type-relations). The "article" type declares on-create → the "publish" DAG.
- host/blog--load-behaviors! gathers ALL posts' declarations into a registry at boot (serve.sh); the
  trigger match (host/blog--triggers :match = host/blog--match-behaviors) consults it. Hardcoded
  create+article trigger removed.
- Runner DERIVED (DEBT #2 fixed): match resolves :dag via host/blog--dag-registry and picks the
  runner via host/flow--select-runner over host/blog--runner-fleet ([exec-runner]; RA joins at
  RA-live). Each binding carries its :runner; behavior/-run-binding now uses the binding's runner
  (else the engine default) — so the capability model drives the LIVE engine.
- The type-def view shows each behavior + its derived runner (host/blog--behavior-lines).

LIVE PROOF: /article shows 'on create → publish DAG · needs {effect, branch} · runner: synchronous
(exec-fold)'; publishing on blog.rose-ash.com fired /flows validate+notify via the DECLARED path.
blog 213/213 (+3 P1), full host conformance 610/610. FINDING: load-behaviors! scans all posts, not
is-type?-filtered (article failed is-type? on the durable store though it passed in-memory).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:34:39 +00:00
parent c21be815f3
commit 9d29295820
5 changed files with 115 additions and 16 deletions

View File

@@ -197,16 +197,25 @@ without touching the DAG or the wiring.
boundary). RECOMMENDATION: a narrow **RA SPIKE** next — prove one dispatch + one suspend/resume/
pump cycle in isolation — de-risks the whole durable/federated half before building P1/P2 on it.
## P1 — types DECLARE behavior (generalize)
<!-- PREREQ (review): wire host/flow--bind into the engine (DEBT #2). Note: derivation is trivial until RA gives a 2nd runner. -->
- [ ] The type carries :behavior = [{:on {:verb :object-type :guard} :dag <ref>}] — edited in the
type-def editor beside grammar + relations. NO runner hint (the runner is DERIVED from the DAG's
required capabilities).
- [ ] host/blog--engine-for(object) builds the seam engine from the object's type bindings +
registers the triggers, selecting each DAG's MINIMUM runner via artdag/analyze (required-caps) —
a `{effect}`-only DAG runs synchronously; a `wait` node pulls in the Erlang runner automatically.
- [ ] The type-def editor can SHOW each behavior's required capabilities + which runner it resolves
to (the derived sync/durable/distributed classification, visible not hand-set).
## P1 — types DECLARE behavior (generalize) — DONE + LIVE-VERIFIED 2026-07-02
- [x] The type carries :behavior — a list of flat string-keyed bindings {"verb" "type" "dag"}
(persist-safe, like :type-relations), stored on the type-post (host/blog--type-behavior /
set-type-behavior!). The "article" type declares {"verb" "create" "type" "article" "dag" "publish"}.
- [x] The behavior REGISTRY (host/blog--behaviors) is gathered at boot from ALL posts' declarations
(host/blog--load-behaviors!, in serve.sh after seed-types!); the trigger match (host/blog--triggers
:match = host/blog--match-behaviors) consults it. The hardcoded create+article trigger is GONE.
- [x] The runner is DERIVED, not hinted (DEBT #2 fixed): match-behaviors resolves the :dag via a DAG
registry (host/blog--dag-registry) and picks the runner via host/flow--select-runner over the fleet
(host/blog--runner-fleet = [exec-runner]; RA joins at RA-live). Each binding carries its :runner;
behavior/-run-binding uses it. An {effect,branch} publish-DAG → exec-runner; a {suspend} DAG would
route to RA (proven in ra 9/9 with a 2-runner fleet).
- [x] The type-def view SHOWS each behavior + its derived runner (host/blog--behavior-lines): LIVE at
blog.rose-ash.com/article — "on create → publish DAG · needs {effect, branch} · runner:
synchronous (exec-fold)". Derived + visible, not hand-set.
- LIVE PROOF: published on blog.rose-ash.com → /flows fired validate+notify via the DECLARED path
(registry + derived runner). blog 213/213, full conformance 610/610. FINDING: load-behaviors! must
scan ALL posts, not filter by is-type? (article didn't pass is-type? on the durable store though it
did in-memory) — the type declaration is authoritative, the is-type? classification isn't reliable enough.
## P2 — state-change → activity emission (ALL events, not just publish)
<!-- PREREQ (review): fix activity identity (DEBT #1) — :id must not be the bare CID, or relation events false-dedup. -->
@@ -282,6 +291,13 @@ covers everything until a DAG's cost/latency/placement forces the substrate.
activities), so business logic can change state, which federates, which triggers more flows.
## Progress log (newest first)
- 2026-07-02 — P1 DONE + LIVE-VERIFIED. Types DECLARE :behavior (stored on the type-post, gathered
into a registry at boot); the trigger match consults the registry; the runner is DERIVED via
host/flow--select-runner over the fleet (DEBT #2 fixed — no hardcoded trigger, no runner hint). The
/article page shows the declared behavior + derived runner. Published live → /flows fired via the
declared path. blog 213/213, conformance 610/610. Finding: load-behaviors! scans ALL posts (not
is-type?-filtered — unreliable on the durable store). NEXT: RA-live (persistent kernel wires RA into
the fleet → durable bindings route to RA), or P2 (all state-change → activity emission).
- 2026-07-02 — RA RUNNER BUILT + tested (module + integration). lib/host/ra.sx = a pure-SX seam
runner with injected erl-eval (loads in the plain host, mock-testable); marshals our activity →
Erlang, drives flow_store, parses done/suspended → the runner contract. Dual-runner ROUTING in