fix(observatory): preserve camera across follow transitions

This commit is contained in:
DCCONSTRUCTIONS
2026-09-05 08:46:35 +03:00
parent cada687173
commit b2a1b23131
8 changed files with 268 additions and 76 deletions
+18 -1
View File
@@ -1796,6 +1796,7 @@ def test_recorded_blueprint_restores_camera_bounds_after_base_launch_lease_expir
store.reconcile_archive(xgrids_k1_archive_source(sessions))
recording_path = tmp_path / "published.rrd"
calls: list[tuple[Path, dict[str, object]]] = []
blueprint_calls: list[dict[str, object]] = []
class PublishedMaterializer:
def restore_published(self, command: ReplayCommand) -> object:
@@ -1806,11 +1807,19 @@ def test_recorded_blueprint_restores_camera_bounds_after_base_launch_lease_expir
calls.append((path, kwargs))
return 123.5
def blueprint_payload(*_args: object, **kwargs: object) -> bytes:
blueprint_calls.append(kwargs)
return b"RRF2"
monkeypatch.setattr(
"k1link.web.session_api.recorded_blueprint_rrd",
lambda *_args, **_kwargs: b"RRF2",
blueprint_payload,
)
monkeypatch.setattr("k1link.web.session_api.recorded_orbital_radius_limit", camera_bounds)
monkeypatch.setattr(
"k1link.web.session_api.recorded_tracking_position",
lambda *_args, **_kwargs: (100.0, 200.0, 300.0),
)
route = endpoint(
build_session_router(store, recording_materializer=PublishedMaterializer()), # type: ignore[arg-type]
"/api/v1/observation-sessions/{session_id}/blueprint.rrd",
@@ -1828,6 +1837,11 @@ def test_recorded_blueprint_restores_camera_bounds_after_base_launch_lease_expir
show_points=True,
show_trajectory=False,
show_grid=True,
follow_trajectory=False,
eye_position=(3.0, 4.0, 5.0),
eye_look_target=(1.0, 2.0, 0.0),
eye_up=(0.0, 0.0, 1.0),
eye_relative_to_tracking=True,
current_time_ns=39_215_000_000,
),
)
@@ -1845,6 +1859,9 @@ def test_recorded_blueprint_restores_camera_bounds_after_base_launch_lease_expir
},
)
]
assert blueprint_calls[0]["eye_position"] == pytest.approx((102.0, 202.0, 305.0))
assert blueprint_calls[0]["eye_look_target"] == pytest.approx((100.0, 200.0, 300.0))
assert blueprint_calls[0]["eye_up"] == (0.0, 0.0, 1.0)
def test_recorded_perception_endpoint_returns_one_complete_optional_overlay(