Replace sx_call() with render_to_sx() across all services

Python no longer generates s-expression strings. All SX rendering now
goes through render_to_sx() which builds AST from native Python values
and evaluates via async_eval_to_sx() — no SX string literals in Python.

- Add render_to_sx()/render_to_html() infrastructure in shared/sx/helpers.py
- Add (abort status msg) IO primitive in shared/sx/primitives_io.py
- Convert all 9 services: ~650 sx_call() invocations replaced
- Convert shared helpers (root_header_sx, full_page_sx, etc.) to async
- Fix likes service import bug (likes.models → models)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 00:08:33 +00:00
parent 0554f8a113
commit e085fe43b4
51 changed files with 1824 additions and 1742 deletions

View File

@@ -73,8 +73,7 @@ def register(url_prefix: str) -> Blueprint:
result = await g.s.execute(stmt)
orders = result.scalars().all()
from shared.sx.helpers import sx_response, sx_call, SxExpr
from shared.sx.parser import serialize
from shared.sx.helpers import sx_response, render_to_sx
from shared.utils import route_prefix
pfx = route_prefix()
@@ -96,16 +95,16 @@ def register(url_prefix: str) -> Blueprint:
# Build just the rows fragment (not full table) for infinite scroll
parts = []
for od in order_dicts:
parts.append(sx_call("order-row-pair",
order=SxExpr(serialize(od)),
parts.append(await render_to_sx("order-row-pair",
order=od,
detail_url_prefix=detail_prefix))
if page < total_pages:
parts.append(sx_call("infinite-scroll",
parts.append(await render_to_sx("infinite-scroll",
url=rows_url + qs_fn(page=page + 1),
page=page, total_pages=total_pages,
id_prefix="orders", colspan=5))
else:
parts.append(sx_call("order-end-row"))
parts.append(await render_to_sx("order-end-row"))
sx_src = "(<> " + " ".join(parts) + ")"
resp = sx_response(sx_src)