host: blog persisted in durable SX store + materialised view, 158/158
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s

Blog posts now live in the durable SX store (persist/durable-backend, on-disk
under $SX_PERSIST_DIR — already built: sx_persist_store.ml + lib/persist/
durable.sx). Publishing appends insert ops to the slug's content stream; posts
survive restarts (verified: seq/log stable across container restart, re-seed
idempotent).

Read path: http-listen handlers can't drive per-request perform/IO (sx_call
doesn't resolve the CEK IO suspension the way the main loop does), so posts are
materialised from the store into an in-memory view at boot (host/blog-load-all!
+ host/blog-seed!) and request handlers read the view — perform-free. Store is
source of truth; view is a boot-rebuilt cache.

Deploy: docker-compose.dev-sx-host.yml mounts /root/sx-host-persist (chowned to
appuser 10001) at /data/persist; SX_PERSIST_DIR set. blog.rose-ash.com/welcome/
live. Per-request-IO kernel fix tracked in the plan as the next task.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 18:33:00 +00:00
parent e2a90e3bbd
commit 4e79b010b2
6 changed files with 110 additions and 36 deletions

View File

@@ -22,9 +22,9 @@
(define host-bl-app
(host/make-app (list host/feed-routes host/blog-routes)))
;; ── render a registered post ────────────────────────────────────────
(host/blog-reset!)
(host/blog-register! "welcome" (host/blog-make "welcome" "Hello SX" "Served by lib/host."))
;; ── publish a post to a fresh in-memory store (hermetic) ────────────
(host/blog-use-store! (persist/open))
(host/blog-publish! "welcome" "Hello SX" "Served by lib/host." 1)
(host-bl-test
"post 200"
@@ -48,11 +48,17 @@
(dream-status (host-bl-app (host-bl-req "/welcome")))
200)
;; golden: endpoint body == content facade render of the same doc
;; golden: endpoint body == the exact rendered HTML of the published post
(host-bl-test
"golden = content/html"
"golden render"
(dream-resp-body (host-bl-app (host-bl-req "/welcome/")))
(content/html (host/blog-make "welcome" "Hello SX" "Served by lib/host.")))
"<h1>Hello SX</h1><p>Served by lib/host.</p>")
;; persistence: a post materialises from the op-log (replay), and re-seeding is
;; idempotent (no duplicate blocks appended).
(host-bl-test "lookup materialises 2 blocks" (content/count (host/blog-lookup "welcome")) 2)
(host/blog-seed! "welcome" "Hello SX" "Served by lib/host." 2)
(host-bl-test "re-seed is idempotent" (content/count (host/blog-lookup "welcome")) 2)
;; ── unknown slug -> 404 ─────────────────────────────────────────────
(host-bl-test