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:
@@ -175,6 +175,17 @@
|
||||
;; the relation metadata into the in-memory cache the same way.
|
||||
(host/blog-seed-types!)
|
||||
(host/blog-load-rel-kinds!)
|
||||
(host/blog--load-behaviors!) ;; P1: gather types' declared behaviors into the registry (as boot does)
|
||||
(host-bl-test "P1: load-behaviors! gathers the article type's declared on-publish binding"
|
||||
(list (>= (len host/blog--behaviors) 1)
|
||||
(contains? (map (fn (b) (get b "dag")) host/blog--behaviors) "publish"))
|
||||
(list true true))
|
||||
(host-bl-test "P1: match-behaviors resolves a create/article activity → a binding with a DERIVED runner"
|
||||
(let ((ms (host/blog--match-behaviors {:verb "create" :object-type "article"})))
|
||||
(list (len ms) (get (get (first ms) :runner) :capabilities)))
|
||||
(list 1 (list "effect" "branch" "each")))
|
||||
(host-bl-test "P1: a non-article activity matches nothing"
|
||||
(len (host/blog--match-behaviors {:verb "create" :object-type "note"})) 0)
|
||||
(host-bl-test "relate no auth -> redirect to login"
|
||||
(dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/relate" nil
|
||||
"application/x-www-form-urlencoded" "other=another-one"))) 303)
|
||||
|
||||
Reference in New Issue
Block a user