Skip to content

Commit a0a2360

Browse files
authored
Update app.py
1 parent 11f86bd commit a0a2360

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/ix_operator/app.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
from dataclasses import dataclass
44

5-
from ix_operator.config import OperatorConfig
5+
from ix_operator.config import (
6+
IMPLEMENTED_TRANSPORT_BACKENDS,
7+
OperatorConfig,
8+
TransportBackend,
9+
)
610
from ix_operator.crypto import (
711
NativeExtensionUnavailableError,
812
NativeHandshakeBackend,
@@ -24,6 +28,10 @@ class ScriptRunResult:
2428
agent_ids: tuple[str, ...]
2529

2630

31+
class UnsupportedTransportBackendError(RuntimeError):
32+
"""Raised when a configured transport backend is not implemented in v1."""
33+
34+
2735
class OperatorApplication:
2836
def __init__(self, *, config: OperatorConfig, context: RuntimeContext) -> None:
2937
self._config = config
@@ -56,6 +64,7 @@ def status_snapshot(self) -> ApplicationSnapshot:
5664
version="0.1.0",
5765
mode=self._config.mode.value,
5866
transport=self._config.transport_backend.value,
67+
transport_supported=self._config.transport_backend in IMPLEMENTED_TRANSPORT_BACKENDS,
5968
boot_id=self._context.boot_id,
6069
runtime_root=str(self._config.runtime_paths.root),
6170
audit_log_path=str(self._context.audit.path),
@@ -108,6 +117,7 @@ def load_identity(self) -> NodeIdentity | None:
108117

109118
def boot_local_node(self) -> OperatorNode:
110119
self._require_native_extension()
120+
self._require_supported_transport_backend()
111121

112122
identity = self._identity_store.load()
113123
if identity is None:
@@ -162,6 +172,16 @@ def _require_native_extension(self) -> None:
162172
"native ix_crypto extension is unavailable; build the PyO3 module first"
163173
)
164174

175+
def _require_supported_transport_backend(self) -> None:
176+
if self._config.transport_backend in IMPLEMENTED_TRANSPORT_BACKENDS:
177+
return
178+
179+
supported = ", ".join(item.value for item in IMPLEMENTED_TRANSPORT_BACKENDS)
180+
raise UnsupportedTransportBackendError(
181+
f"transport backend '{self._config.transport_backend.value}' is not implemented in v1; "
182+
f"supported backends: {supported}"
183+
)
184+
165185
def _info_severity(self):
166186
from ix_operator.audit import AuditSeverity
167187

0 commit comments

Comments
 (0)