feat(perception): integrate calibrated operator pipeline
Add calibrated K1 projection, recorded and near-live perception qualification, unified Rerun operator layers, bounded replay admission, audited viewer controls, worker experiments, and lab evidence.
This commit is contained in:
@@ -12,6 +12,7 @@ import pytest
|
||||
import k1link.device_plugins.xgrids_k1.camera as camera_module
|
||||
from k1link.device_plugins.xgrids_k1.camera import (
|
||||
CAMERA_MEDIA_TYPE,
|
||||
CommittedCameraSegment,
|
||||
XgridsK1CameraGateway,
|
||||
_build_ffmpeg_argv,
|
||||
_read_mp4_box,
|
||||
@@ -169,6 +170,45 @@ def test_camera_selection_is_exclusive_and_hides_device_transport(
|
||||
gateway.close()
|
||||
|
||||
|
||||
def test_camera_derived_observer_runs_only_after_durable_archive_commit(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
monkeypatch.setenv("MISSIONCORE_FFMPEG_BINARY", str(_fake_ffmpeg(tmp_path)))
|
||||
session = tmp_path / "session"
|
||||
session.mkdir()
|
||||
observed: list[CommittedCameraSegment] = []
|
||||
|
||||
def observe(segment: CommittedCameraSegment) -> None:
|
||||
archive = (
|
||||
session
|
||||
/ "media"
|
||||
/ segment.source_id
|
||||
/ f"epoch-{segment.generation}"
|
||||
)
|
||||
committed = (
|
||||
archive / "init.mp4"
|
||||
if segment.kind == "init"
|
||||
else archive / "segments" / f"{segment.sequence}.m4s"
|
||||
)
|
||||
assert committed.read_bytes() == segment.payload
|
||||
observed.append(segment)
|
||||
|
||||
gateway = XgridsK1CameraGateway(
|
||||
tmp_path,
|
||||
XGRIDS_K1_PLUGIN_ID,
|
||||
committed_segment_observer=observe,
|
||||
)
|
||||
try:
|
||||
gateway.start_recording(session)
|
||||
gateway.select("sensor.camera.right", "192.168.8.52")
|
||||
_wait_until(lambda: len(observed) == 2)
|
||||
assert [segment.kind for segment in observed] == ["init", "media"]
|
||||
assert gateway.snapshot()["derived_observer_errors"] == 0
|
||||
finally:
|
||||
gateway.close()
|
||||
|
||||
|
||||
def test_camera_ffmpeg_command_is_allowlisted_copy_remux() -> None:
|
||||
argv = _build_ffmpeg_argv(
|
||||
Path("/trusted/ffmpeg"),
|
||||
|
||||
Reference in New Issue
Block a user