IO registry: defio declares platform suspension points

Core SX has zero IO — platforms extend __io-registry via (defio name
:category :data/:code/:effect ...). The server web platform declares 44
operations in web/io.sx. batchable_helpers now derived from registry
(:batchable true) instead of hardcoded list. Startup validation warns if
bound IO ops lack registry entries. Browser gets empty registry, ready
for step 5 (IO suspension).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 23:21:48 +00:00
parent 17b6c872f2
commit ede05c26f5
16 changed files with 486 additions and 58 deletions

View File

@@ -425,7 +425,6 @@
()
(do
(log-info (str "sx-browser " SX_VERSION))
(init-css-tracking)
(process-page-scripts)
(process-sx-scripts nil)
(sx-hydrate-elements nil)
@@ -433,7 +432,6 @@
(run-post-render-hooks)
(flush-collected-styles)
(set-timeout (fn () (process-elements nil)) 0)
(dom-listen (dom-window) "popstate" (fn (e) (handle-popstate 0)))
(dom-set-attr
(host-get (dom-document) "documentElement")
"data-sx-ready"

File diff suppressed because one or more lines are too long

View File

@@ -117,7 +117,7 @@
build-request-headers
:effects (io)
(fn
(el (loaded-components :as list) (css-hash :as string))
(el (loaded-components :as list))
(let
((headers (dict "SX-Request" "true" "SX-Current-URL" (browser-location-href))))
(let
@@ -126,7 +126,6 @@
(let
((comp-hash (dom-get-attr (dom-query "script[data-components][data-hash]") "data-hash")))
(when comp-hash (dict-set! headers "SX-Components-Hash" comp-hash)))
(when css-hash (dict-set! headers "SX-Css" css-hash))
(let
((extra-h (dom-get-attr el "sx-headers")))
(when
@@ -162,8 +161,6 @@
(get-header "SX-Location")
"replace-url"
(get-header "SX-Replace-Url")
"css-hash"
(get-header "SX-Css-Hash")
"trigger-swap"
(get-header "SX-Trigger-After-Swap")
"trigger-settle"

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,5 @@
(define _preload-cache (dict))
(define _css-hash "")
(define
dispatch-trigger-events
:effects (mutation io)
@@ -26,19 +24,6 @@
(dom-dispatch el trimmed (dict)))))
(split header-val ",")))))))
(define
init-css-tracking
:effects (mutation io)
(fn
()
(let
((meta (dom-query "meta[name=\"sx-css-classes\"]")))
(when
meta
(let
((content (dom-get-attr meta "content")))
(when content (set! _css-hash content)))))))
(define
execute-request
:effects (mutation io)
@@ -115,8 +100,7 @@
(final-url (get body-info "url"))
(body (get body-info "body"))
(ct (get body-info "content-type"))
(headers
(build-request-headers el (loaded-component-names) _css-hash))
(headers (build-request-headers el (loaded-component-names)))
(csrf (csrf-token)))
(when
extraParams
@@ -214,9 +198,6 @@
(text :as string))
(let
((resp-headers (process-response-headers get-header)))
(let
((new-hash (get resp-headers "css-hash")))
(when new-hash (set! _css-hash new-hash)))
(dispatch-trigger-events el (get resp-headers "trigger"))
(process-cache-directives el resp-headers text)
(cond
@@ -1144,8 +1125,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash))
(loaded-component-names)))
true)
(if
(get match "has-data")
@@ -1181,8 +1161,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1240,8 +1219,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1262,8 +1240,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1293,8 +1270,7 @@
pathname
(build-request-headers
target
(loaded-component-names)
_css-hash)
(loaded-component-names))
0))
(swap-rendered-content
target
@@ -1471,10 +1447,7 @@
info
(do-preload
(get info "url")
(build-request-headers
el
(loaded-component-names)
_css-hash)))))))))))
(build-request-headers el (loaded-component-names))))))))))))
(define
do-preload
@@ -1592,8 +1565,4 @@
:effects (mutation io)
(fn
()
(do
(init-css-tracking)
(sx-process-scripts nil)
(sx-hydrate nil)
(process-elements nil))))
(do (sx-process-scripts nil) (sx-hydrate nil) (process-elements nil))))

File diff suppressed because one or more lines are too long