From 962cb1b43e26693611783aa48a9485a97a024e0d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:47:17 +0000 Subject: [PATCH] =?UTF-8?q?host:=20revert=20legacy-editor=20shims=20?= =?UTF-8?q?=E2=80=94=20clean=20over=20fancy,=20181/181?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull out the debt that revived the legacy editor: removed kg-compat.sx (uncommitted bare->namespaced kg-card aliases), the ./blog container mount, the legacy sx-editor.js + hardcoded asset URLs + ~editor/sx-editor-styles reuse at /new, and the blog/sx preloads. /new is now a clean minimal form. Finding that reshapes Phase 5: render-page (5.1) renders STATIC component trees but is NOT the full evaluator — a component with a data loop ((map fn items) over (unquote data)) errors 'Not callable: nil'. So clean dynamic component pages + a native island editor need the aser SSR pipeline (5.2), not just render-page. Posts still render via per-block guarded render-page; unsupported editor cards (~kg-md) show placeholders by design (no alias shim). All endpoints 200, boot clean. Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 3 -- lib/host/blog.sx | 50 +++++++++++----------------------- lib/host/conformance.sh | 2 -- lib/host/serve.sh | 2 -- plans/host-on-sx.md | 18 ++++++++++-- 5 files changed, 31 insertions(+), 44 deletions(-) diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 185751d7..3621980d 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -28,9 +28,6 @@ services: - ./spec:/app/spec:ro - ./lib:/app/lib:ro - ./web:/app/web:ro - # blog app SX — reused for the editor's style component (transitional; - # retire when the editor + its styles are host-owned / asset-managed) - - ./blog:/app/blog:ro # OCaml server binary — this worktree's build (has the SX_HTTP_HOST bind fix) - ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro # Durable persist store (the SX op-log/kv on disk) — survives restarts. diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 6f4f3f7a..53e610c5 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -116,43 +116,25 @@ (define host/blog-index (fn (req) (host/ok (host/blog-list)))) -;; ── create page (GET /new) — the real WYSIWYG block editor ────────── -;; Mounts the self-contained sx-editor.js (Ghost/Koenig-style block editor) that -;; serializes the visual edit to `sx_content`. Assets (sx-browser.js for Sx.parse, -;; sx-editor.js, editor.css) are referenced from the docs static host -;; (sx.rose-ash.com/static/scripts) — no host static-serving needed. On submit the -;; handle's getSx() fills the hidden sx_content field, then it POSTs to /new. -;; (This reuses the legacy JS editor; a native SX-island editor is the future.) -(define host/blog--asset "https://sx.rose-ash.com/static/scripts") +;; ── create page (GET /new) — clean minimal form ──────────────────── +;; A plain create form: title + sx_content (SX element markup) + status. No +;; legacy JS editor, no external assets, no shims. The rich WYSIWYG is a future +;; native SX-island editor served via the Phase-5.2 SSR pipeline (render-page +;; alone can't render dynamic-logic component bodies — proven). Posts to /new. (define host/blog-new-form (fn (req) (dream-html - (str - "New post" - ;; FontAwesome for the editor's +/slash-menu icons. - "" - ;; The sx-editor's own styles (.sx-*), rendered from its component via 5.1. - (render-page (quote (~editor/sx-editor-styles))) - "" - "" - "
" - "" - "" - "
" - "
" - "" - "" - "all posts
" - "
" - "" - "" - "" - "")))) + (host/blog--page "New post" + (str + "

New post

" + "
" + "

" + "

" + "

" + "

" + "

← all posts

"))))) ;; ── write handlers ────────────────────────────────────────────────── ;; POST /new — form-urlencoded ingest (the editor's submit shape: title, diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 90578404..c5ab4f1b 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -63,8 +63,6 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" - "blog/sx/layouts.sx" - "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 3191725f..0d7d8680 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -68,8 +68,6 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" - "blog/sx/layouts.sx" - "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index c8ba5df7..cabe03c8 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -228,9 +228,21 @@ Sub-steps (each independently gated/verified): mangling). Root cause confirmed: bare render-to-html on an *evaluated* tree mangles attrs; `render-page` renders the *unevaluated* expr so expansion + attr-collection happen in render-to-html. -- [ ] **5.2 Shell statics in the host env.** Run `http_inject_shell_statics` for - the host's loaded components so the shell can inline defs/CSS/asset-hashes. - Gate: a full page shell emits with component defs inlined. +- [ ] **5.2 Shell statics + aser SSR (the real dynamic-page path).** `render-page` + (5.1) renders STATIC component trees, but is NOT the full evaluator — + dynamic-logic bodies fail (proven: a component doing `(map fn items)` over + `(unquote data)` → "Not callable: nil"). Clean dynamic component pages + (a posts loop) + island pages therefore need the **aser** pipeline (evaluate + control flow, serialise tags) + `http_inject_shell_statics` (component defs / + CSS / asset hashes) + `~shared:shell/sx-page-shell`. Gate: a page with a data + loop renders, and a full shell emits with defs inlined. + NOTE (2026-06-19): the legacy-editor stopgaps (kg-compat aliases, `./blog` + mount, legacy `sx-editor.js` + hardcoded asset URLs at `/new`, the + `~editor/sx-editor-styles` reuse) were REVERTED — they were debt to revive + stale code. `/new` is now a clean minimal form; host pages still use minimal + shell HTML until the aser path lands. Posts render via per-block guarded + `render-page`; unsupported editor cards (e.g. `~kg-md`) show placeholders by + design (no alias shim). - [ ] **5.3 Static-asset serving.** Serve `/scripts/*.js`, `/*.css`, `/wasm/*` from `shared/static`. Host has none today — needs a kernel file-serving route in the `http-listen` server (or a file-read prim + SX static handler).