Split make_server_env, eliminate all runtime sx_ref imports, fix auth-menu tests
make_server_env split into 7 focused setup functions: - setup_browser_stubs (22 DOM no-ops) - setup_scope_env (18 scope primitives from sx_scope.ml) - setup_evaluator_bridge (CEK eval-expr, trampoline, expand-macro, etc.) - setup_introspection (type predicates, component/lambda accessors) - setup_type_operations (string/env/dict/equality/parser helpers) - setup_html_tags (~100 HTML tag functions) - setup_io_env (query, action, helper IO bridge) Eliminate ALL runtime sx_ref.py imports: - sx/sxc/pages/helpers.py: 24 imports → _ocaml_helpers.py bridge - sx/sxc/pages/sx_router.py: remove SX_USE_REF fallback - shared/sx/query_registry.py: use register_components instead of eval Unify JIT compilation: pre-compile list derived from allowlist (no manual duplication), only compiler internals pre-compiled. Fix test_components auth-menu: ~auth-menu → ~shared:fragments/auth-menu Tests: 1114 OCaml, 29/29 components, 35/35 regression, 6/6 Playwright Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,7 @@ class TestCartMini:
|
||||
class TestAuthMenu:
|
||||
def test_logged_in(self):
|
||||
html = sx(
|
||||
'(~auth-menu :user-email user-email :account-url account-url)',
|
||||
'(~shared:fragments/auth-menu :user-email user-email :account-url account-url)',
|
||||
**{"user-email": "alice@example.com", "account-url": "https://account.example.com/"},
|
||||
)
|
||||
assert 'id="auth-menu-desktop"' in html
|
||||
@@ -70,7 +70,7 @@ class TestAuthMenu:
|
||||
|
||||
def test_logged_out(self):
|
||||
html = sx(
|
||||
'(~auth-menu :account-url account-url)',
|
||||
'(~shared:fragments/auth-menu :account-url account-url)',
|
||||
**{"account-url": "https://account.example.com/"},
|
||||
)
|
||||
assert "fa-solid fa-key" in html
|
||||
@@ -78,7 +78,7 @@ class TestAuthMenu:
|
||||
|
||||
def test_desktop_has_data_close_details(self):
|
||||
html = sx(
|
||||
'(~auth-menu :user-email "x@y.com" :account-url "http://a")',
|
||||
'(~shared:fragments/auth-menu :user-email "x@y.com" :account-url "http://a")',
|
||||
)
|
||||
assert "data-close-details" in html
|
||||
|
||||
@@ -86,7 +86,7 @@ class TestAuthMenu:
|
||||
"""Both desktop and mobile spans are always rendered."""
|
||||
for email in ["user@test.com", None]:
|
||||
html = sx(
|
||||
'(~auth-menu :user-email user-email :account-url account-url)',
|
||||
'(~shared:fragments/auth-menu :user-email user-email :account-url account-url)',
|
||||
**{"user-email": email, "account-url": "http://a"},
|
||||
)
|
||||
assert 'id="auth-menu-desktop"' in html
|
||||
|
||||
Reference in New Issue
Block a user