fix(lab): seal RAV004 spatial replay transport
This commit is contained in:
@@ -3,14 +3,17 @@ from __future__ import annotations
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
import k1link.sessions.canonical_lab_spatial as spatial_module
|
||||
from k1link.sessions.canonical_lab_spatial import (
|
||||
_TimedPoints,
|
||||
_TimedPoses,
|
||||
_bounded_local_slam,
|
||||
_estimate_sensor_height,
|
||||
_CanonicalSpatialIndex,
|
||||
_estimate_local_sensor_height,
|
||||
_estimate_sensor_height,
|
||||
_gravity_stable_basis_map_from_body,
|
||||
_ground_origin_map,
|
||||
_TimedPoints,
|
||||
_TimedPoses,
|
||||
canonical_lab_spatial_playback_points,
|
||||
)
|
||||
|
||||
|
||||
@@ -127,3 +130,43 @@ def test_sensor_height_tracks_current_source_window_instead_of_fixed_mount() ->
|
||||
assert high == pytest.approx(1.05, abs=0.03)
|
||||
assert low_samples >= 3 and high_samples >= 3
|
||||
assert low_source == high_source == "local-source-cloud-ground-quantile-median"
|
||||
|
||||
|
||||
def test_playback_track_binds_sparse_map_increments_to_dense_camera_timeline(
|
||||
tmp_path,
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
recording = tmp_path / "recording.rrd"
|
||||
recording.write_bytes(b"sealed")
|
||||
points = _TimedPoints(
|
||||
times_ns=(10, 20),
|
||||
values=(
|
||||
np.asarray([[1.0, 2.0, 3.0]], dtype=np.float32),
|
||||
np.asarray([[4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], dtype=np.float32),
|
||||
),
|
||||
)
|
||||
empty_poses = _TimedPoses(times_ns=(), translations=(), quaternions_xyzw=())
|
||||
index = _CanonicalSpatialIndex(
|
||||
points=points,
|
||||
poses=empty_poses,
|
||||
trajectories=_TimedPoints(times_ns=(), values=()),
|
||||
sensor_height_m=0.4,
|
||||
sensor_height_sample_count=0,
|
||||
sensor_height_mad_m=0.0,
|
||||
)
|
||||
monkeypatch.setattr(spatial_module, "_load_index", lambda *_args: index)
|
||||
|
||||
track, offsets = canonical_lab_spatial_playback_points(
|
||||
recording,
|
||||
"a" * 64,
|
||||
(10, 15, 20, 25),
|
||||
)
|
||||
|
||||
assert offsets == (0, 1, 1, 3, 3)
|
||||
assert track.tolist() == [
|
||||
[1.0, 2.0, 3.0],
|
||||
[4.0, 5.0, 6.0],
|
||||
[7.0, 8.0, 9.0],
|
||||
]
|
||||
assert track.dtype == np.dtype("<f4")
|
||||
assert not track.flags.writeable
|
||||
|
||||
@@ -22,6 +22,7 @@ from k1link.laboratory.evidence_report import verify_laboratory_evidence_result
|
||||
from k1link.laboratory.vegetation_policy_review import seal_vegetation_policy_review
|
||||
from k1link.laboratory.vegetation_shadow_lab import seal_vegetation_shadow_lab
|
||||
from k1link.web.vegetation_shadow_lab_api import (
|
||||
_canonical_route_playback_chunk_descriptor,
|
||||
_mask_component_boxes,
|
||||
_route_tgs_anchor_payload,
|
||||
build_vegetation_shadow_lab_router,
|
||||
@@ -42,6 +43,25 @@ def test_semantic_component_boxes_keep_distinct_objects_separate() -> None:
|
||||
]
|
||||
|
||||
|
||||
def test_route_playback_chunk_descriptor_seals_only_requested_binary_window() -> None:
|
||||
points = np.arange(18, dtype="<f4").reshape(6, 3)
|
||||
descriptor = _canonical_route_playback_chunk_descriptor(
|
||||
"/api/v1/laboratory/vegetation-shadow",
|
||||
f"lab-v1-vegetation-shadow-{'a' * 64}",
|
||||
memoryview(points).cast("B"),
|
||||
(0, 1, 1, 3, 6),
|
||||
0,
|
||||
)
|
||||
|
||||
assert descriptor is not None
|
||||
assert descriptor["start"] == 0
|
||||
assert descriptor["count"] == 4
|
||||
assert descriptor["point_count"] == 6
|
||||
assert descriptor["bytes"] == points.nbytes
|
||||
assert descriptor["shape"] == [6, 3]
|
||||
assert len(str(descriptor["sha256"])) == 64
|
||||
|
||||
|
||||
def test_route_tgs_anchor_payload_preserves_metric_evidence(tmp_path: Path) -> None:
|
||||
path = tmp_path / "tgs-evidence.npz"
|
||||
point_counts = np.arange(1, 11, dtype=np.int64)
|
||||
|
||||
Reference in New Issue
Block a user