Wire SX_USE_REF=1 switching through all route intermediaries

jinja_bridge, helpers, handlers, query_executor now conditionally
import from ref/sx_ref and ref/async_eval_ref when SX_USE_REF=1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 22:17:26 +00:00
parent 7982a07f94
commit 5aa13a99d1
4 changed files with 44 additions and 9 deletions

View File

@@ -20,7 +20,11 @@ async def execute_query(query_def: QueryDef, params: dict[str, str]) -> Any:
Parameters are bound from request query string args.
"""
from .jinja_bridge import get_component_env, _get_request_context
from .async_eval import async_eval
import os
if os.environ.get("SX_USE_REF") == "1":
from .ref.async_eval_ref import async_eval
else:
from .async_eval import async_eval
env = dict(get_component_env())
env.update(query_def.closure)
@@ -45,7 +49,11 @@ async def execute_action(action_def: ActionDef, payload: dict[str, Any]) -> Any:
Parameters are bound from the JSON request body.
"""
from .jinja_bridge import get_component_env, _get_request_context
from .async_eval import async_eval
import os
if os.environ.get("SX_USE_REF") == "1":
from .ref.async_eval_ref import async_eval
else:
from .async_eval import async_eval
env = dict(get_component_env())
env.update(action_def.closure)