fix(viewer): preserve operator camera across AI layers

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 10:51:18 +03:00
parent a0706fd5d8
commit 3a64f54dea
12 changed files with 425 additions and 109 deletions
+48 -1
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
import hashlib
import json
import re
import struct
import subprocess
import sys
@@ -35,7 +36,12 @@ from k1link.device_plugins.xgrids_k1.rrd_export import (
export_k1mqtt_to_rrd,
recorded_blueprint_rrd,
)
from k1link.viewer.recorded import recorded_blueprint as viewer_recorded_blueprint
from k1link.viewer.recorded import (
recorded_blueprint as viewer_recorded_blueprint,
)
from k1link.viewer.recorded import (
recorded_blueprint_rrd as viewer_recorded_blueprint_rrd,
)
from k1link.viewer.rerun_bridge import RerunSceneSettings
@@ -410,6 +416,47 @@ def test_viewer_blueprint_reset_is_bounded_and_recreates_render_views() -> None:
assert perception_behavior.visible.as_arrow_array().to_pylist() == [False]
def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset() -> None:
session_id = "b" * 32
initial = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
)
layers_enabled = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
)
reset = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
view_reset_generation=1,
unified_perception=True,
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
)
store_pattern = rb"rec_[0-9a-f]{32}"
initial_store_ids = set(re.findall(store_pattern, initial))
layer_store_ids = set(re.findall(store_pattern, layers_enabled))
reset_store_ids = set(re.findall(store_pattern, reset))
assert len(initial_store_ids) == 1
assert layer_store_ids == initial_store_ids
assert len(reset_store_ids) == 1
assert reset_store_ids.isdisjoint(initial_store_ids)
assert len(initial) < 350_000
assert len(layers_enabled) < 350_000
assert len(reset) < 350_000
def test_viewer_blueprint_unifies_original_video_and_independent_ai_layers() -> None:
blueprint = viewer_recorded_blueprint(
RerunSceneSettings(accumulation_seconds=12.0),
+4 -1
View File
@@ -1077,6 +1077,7 @@ def test_recorded_blueprint_endpoint_is_small_strict_and_session_scoped(
request=RecordedBlueprintRequest(
application_id="nodedc_mission_core_recorded",
recording_id="recording-001",
blueprint_session_id="a" * 32,
accumulation_seconds=18.5,
show_points=False,
show_trajectory=True,
@@ -1098,11 +1099,12 @@ def test_recorded_blueprint_endpoint_is_small_strict_and_session_scoped(
assert response.headers["cache-control"] == "no-store"
assert response.headers["x-content-type-options"] == "nosniff"
assert response.body.startswith(b"RRF2")
assert len(response.body) < 100_000
assert len(response.body) < 250_000
assert_no_local_paths(response.headers, repository)
assert len(observed_settings) == 1
assert observed_settings[0].show_points is False
assert observed_settings[0].show_trajectory is True
assert observed_kwargs[0]["blueprint_session_id"] == "a" * 32
assert observed_kwargs[0]["active_view"] == "perception"
assert observed_kwargs[0]["view_reset_generation"] == 1
assert observed_kwargs[0]["unified_perception"] is True
@@ -1127,6 +1129,7 @@ def test_recorded_blueprint_endpoint_is_small_strict_and_session_scoped(
request=RecordedBlueprintRequest(
application_id="nodedc_mission_core_recorded",
recording_id="recording-001",
blueprint_session_id="a" * 32,
accumulation_seconds=12,
show_points=True,
show_trajectory=True,