Delete last sx_components.py files: relations + test (phase 9)

Move relations component loading into app.py. Move test rendering
functions to test/sxc/pages/__init__.py, update route imports, and
delete both sx_components.py files. Zero sx_components imports remain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 11:26:51 +00:00
parent 5bb02b7dd5
commit b51b050dda
7 changed files with 14 additions and 25 deletions

View File

@@ -1,7 +1,5 @@
from __future__ import annotations
import path_setup # noqa: F401
import sx.sx_components as sx_components # noqa: F401 # ensure Hypercorn --reload watches this file
from shared.infrastructure.factory import create_base_app
from bp import register_actions, register_data
@@ -14,6 +12,10 @@ def create_app() -> "Quart":
domain_services_fn=register_domain_services,
)
import os
from shared.sx.jinja_bridge import load_service_components
load_service_components(os.path.dirname(__file__), service_name="relations")
app.register_blueprint(register_actions())
app.register_blueprint(register_data())

View File

@@ -1,14 +0,0 @@
"""
Relations service s-expression components.
Loads relation-specific .sx components and handlers.
"""
from __future__ import annotations
import os
from shared.sx.jinja_bridge import load_service_components
# Load relations-specific .sx components + handlers at import time
load_service_components(os.path.dirname(os.path.dirname(__file__)),
service_name="relations")

View File

@@ -1,7 +1,7 @@
"""
Shared helper functions for s-expression page rendering.
These are used by per-service sx_components.py files to build common
These are used by per-service sxc/pages modules to build common
page elements (headers, search, etc.) from template context.
"""
from __future__ import annotations

View File

@@ -1,7 +1,5 @@
from __future__ import annotations
import path_setup # noqa: F401
import sx.sx_components as sx_components # noqa: F401
from shared.infrastructure.factory import create_base_app
from shared.sx.jinja_bridge import render
@@ -36,7 +34,10 @@ def create_app() -> "Quart":
domain_services_fn=register_domain_services,
)
import sx.sx_components # noqa: F401
# Load .sx components
import os
from shared.sx.jinja_bridge import load_service_components
load_service_components(os.path.dirname(__file__))
app.register_blueprint(register_dashboard(url_prefix="/"))

View File

@@ -14,7 +14,7 @@ def register(url_prefix: str = "/") -> Blueprint:
"""Full page dashboard with last results."""
from shared.sx.page import get_template_context
from shared.browser.app.csrf import generate_csrf_token
from sx.sx_components import render_dashboard_page_sx
from sxc.pages import render_dashboard_page_sx
import runner
ctx = await get_template_context()
@@ -63,12 +63,12 @@ def register(url_prefix: str = "/") -> Blueprint:
if is_htmx:
# S-expression wire format — sx.js renders client-side
from shared.sx.helpers import sx_response
from sx.sx_components import test_detail_sx
from sxc.pages import test_detail_sx
return sx_response(await test_detail_sx(test))
# Full page render (direct navigation / refresh)
from shared.sx.page import get_template_context
from sx.sx_components import render_test_detail_page_sx
from sxc.pages import render_test_detail_page_sx
ctx = await get_template_context()
html = await render_test_detail_page_sx(ctx, test)
@@ -78,7 +78,7 @@ def register(url_prefix: str = "/") -> Blueprint:
async def results():
"""HTMX partial — poll target for results table."""
from shared.browser.app.csrf import generate_csrf_token
from sx.sx_components import render_results_partial_sx
from sxc.pages import render_results_partial_sx
import runner
result = runner.get_results()

0
test/sxc/__init__.py Normal file
View File

View File

@@ -11,7 +11,7 @@ from shared.sx.helpers import (
)
# Load test-specific .sx components at import time
load_service_components(os.path.dirname(os.path.dirname(__file__)))
load_service_components(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
def _format_time(ts: float | None) -> str: