Fix JIT compiler, CSSX browser support, double-fetch, SPA layout

JIT compiler:
- Fix jit_compile_lambda: resolve `compile` via symbol lookup in env
  instead of embedding VmClosure in AST (CEK dispatches differently)
- Register eval-defcomp/eval-defisland/eval-defmacro runtime helpers
  in browser kernel for bytecoded defcomp forms
- Disable broken .sxbc.json path (missing arity in nested code blocks),
  use .sxbc text format only
- Mark JIT-failed closures as sentinel to stop retrying

CSSX in browser:
- Add cssx.sx symlink + cssx.sxbc to browser web stack
- Add flush-cssx! to orchestration.sx post-swap for SPA nav
- Add cssx.sx to compile-modules.js and mcp_tree.ml bytecode lists

SPA navigation:
- Fix double-fetch: check e.defaultPrevented in click delegation
  (bind-event already handled the click)
- Fix layout destruction: change nav links from outerHTML to innerHTML
  swap (outerHTML destroyed #main-panel when response lacked it)
- Guard JS popstate handler when SX engine is booted
- Rename sx-platform.js → sx-platform-2.js to bust immutable cache

Playwright tests:
- Add trackErrors() helper to all test specs
- Add SPA DOM comparison test (SPA nav vs fresh load)
- Add single-fetch + no-duplicate-elements test
- Improve MCP tool output: show failure details and error messages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 20:48:43 +00:00
parent 5b55b75a9a
commit d81a518732
37 changed files with 688 additions and 405 deletions

View File

@@ -3,7 +3,7 @@
* Geography demos — comprehensive page load + interaction tests.
*/
const { test, expect } = require('playwright/test');
const { loadPage } = require('./helpers');
const { loadPage, trackErrors } = require('./helpers');
// ---------------------------------------------------------------------------
// Helpers
@@ -20,6 +20,10 @@ async function expectIsland(page, pattern) {
// ===========================================================================
test.describe('Geography sections', () => {
let t;
test.beforeEach(({ page }) => { t = trackErrors(page); });
test.afterEach(() => { expect(t.errors()).toEqual([]); });
const sections = [
['(geography)', 'Geography'],
['(geography.(reactive))', 'Reactive'],
@@ -47,6 +51,10 @@ test.describe('Geography sections', () => {
// ===========================================================================
test.describe('Reactive demos', () => {
let t;
test.beforeEach(({ page }) => { t = trackErrors(page); });
test.afterEach(() => { expect(t.errors()).toEqual([]); });
const demos = [
['counter', 'counter'],
['temperature', 'temperature'],
@@ -109,6 +117,10 @@ test.describe('Reactive demos', () => {
// ===========================================================================
test.describe('Hypermedia demos', () => {
let t;
test.beforeEach(({ page }) => { t = trackErrors(page); });
test.afterEach(() => { expect(t.errors()).toEqual([]); });
const demos = [
'click-to-load', 'form-submission', 'polling', 'delete-row', 'edit-row',
'tabs', 'active-search', 'inline-validation', 'lazy-loading',
@@ -131,6 +143,7 @@ test.describe('Hypermedia demos', () => {
// ===========================================================================
test('counter → temperature → counter: all stay reactive', async ({ page }) => {
const t = trackErrors(page);
await loadPage(page, '(geography.(reactive.(examples.counter)))');
let el = await expectIsland(page, 'counter');
@@ -165,6 +178,8 @@ test('counter → temperature → counter: all stay reactive', async ({ page })
await page.waitForTimeout(300);
expect(await el.textContent()).not.toBe(before);
}
expect(t.errors()).toEqual([]);
});
@@ -173,6 +188,10 @@ test('counter → temperature → counter: all stay reactive', async ({ page })
// ===========================================================================
test.describe('Other geography pages', () => {
let t;
test.beforeEach(({ page }) => { t = trackErrors(page); });
test.afterEach(() => { expect(t.errors()).toEqual([]); });
const pages = [
'(geography.(cek.demo))', '(geography.(cek.content))', '(geography.(cek.freeze))',
'(geography.(marshes.hypermedia-feeds))', '(geography.(marshes.on-settle))',
@@ -189,6 +208,10 @@ test.describe('Other geography pages', () => {
});
test.describe('Reference pages', () => {
let t;
test.beforeEach(({ page }) => { t = trackErrors(page); });
test.afterEach(() => { expect(t.errors()).toEqual([]); });
for (const sub of ['attributes', 'events', 'headers', 'js-api']) {
test(`${sub} loads`, async ({ page }) => {
await loadPage(page, `(geography.(hypermedia.(reference.${sub})))`);