refactor: group rpc transport client and methods

This commit is contained in:
lda
2026-06-08 21:44:41 +07:00 Verified
parent 7582c1d6fb
commit c39d361873
25 changed files with 104 additions and 114 deletions
+17 -2
View File
@@ -113,7 +113,7 @@ def load_cli_context(
if rpc_url is not None:
_validate_rpc_url(rpc_url)
client = RpcWorkflowApiClient(
client = rpc_client_from_target(
url=rpc_url,
timeout_seconds=_rpc_timeout_from_optional_config(
resolved_config_path,
@@ -161,7 +161,7 @@ def load_cli_context(
verbose=verbose,
)
if isinstance(target, RpcHttpTargetConfig):
client = RpcWorkflowApiClient(
client = rpc_client_from_target(
url=str(target.url),
timeout_seconds=(
rpc_timeout_seconds
@@ -181,6 +181,21 @@ def load_cli_context(
raise ValueError(f"unsupported workflow target {target!r}")
def rpc_client_from_target(
*,
url: str,
timeout_seconds: float,
) -> RpcWorkflowApiClient:
"""Build the remote workflow surface for a resolved RPC target.
CLI tests patch this project-owned seam instead of monkeypatching `httpx`
internals. The production path still keeps HTTP construction inside the
transport package.
"""
return RpcWorkflowApiClient(url=url, timeout_seconds=timeout_seconds)
def load_local_cli_context(
config_path: str | Path,
*,