host: SX-native wire — reads + write bodies are text/sx, JSON CRUD deleted
Greenfield SX-native pivot (NOT a strangler): the host speaks SX/SXTP end to end;
JSON only at the future ActivityPub federation edge.
- OUTPUT: host/json-status -> host/sx-status — every host/ok/host/error response is
text/sx via the serialize primitive (NOT application/json). Flips feed, relations,
blog reads. Tests assert the SX envelope ({:ok true :data ...}).
- DELETE the blog JSON CRUD /posts (POST/PUT/DELETE) + bearer-based host/blog--protect:
a pure old-contract REST mirror. Create/edit go through the HTML editor forms;
programmatic writes speak SXTP. FOLLOW-UP: no browser delete route yet (was JSON-only,
no UI) — add POST /:slug/delete + cascade edge cleanup when the metamodel UI needs it.
- INPUT: host/sx-body (sxtp.sx) parses a text/sx request body to a string-keyed dict
(parse-safe + sxtp/-normalize). feed POST + relations attach/detach read it.
- UNIFIED field reader host/fields / host/field: text/sx body OR urlencoded form by
content-type. The blog form handlers (new/edit/relate/unrelate) + login read through
it — additive, urlencoded still works (no-engine / bootstrap fallback).
Conformance 290/290 (11 suites). Retires the strangler framing in the plan; adds the
'SX all the way out' wire table. The engine half (browser posts text/sx) follows.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
(dream-status (host-fd-app (host-fd-req "/feed")))
|
||||
200)
|
||||
(host-fd-test
|
||||
"empty feed data:[]"
|
||||
(contains? (dream-resp-body (host-fd-app (host-fd-req "/feed"))) "\"data\":[]")
|
||||
"empty feed data ()"
|
||||
(contains? (dream-resp-body (host-fd-app (host-fd-req "/feed"))) ":data ()")
|
||||
true)
|
||||
|
||||
;; ── seeded feed ────────────────────────────────────────────────────
|
||||
@@ -47,7 +47,7 @@
|
||||
(host-fd-test
|
||||
"timeline recent-first"
|
||||
(let ((body (dream-resp-body (host-fd-app (host-fd-req "/feed")))))
|
||||
(< (index-of body "\"at\":3") (index-of body "\"at\":1")))
|
||||
(< (index-of body ":at 3") (index-of body ":at 1")))
|
||||
true)
|
||||
|
||||
;; actor filter: only alice's two activities.
|
||||
@@ -68,25 +68,18 @@
|
||||
"limit caps results"
|
||||
(contains?
|
||||
(dream-resp-body (host-fd-app (host-fd-req "/feed?limit=1")))
|
||||
"\"at\":1")
|
||||
":at 1")
|
||||
false)
|
||||
|
||||
;; ── golden: endpoint = subsystem recent stream + envelope ───────────
|
||||
(host-fd-test
|
||||
"golden full timeline"
|
||||
(dream-resp-body (host-fd-app (host-fd-req "/feed")))
|
||||
(str
|
||||
"{\"ok\":true,\"data\":"
|
||||
(dream-json-encode (feed/items (feed/recent (feed/all))))
|
||||
"}"))
|
||||
(serialize {:ok true :data (feed/items (feed/recent (feed/all)))}))
|
||||
(host-fd-test
|
||||
"golden actor-filtered"
|
||||
(dream-resp-body (host-fd-app (host-fd-req "/feed?actor=alice")))
|
||||
(str
|
||||
"{\"ok\":true,\"data\":"
|
||||
(dream-json-encode
|
||||
(feed/items (feed/by-actor (feed/recent (feed/all)) "alice")))
|
||||
"}"))
|
||||
(serialize {:ok true :data (feed/items (feed/by-actor (feed/recent (feed/all)) "alice"))}))
|
||||
|
||||
;; ── write: POST /feed (auth + ACL + action) ────────────────────────
|
||||
(acl/load! (list (acl-grant "alice" "post" "feed")))
|
||||
@@ -115,7 +108,7 @@
|
||||
(host-fd-wapp
|
||||
(host-fd-post
|
||||
"Bearer good"
|
||||
"{\"actor\":\"alice\",\"verb\":\"post\",\"object\":\"p9\",\"at\":9}")))
|
||||
"{:actor \"alice\" :verb \"post\" :object \"p9\" :at 9}")))
|
||||
201)
|
||||
(host-fd-test "post grew feed" (feed/size) 1)
|
||||
(host-fd-test
|
||||
@@ -126,7 +119,7 @@
|
||||
true)
|
||||
(host-fd-test
|
||||
"post non-object body -> 400"
|
||||
(dream-status (host-fd-wapp (host-fd-post "Bearer good" "[1,2]")))
|
||||
(dream-status (host-fd-wapp (host-fd-post "Bearer good" "(1 2)")))
|
||||
400)
|
||||
|
||||
(define
|
||||
|
||||
Reference in New Issue
Block a user