mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-21 22:11:12 +00:00
[AZ-243] Integrate production native VIO runtime
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,7 +10,7 @@ from e2e.replay.harness import (
|
||||
validate_derkachi_alignment,
|
||||
)
|
||||
from shared.contracts import FramePacket, TelemetrySample
|
||||
from vio_adapter import LocalVioAdapter, VioInputPacket
|
||||
from vio_adapter import VioInputPacket, VioRuntimeConfig, create_vio_adapter
|
||||
|
||||
|
||||
def test_derkachi_alignment_validator_accepts_expected_fixture_shape() -> None:
|
||||
@@ -39,7 +39,7 @@ def test_derkachi_alignment_validator_blocks_duration_drift() -> None:
|
||||
|
||||
def test_public_vio_replay_boundary_emits_frame_by_frame_estimate() -> None:
|
||||
# Arrange
|
||||
adapter = LocalVioAdapter()
|
||||
adapter = create_vio_adapter(VioRuntimeConfig(environment="development", mode="replay"))
|
||||
frame = FramePacket(
|
||||
frame_id="derkachi-0001",
|
||||
timestamp_ns=1_000_000_000,
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from shared.contracts import FramePacket, TelemetrySample
|
||||
from vio_adapter import LocalVioAdapter, NativeVioBackend, VioBackendEstimate, VioInputPacket
|
||||
from vio_adapter import (
|
||||
LocalVioAdapter,
|
||||
NativeVioBackend,
|
||||
VioBackendEstimate,
|
||||
VioInputPacket,
|
||||
VioRuntimeConfig,
|
||||
create_vio_adapter,
|
||||
)
|
||||
|
||||
|
||||
class RecordingNativeRunner:
|
||||
@@ -109,6 +119,59 @@ def test_configured_native_backend_path_emits_vio_state() -> None:
|
||||
assert result.processing_latency_ms is not None
|
||||
|
||||
|
||||
def test_production_profile_selects_native_runtime_path() -> None:
|
||||
# Arrange
|
||||
runner = RecordingNativeRunner()
|
||||
adapter = create_vio_adapter(
|
||||
VioRuntimeConfig(environment="production"),
|
||||
native_runner_factory=lambda: runner,
|
||||
)
|
||||
packet = VioInputPacket(frame=_frame(), telemetry_samples=(_telemetry(),))
|
||||
|
||||
# Act
|
||||
result = adapter.process(packet)
|
||||
|
||||
# Assert
|
||||
assert runner.initialized is True
|
||||
assert runner.estimate_calls == 1
|
||||
assert result.error is None
|
||||
assert result.state_packet is not None
|
||||
assert result.health.backend_name == "basalt"
|
||||
|
||||
|
||||
def test_production_profile_without_installed_native_runtime_fails_closed() -> None:
|
||||
# Arrange
|
||||
adapter = create_vio_adapter(VioRuntimeConfig(environment="production"))
|
||||
packet = VioInputPacket(frame=_frame(), telemetry_samples=(_telemetry(),))
|
||||
|
||||
# Act
|
||||
result = adapter.process(packet)
|
||||
|
||||
# Assert
|
||||
assert result.state_packet is None
|
||||
assert result.health.state == "failed"
|
||||
assert result.error is not None
|
||||
assert result.error.cause == "backend_initialization_failed"
|
||||
assert "unable to load BASALT runtime" in result.error.message
|
||||
|
||||
|
||||
def test_replay_mode_is_explicit_and_not_valid_for_production() -> None:
|
||||
# Arrange
|
||||
replay_config = VioRuntimeConfig(environment="development", mode="replay")
|
||||
adapter = create_vio_adapter(replay_config)
|
||||
packet = VioInputPacket(frame=_frame(), telemetry_samples=(_telemetry(),))
|
||||
|
||||
# Act
|
||||
result = adapter.process(packet)
|
||||
|
||||
# Assert
|
||||
assert result.error is None
|
||||
assert result.state_packet is not None
|
||||
assert result.health.backend_name == "replay_vio"
|
||||
with pytest.raises(ValidationError, match="require native runtime mode"):
|
||||
VioRuntimeConfig(environment="production", mode="replay")
|
||||
|
||||
|
||||
def test_native_backend_initialization_failure_sets_failed_health() -> None:
|
||||
# Arrange
|
||||
adapter = LocalVioAdapter(
|
||||
|
||||
Reference in New Issue
Block a user