host: P0 review — fix edit-submit ordering bug + record carried-forward debt

REVIEW at the P0-complete milestone found one live bug and several forward prerequisites.

FIX (was live): edit-submit ran maybe-publish! BEFORE set-field-values!, so an edit that set a
category and published in one submit fired the publish activity on the STALE category (wrong branch).
Reordered — fields land before the transition fires. Regression test added (fields-first →
newsletter→digest, not stale→notify). blog 210/210.

Recorded carried-forward debt in the plan: activity identity (DEBT #1, blocks P2 — :id=CID false-
dedups relation events), capability bind not wired into the live engine (DEBT #2, P1), synchronous-
in-request dispatch (DEBT #3, RA needs the async boundary + background pump), the 'urgent' default
smell (DEBT #4). Sequencing note: P1's runner-derivation is vacuous until RA adds a 2nd runner, and
RA is the load-bearing risk — recommend a narrow RA spike next to de-risk the durable/federated half.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 15:17:48 +00:00
parent 77e89a9965
commit a5d43246e0
3 changed files with 46 additions and 3 deletions

View File

@@ -2659,14 +2659,16 @@
(if (= (len issues) 0)
(begin
(host/blog-put! slug title sx-content status)
;; P0.3: a draft→published transition fires the publish flow through the seam.
(host/blog--maybe-publish! slug (get r :status) status)
;; store the typed field values from the generic, type-driven form (Slice 8b)
;; store the typed field values FIRST — the publish activity reads :category from
;; them, so field-writes must land before the transition fires (else it branches on
;; the stale category on an edit that both sets a category and publishes).
(host/blog--set-field-values! slug
(reduce (fn (acc f)
(assoc acc (get f :name)
(or (host/field req (str "field-" (get f :name))) "")))
{} post-fields))
;; P0.3: a draft→published transition fires the publish flow through the seam.
(host/blog--maybe-publish! slug (get r :status) status)
(dream-redirect (str "/" slug "/")))
(let ((issue-items (map (fn (i) (quasiquote (li (unquote i)))) issues)))
(host/blog--resp req 400