The slug extractor after (api. scanned for the first ) but for nested
URLs like (api.(delete.1)) it got "(delete.1" instead of "delete".
Now handles nested parens: extracts handler name and injects path
params into query string. Also strengthened the Playwright test to
accept confirm dialogs and assert strict row count decrease.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The OCaml render-to-sx wrapper now correctly overrides the SX version
loaded from adapter-sx.sx: string inputs get parsed → aser evaluated,
AST inputs delegate to the SX version. Fixes ~41 aser test failures.
1661 → 1702 passing tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- cek-call/cek-run: dispatch through Sx_ref.cek_call for signal tests
- context: registered as both env binding and Sx_primitives primitive
so signals.sx can resolve it through the primitive table
- forms.sx: loaded before other web modules — provides defpage special
form, stream-chunk-id, normalize-binding-key, etc.
- regex-find-all: substring-based stub for component scanning
- now-ms: stub returning 1000
1525 → 1578 passing tests (+53).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Load 3 web modules in test runner: router.sx (75 URL/route tests),
deps.sx (40 analysis tests), orchestration.sx (18 cache/offline tests).
Rename render-sx → render-to-sx in test-aser.sx to match actual fn name.
1372 → 1525 passing tests (+153).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
79 occurrences renamed to match the actual function name in
adapter-sx.sx. Tests still fail because render-to-sx takes an
AST expression, not a source string — needs eval-string wrapper.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three fixes in run_tests.ml defhandler parser:
1. Extract &key param names, store in hdef["params"]. run-handler
binds them from mock args before evaluating — fixes row-editing,
tabs, inline-edit, profile-editing handlers.
2. Capture all body forms after params, wrap in (do ...) when
multiple — fixes ex-slow (sleep before let).
3. Register all HTML tags as native fns via Sx_render.html_tags —
fixes ex-bulk (tr tag), and enables aser to serialize any tag.
1352 → 1361 passing tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three tests covering the beforeend pagination pattern: page 1 appends
items with sentinel trigger, page 2 appends more, last page shows
"All items loaded" without sentinel.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The ~geography/scopes-demo-example component had (&key demo code), and
its body used (code code) — the parameter shadowed the HTML tag, causing
"Undefined symbol: code" at render time. Renamed to (&key demo src).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The poll trigger in bind-triggers called set-interval but discarded the
interval ID, so polls continued firing after the element was removed from
the DOM. Now the callback checks el.isConnected each tick and self-clears
when the element is gone (HTMX-style cleanup).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tag names from dom-tag-name are lowercase (not uppercase) in the WASM
kernel — fix FORM/INPUT/SELECT/TEXTAREA comparisons in get-default-trigger.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Handler source is now SX (from defhandler forms), not Python.
Default handler-lang changed from "python" to "sx".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
highlight returns (code (span ...)) elements which render-to-html
handles but aser doesn't. OOB responses go through aser. Plain text
for now — highlighting needs to happen client-side or aser needs
HTML tag support.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now calls (highlight text) to produce syntax-colored SX output.
OCaml-side aser has full env so code/span tags resolve correctly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Skip the SX api function entirely. The OCaml handler interception
looks up handler:ex-{slug} in the env, extracts the body, and calls
aser directly with the full global env. This avoids the double-eval
problem where eval-expr evaluates HTML tags as function calls and
then tries to call the result.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aser in SX doesn't have access to helper/now/state-get. eval-expr
evaluates the body in the current env, returns the AST. The OCaml
handler interception then calls aser server-side with the full env.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Handler closure env didn't have HTML tags (code, span, div etc.)
causing Undefined symbol errors. aser without explicit env uses
the global env which has all tags registered.
Also reverts oob-code highlight change (code tag not available in
aser context).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Was displaying plain text in (code text). Now calls (highlight text)
to produce colored SX output.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
highlight was double-wrapping in (code ...). Match component-source
pattern — return pretty-printed string, page handles display.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keywords were printed as strings because list treated :path as kwargs.
Now uses make-keyword to build keyword nodes. Output goes through
highlight for syntax coloring.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Builds (defhandler name :path ... :method ... params body) from
the handler dict fields and pretty-prints it with syntax highlighting.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both used (env-get name) with one arg which always returned nil.
Now use eval-expr + make-symbol with cek-try fallback, same pattern
as the handler dispatch.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Handler bodies contain HTML elements (div, p, span) which need the
render pipeline. eval-expr treats them as function calls. aser
evaluates and serializes HTML to wire format.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
defhandler was only available via web-forms.sx which had load
dependencies that failed. Now registered as a native special form
in make_server_env, works in both coroutine and HTTP modes.
Key fix: custom special forms receive [List args; Env eval_env],
not flat args. The handler is now bound in the eval env, not the
make_server_env closure env.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
env-get requires (env-get env name) with two args but dispatch.sx
was calling it with one arg, always returning nil. Now uses
eval-expr + make-symbol to resolve the handler binding in the
current env, with cek-try fallback to nil.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The query string was stripped from path for routing but the debug
endpoint needs it to parse ?expr= and ?name= params.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Checks binary mtime every 10 requests. If the binary has been
rebuilt, closes the listen socket and exec's itself. No more
stale server after builds.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
From other session: adapter-html/sx/dom fixes, orchestration
improvements, examples-content refactoring, SPA navigation test
updates, WASM copies synced.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- sx_load_check: validate all .sx files parse cleanly (108 files)
- sx_env: search defined symbols by pattern/type
- sx_handler_list: list registered defhandler forms
- sx_page_list: list page functions from page-functions.sx (41 pages)
- sx_request: HTTP request to running server, returns status + body
These tools help debug silent load failures, missing definitions,
and handler routing issues.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
api and call-handler now use (error ...) for not-found and method
mismatch, so error boundaries catch them properly instead of
rendering error messages as page content.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Paths containing (api.) are intercepted before page routing and
dispatched directly to the api function. The handler result is
rendered to SX wire format and returned without layout wrapping.
This fixes the issue where handler URLs went through page routing,
causing the handler result to be passed as a slug to the page
function, and the response to be wrapped in the full page layout.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comprehensive interaction tests covering GET handlers (click-to-load,
tabs, polling, search, filter, keyboard, lazy-load), POST handlers
(form-submission, inline-validation, reset), mutation handlers
(delete-row, edit-row, inline-edit, bulk-update, put-patch), and
special handlers (dialogs, oob-swaps, animations, progress-bar, retry,
json-encoding, vals-and-headers).
Tests use trackErrors + waitForSxReady. Will pass once server is
restarted with request primitives and handler dispatch.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Request primitives (now, state-get/set!/clear!, request-form/arg,
into, request-headers-all, etc.) added to test runner environment.
17 new tests covering all primitives with round-trip, default value,
and type assertion checks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OCaml server:
- Accept POST/PUT/PATCH/DELETE for /sx/ paths (was GET-only)
- Parse request body, query string, set per-request context
- Add 16 request primitives: now, state-get/set!, request-form/arg,
request-json, request-header(s), request-method/body, into, etc.
- URL-encoded body parser for form submissions
Handler dispatch (sx/sx/handlers/dispatch.sx):
- `api` function routes URL paths like (api "click") to handler:ex-click
- `call-handler` checks HTTP method, binds params, evaluates body
- Handlers defined via defhandler in handlers/examples.sx now reachable
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The OCaml parser doesn't handle \xe2\x80\x94 (em-dash). Replaced
with -- throughout.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
build-reference-data, build-attr-detail, etc. were undefined because
page-helpers.sx wasn't in the explicit core_files list.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These were lost during an earlier sx_replace_node edit. Both use
case expressions to route slugs to the correct data tables.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same pattern as tools — passthrough returning nil fell through to
parent geography page. Now returns empty string so layout renders
with correct nav context.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The tools page function returned nil when no child route matched,
causing a 404. Now returns empty string so the layout renders.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Route errors and missing pages now show a styled error message inside
the normal layout (header, nav still work) instead of bare "nil" text
or a raw "Not Found" page. AJAX errors return renderable SX error
fragments instead of "nil" strings.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
highlight.sx now returns a list of (span :class "..." "text") elements
instead of a string. The rendering pipeline handles the rest:
- Server render-to-html: produces <span class="...">text</span>
- Client render-to-dom: produces DOM span elements
- Aser: serializes spans as SX for client rendering
Key fixes:
- hl-span uses (make-keyword "class") not :class (keywords evaluate
to strings in list context)
- render-sx-tokens returns flat list of spans (no wrapper)
- hl-escape is identity (no escaping needed for tree values)
- highlight.sx added to browser bundle + platform loader
- ~docs/code renders src directly as child of pre
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>