host P0.3b: durable flow log — survives restart (LIVE-VERIFIED)

The driver now persists each effect record to the blog store (string-keyed to dodge the keyword/
persist top-level split), and host/blog-load-flowlog! rebuilds the in-memory log on boot (wired into
serve.sh after load-edges!). So /flows survives a restart — closing the P0.3 gap.

LIVE PROOF: published a post on blog.rose-ash.com → /flows showed validate+notify → RESTARTED the
container (in-memory log lost) → /flows STILL showed them, reloaded from the durable store.
Round-trip also covered by a conformance test (persist → clear → reload → identical). blog 208/208,
full host conformance 599/599. Note: whole-list rewrite per effect — fine at P0 volume, cap/rotate later.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 15:01:10 +00:00
parent 9ac6a8afd5
commit 67d2fad8d8
4 changed files with 39 additions and 5 deletions

View File

@@ -1223,8 +1223,22 @@
(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))
(map (fn (e) (get e "verb")) host/blog--flow-log))
(list "validate" "digest" "validate" "notify"))
;; P0.3b: the flow log is DURABLE — it round-trips through the blog store (survives a restart).
(host-bl-test "P0.3b: the flow log persists + reloads from the store (string-keyed, no split)"
(begin
(set! host/blog--flow-log (list))
(persist/backend-kv-put host/blog-store host/blog--flowlog-key (list)) ;; reset durable
(host/blog-put! "p03d" "D" "(article (h1 \"d\"))" "published")
(host/blog--set-field-values! "p03d" {"category" "newsletter"})
(host/blog--maybe-publish! "p03d" "draft" "published") ;; fires → persists
(let ((before (map (fn (e) (get e "verb")) host/blog--flow-log)))
(begin
(set! host/blog--flow-log (list)) ;; simulate a restart
(host/blog-load-flowlog!) ;; reload from the store
(list before (map (fn (e) (get e "verb")) host/blog--flow-log)))))
(list (list "validate" "digest") (list "validate" "digest")))
(define
host-bl-tests-run!