host P0.3: wire the seam into the live publish path (LIVE-VERIFIED)

Publishing a post now fires the on-publish behavior DAG through the seam. host/blog--{transport
(activity log), triggers (on-publish: create+article → publish-DAG), driver (records each effect in
the flow log), publish-engine (behavior/make-engine over the four adapters + the execute-fold runner
+ publish-ctx), fire-publish!, maybe-publish!}. Both write handlers (form-submit POST /new,
edit-submit POST /:slug/edit) detect the draft→published TRANSITION (fire-once) in the handler body
and run behavior/process. GET /flows renders the flow log (the effect-as-data the driver dispatched).

LIVE PROOF: logged in + POST /new on blog.rose-ash.com → /flows shows 'validate' + 'notify' (the
publish-DAG branched on the default urgent category), driven end-to-end by the real behavior engine.
Every piece is a seam adapter — swapping the runner for Erlang (RA) or the transport for fed-sx (TA)
federates this same wiring unchanged.

blog 207/207 (+4 P0.3), full host conformance 595/595. GAP: flow log is in-memory (P0.3b = persist).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 14:56:00 +00:00
parent 564fa7dd7d
commit 9ac6a8afd5
3 changed files with 107 additions and 8 deletions

View File

@@ -1200,6 +1200,31 @@
(list (host/flow--required-caps host/blog--publish-dag)
(get (host/flow--bind host/flow--exec-runner host/blog--publish-dag) :ok))
(list (list "effect" "branch") true))
;; P0.3: the draft→published TRANSITION fires the publish flow THROUGH THE SEAM (engine = the
;; execute-fold runner + on-publish registry + transport + host driver) → effects land in the flow log.
(set! host/blog--flow-log (list))
(set! host/blog--activity-log (list))
(host-bl-test "P0.3: draft→published fires the publish flow through the seam → effects logged"
(begin
(host/blog-put! "p03a" "P" "(article (h1 \"x\"))" "published")
(host/blog--set-field-values! "p03a" {"category" "newsletter"})
(host/blog--maybe-publish! "p03a" "draft" "published")
(list (map (fn (e) (get e :verb)) host/blog--flow-log) (len host/blog--activity-log)))
(list (list "validate" "digest") 1))
(host-bl-test "P0.3: published→published does NOT re-fire (fire-once on the transition)"
(begin
(host/blog--maybe-publish! "p03a" "published" "published")
(list (map (fn (e) (get e :verb)) host/blog--flow-log) (len host/blog--activity-log)))
(list (list "validate" "digest") 1))
(host-bl-test "P0.3: a →draft transition does not fire"
(begin (host/blog--maybe-publish! "p03a" "published" "draft") (len host/blog--activity-log)) 1)
(host-bl-test "P0.3: a fresh nil→published (new post) fires, urgent→notify"
(begin
(host/blog-put! "p03b" "U" "(article (h1 \"u\"))" "published")
(host/blog--set-field-values! "p03b" {"category" "urgent"})
(host/blog--maybe-publish! "p03b" nil "published")
(map (fn (e) (get e :verb)) host/blog--flow-log))
(list "validate" "digest" "validate" "notify"))
(define
host-bl-tests-run!